user32/tests: Print the failure position in the message sequence.

This commit is contained in:
Alexandre Julliard 2009-01-15 14:45:53 +01:00
parent 2d15dd54c6
commit 078689adb0
1 changed files with 40 additions and 36 deletions

View File

@ -1836,6 +1836,7 @@ static void flush_sequence(void)
static void dump_sequence(const struct message *expected, const char *context, const char *file, int line)
{
const struct recvd_message *actual = sequence;
unsigned int count = 0;
trace_(file, line)("Failed sequence %s:\n", context );
while (expected->message && actual->message)
@ -1844,18 +1845,18 @@ static void dump_sequence(const struct message *expected, const char *context, c
{
if (expected->flags & hook)
{
trace_(file, line)( " expected: hook %04x - actual: %s\n",
expected->message, actual->output );
trace_(file, line)( " %u: expected: hook %04x - actual: %s\n",
count, expected->message, actual->output );
}
else if (expected->flags & winevent_hook)
{
trace_(file, line)( " expected: winevent %04x - actual: %s\n",
expected->message, actual->output );
trace_(file, line)( " %u: expected: winevent %04x - actual: %s\n",
count, expected->message, actual->output );
}
else
{
trace_(file, line)( " expected: msg %04x - actual: %s\n",
expected->message, actual->output );
trace_(file, line)( " %u: expected: msg %04x - actual: %s\n",
count, expected->message, actual->output );
}
}
@ -1872,6 +1873,7 @@ static void dump_sequence(const struct message *expected, const char *context, c
expected++;
actual++;
}
count++;
}
/* optional trailing messages */
@ -1893,6 +1895,7 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
const struct message *expected = expected_list;
const struct recvd_message *actual;
int failcount = 0, dump = 0;
unsigned int count = 0;
add_message(&end_of_sequence);
@ -1910,15 +1913,15 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
failcount ++;
if (strcmp(winetest_platform, "wine")) dump++;
ok_( file, line) (FALSE,
"%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
context, expected->message, expected->wParam, actual->wParam);
"%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
context, count, expected->message, expected->wParam, actual->wParam);
}
}
else
{
ok_( file, line)(expected->wParam == actual->wParam,
"%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
context, expected->message, expected->wParam, actual->wParam);
"%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
context, count, expected->message, expected->wParam, actual->wParam);
if (expected->wParam != actual->wParam) dump++;
}
@ -1931,15 +1934,15 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
failcount ++;
if (strcmp(winetest_platform, "wine")) dump++;
ok_( file, line) (FALSE,
"%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
context, expected->message, expected->lParam, actual->lParam);
"%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
context, count, expected->message, expected->lParam, actual->lParam);
}
}
else
{
ok_( file, line)(expected->lParam == actual->lParam,
"%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
context, expected->message, expected->lParam, actual->lParam);
"%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
context, count, expected->message, expected->lParam, actual->lParam);
if (expected->lParam != actual->lParam) dump++;
}
}
@ -1949,41 +1952,41 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
failcount ++;
if (strcmp(winetest_platform, "wine")) dump++;
ok_( file, line) (FALSE,
"%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
"%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
}
}
else
{
ok_( file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
"%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
"%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
if ((expected->flags & defwinproc) != (actual->flags & defwinproc)) dump++;
}
ok_( file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
"%s: the msg 0x%04x should %shave been sent by BeginPaint\n",
context, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
"%s: %u: the msg 0x%04x should %shave been sent by BeginPaint\n",
context, count, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
if ((expected->flags & beginpaint) != (actual->flags & beginpaint)) dump++;
ok_( file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
"%s: the msg 0x%04x should have been %s\n",
context, expected->message, (expected->flags & posted) ? "posted" : "sent");
"%s: %u: the msg 0x%04x should have been %s\n",
context, count, expected->message, (expected->flags & posted) ? "posted" : "sent");
if ((expected->flags & (sent|posted)) != (actual->flags & (sent|posted))) dump++;
ok_( file, line) ((expected->flags & parent) == (actual->flags & parent),
"%s: the msg 0x%04x was expected in %s\n",
context, expected->message, (expected->flags & parent) ? "parent" : "child");
"%s: %u: the msg 0x%04x was expected in %s\n",
context, count, expected->message, (expected->flags & parent) ? "parent" : "child");
if ((expected->flags & parent) != (actual->flags & parent)) dump++;
ok_( file, line) ((expected->flags & hook) == (actual->flags & hook),
"%s: the msg 0x%04x should have been sent by a hook\n",
context, expected->message);
"%s: %u: the msg 0x%04x should have been sent by a hook\n",
context, count, expected->message);
if ((expected->flags & hook) != (actual->flags & hook)) dump++;
ok_( file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
"%s: the msg 0x%04x should have been sent by a winevent hook\n",
context, expected->message);
"%s: %u: the msg 0x%04x should have been sent by a winevent hook\n",
context, count, expected->message);
if ((expected->flags & winevent_hook) != (actual->flags & winevent_hook)) dump++;
expected++;
@ -1997,19 +2000,20 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
failcount++;
todo_wine {
if (strcmp(winetest_platform, "wine")) dump++;
ok_( file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
context, expected->message, actual->message);
ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
context, count, expected->message, actual->message);
}
goto done;
}
else
{
ok_( file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
context, expected->message, actual->message);
ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
context, count, expected->message, actual->message);
dump++;
expected++;
actual++;
}
count++;
}
/* skip all optional trailing messages */
@ -2023,8 +2027,8 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
if (expected->message || actual->message) {
failcount++;
if (strcmp(winetest_platform, "wine")) dump++;
ok_( file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
context, expected->message, actual->message);
ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
context, count, expected->message, actual->message);
}
}
}
@ -2033,8 +2037,8 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
if (expected->message || actual->message)
{
dump++;
ok_( file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
context, expected->message, actual->message);
ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
context, count, expected->message, actual->message);
}
}
if( todo && !failcount) /* succeeded yet marked todo */