user32/tests: Make it easier to identify failed tests.

This commit is contained in:
Vitaliy Margolen 2008-09-25 08:26:15 -06:00 committed by Alexandre Julliard
parent 311fea4ec4
commit cc5ff833b3
1 changed files with 49 additions and 28 deletions

View File

@ -415,6 +415,7 @@ struct sendinput_test_s {
struct message expected_messages[MAXKEYMESSAGES+1];
} sendinput_test[] = {
/* test ALT+F */
/* 0 */
{VK_LMENU, 0, 0, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook|wparam, VK_LMENU}, {WM_SYSKEYDOWN}, {0}}},
{'F', 0, 0, {{'F', 0x00}, {0}},
@ -427,6 +428,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test CTRL+O */
/* 4 */
{VK_LCONTROL, 0, 0, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
{'O', 0, 0, {{'O', 0x00}, {0}},
@ -437,6 +439,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test ALT+CTRL+X */
/* 8 */
{VK_LMENU, 0, 0, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook}, {WM_SYSKEYDOWN}, {0}}},
{VK_LCONTROL, 0, 0, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
@ -451,6 +454,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test SHIFT+A */
/* 14 */
{VK_LSHIFT, 0, 0, {{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
{'A', 0, 0, {{'A', 0x00}, {0}},
@ -461,6 +465,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test L-SHIFT & R-SHIFT: */
/* RSHIFT == LSHIFT */
/* 18 */
{VK_RSHIFT, 0, 0,
/* recent windows versions (>= w2k3) correctly report an RSHIFT transition */
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00, TRUE}, {VK_RSHIFT, 0x00, TRUE}, {0}},
@ -472,6 +477,7 @@ struct sendinput_test_s {
{WM_KEYUP}, {0}}},
/* LSHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 20 */
{VK_LSHIFT, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LSHIFT, LLKHF_EXTENDED},
@ -481,6 +487,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook|wparam|lparam, VK_LSHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
/* RSHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 22 */
{VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_RSHIFT, LLKHF_EXTENDED},
@ -495,6 +502,7 @@ struct sendinput_test_s {
winXP+ - Attempts to convert key to L/R key but not always correct
*/
/* SHIFT == LSHIFT */
/* 24 */
{VK_SHIFT, 0, 0,
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook/* |wparam */|lparam, VK_SHIFT, 0},
@ -504,6 +512,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook/*|wparam*/|lparam, VK_SHIFT, LLKHF_UP},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
/* SHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 26 */
{VK_SHIFT, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam*/|lparam, VK_SHIFT, LLKHF_EXTENDED},
@ -515,6 +524,7 @@ struct sendinput_test_s {
/* test L-CONTROL & R-CONTROL: */
/* RCONTROL == LCONTROL */
/* 28 */
{VK_RCONTROL, 0, 0,
{{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam, VK_RCONTROL},
@ -524,6 +534,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook|wparam, VK_RCONTROL},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP}, {0}}},
/* LCONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 30 */
{VK_LCONTROL, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LCONTROL, LLKHF_EXTENDED},
@ -533,6 +544,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook|wparam|lparam, VK_LCONTROL, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP|KF_EXTENDED}, {0}}},
/* RCONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 32 */
{VK_RCONTROL, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_RCONTROL, LLKHF_EXTENDED},
@ -542,6 +554,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook|wparam|lparam, VK_RCONTROL, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP|KF_EXTENDED}, {0}}},
/* CONTROL == LCONTROL */
/* 34 */
{VK_CONTROL, 0, 0,
{{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam, VK_CONTROL*/},
@ -551,6 +564,7 @@ struct sendinput_test_s {
{{WM_KEYUP, hook/*|wparam, VK_CONTROL*/},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP}, {0}}},
/* CONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 36 */
{VK_CONTROL, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam*/|lparam, VK_CONTROL, LLKHF_EXTENDED},
@ -562,6 +576,7 @@ struct sendinput_test_s {
/* test L-MENU & R-MENU: */
/* RMENU == LMENU */
/* 38 */
{VK_RMENU, 0, 0,
{{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook|wparam, VK_RMENU},
@ -572,6 +587,7 @@ struct sendinput_test_s {
{WM_SYSKEYUP, wparam|lparam, VK_MENU, KF_UP},
{WM_SYSCOMMAND}, {0}}},
/* LMENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 40 */
{VK_LMENU, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|lparam, VK_LMENU, LLKHF_EXTENDED},
@ -582,6 +598,7 @@ struct sendinput_test_s {
{WM_SYSKEYUP, wparam|lparam, VK_MENU, KF_UP|KF_EXTENDED},
{WM_SYSCOMMAND}, {0}}},
/* RMENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 42 */
{VK_RMENU, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|lparam, VK_RMENU, LLKHF_EXTENDED},
@ -592,6 +609,7 @@ struct sendinput_test_s {
{WM_SYSKEYUP, wparam|lparam, VK_MENU, KF_UP|KF_EXTENDED},
{WM_SYSCOMMAND}, {0}}},
/* MENU == LMENU */
/* 44 */
{VK_MENU, 0, 0,
{{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook/*|wparam, VK_MENU*/},
@ -602,6 +620,7 @@ struct sendinput_test_s {
{WM_SYSKEYUP, wparam|lparam, VK_MENU, KF_UP},
{WM_SYSCOMMAND}, {0}}},
/* MENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 46 */
{VK_MENU, KEYEVENTF_EXTENDEDKEY, 0,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook/*|wparam*/|lparam, VK_MENU, LLKHF_EXTENDED},
@ -613,6 +632,7 @@ struct sendinput_test_s {
{WM_SYSCOMMAND}, {0}}},
/* test LSHIFT & RSHIFT */
/* 48 */
{VK_LSHIFT, 0, 0,
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LSHIFT, 0},
@ -652,15 +672,15 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, struct sendinput_tes
{
failcount++;
todo_wine {
ok(matched, "%02d: %02x from %02x -> %02x "
"instead of %02x -> %02x\n", id, t->wVk,
ks1[t->wVk]&0x80, ks2[t->wVk]&0x80, t->before_state,
ok(matched, "%2d (%x/%x): %02x from %02x -> %02x "
"instead of %02x -> %02x\n", id, test->wVk, test->dwFlags,
t->wVk, ks1[t->wVk]&0x80, ks2[t->wVk]&0x80, t->before_state,
~t->before_state&0x80);
}
} else {
ok(matched || t->optional, "%02d: %02x from %02x -> %02x "
"instead of %02x -> %02x\n", id, t->wVk,
ks1[t->wVk]&0x80, ks2[t->wVk]&0x80, t->before_state,
ok(matched || t->optional, "%2d (%x/%x): %02x from %02x -> %02x "
"instead of %02x -> %02x\n", id, test->wVk, test->dwFlags,
t->wVk, ks1[t->wVk]&0x80, ks2[t->wVk]&0x80, t->before_state,
~t->before_state&0x80);
}
ks2[t->wVk] = ks1[t->wVk]; /* clear the match */
@ -671,11 +691,12 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, struct sendinput_tes
{
failcount++;
todo_wine
ok(FALSE, "%02d: %02x from %02x -> %02x unexpected\n", id, i, ks1[i], ks2[i]);
ok(FALSE, "%2d (%x/%x): %02x from %02x -> %02x unexpected\n",
id, test->wVk, test->dwFlags, i, ks1[i], ks2[i]);
}
else
ok(ks2[i] == ks1[i], "%02d: %02x from %02x -> %02x unexpected\n",
id, i, ks1[i], ks2[i]);
ok(ks2[i] == ks1[i], "%2d (%x/%x): %02x from %02x -> %02x unexpected\n",
id, test->wVk, test->dwFlags, i, ks1[i], ks2[i]);
while (expected->message && actual_cnt < sent_messages_cnt)
{
@ -684,8 +705,8 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, struct sendinput_tes
if (expected->message == actual->message)
{
ok((expected->flags & hook) == (actual->flags & hook),
"%x/%x: the msg 0x%04x should have been sent by a hook\n",
test->wVk, test->dwFlags, expected->message);
"%2d (%x/%x): the msg 0x%04x should have been sent by a hook\n",
id, test->wVk, test->dwFlags, expected->message);
if (expected->flags & wparam)
{
@ -693,13 +714,13 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, struct sendinput_tes
{
failcount++;
todo_wine
ok(FALSE, "%x/%x: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
test->wVk, test->dwFlags, expected->message, expected->wParam, actual->wParam);
ok(FALSE, "%2d (%x/%x): in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
id, test->wVk, test->dwFlags, expected->message, expected->wParam, actual->wParam);
}
else
ok(expected->wParam == actual->wParam,
"%x/%x: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
test->wVk, test->dwFlags, expected->message, expected->wParam, actual->wParam);
"%2d (%x/%x): in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
id, test->wVk, test->dwFlags, expected->message, expected->wParam, actual->wParam);
}
if (expected->flags & lparam)
{
@ -707,13 +728,13 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, struct sendinput_tes
{
failcount++;
todo_wine
ok(FALSE, "%x/%x: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
test->wVk, test->dwFlags, expected->message, expected->lParam, actual->lParam);
ok(FALSE, "%2d (%x/%x): in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
id, test->wVk, test->dwFlags, expected->message, expected->lParam, actual->lParam);
}
else
ok(expected->lParam == actual->lParam,
"%x/%x: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
test->wVk, test->dwFlags, expected->message, expected->lParam, actual->lParam);
"%2d (%x/%x): in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
id, test->wVk, test->dwFlags, expected->message, expected->lParam, actual->lParam);
}
}
else if (expected->flags & optional)
@ -726,13 +747,13 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, struct sendinput_tes
failcount++;
todo_wine
ok(FALSE,
"%x/%x: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
test->wVk, test->dwFlags, expected->message, actual->message);
"%2d (%x/%x): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
id, test->wVk, test->dwFlags, expected->message, actual->message);
}
else
ok(FALSE,
"%x/%x: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
test->wVk, test->dwFlags, expected->message, actual->message);
"%2d (%x/%x): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
id, test->wVk, test->dwFlags, expected->message, actual->message);
actual_cnt++;
expected++;
@ -748,17 +769,17 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, struct sendinput_tes
{
failcount++;
todo_wine
ok(FALSE, "%x/%x: the msg sequence is not complete: expected %04x - actual %04x\n",
test->wVk, test->dwFlags, expected->message, sent_messages[actual_cnt].message);
ok(FALSE, "%2d (%x/%x): the msg sequence is not complete: expected %04x - actual %04x\n",
id, test->wVk, test->dwFlags, expected->message, sent_messages[actual_cnt].message);
}
else
ok(FALSE, "%x/%x: the msg sequence is not complete: expected %04x - actual %04x\n",
test->wVk, test->dwFlags, expected->message, sent_messages[actual_cnt].message);
ok(FALSE, "%2d (%x/%x): the msg sequence is not complete: expected %04x - actual %04x\n",
id, test->wVk, test->dwFlags, expected->message, sent_messages[actual_cnt].message);
}
if( test->_todo_wine && !failcount) /* succeeded yet marked todo */
todo_wine
ok(TRUE, "%x/%x: marked \"todo_wine\" but succeeds\n", test->wVk, test->dwFlags);
ok(TRUE, "%2d (%x/%x): marked \"todo_wine\" but succeeds\n", id, test->wVk, test->dwFlags);
sent_messages_cnt = 0;
}