user32/tests: Fix test failures when the low-level hook cannot be set.

This commit is contained in:
Alexandre Julliard 2011-07-22 12:00:58 +02:00
parent a900fe7c9e
commit fb2df6752e
1 changed files with 6 additions and 4 deletions

View File

@ -2025,7 +2025,8 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
while (expected->message && actual->message) while (expected->message && actual->message)
{ {
if (expected->message == actual->message) if (expected->message == actual->message &&
!((expected->flags ^ actual->flags) & (hook|winevent_hook|kbd_hook)))
{ {
if (expected->flags & wparam) if (expected->flags & wparam)
{ {
@ -2130,7 +2131,8 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
/* silently drop hook messages if there is no support for them */ /* silently drop hook messages if there is no support for them */
else if ((expected->flags & optional) || else if ((expected->flags & optional) ||
((expected->flags & hook) && !hCBT_hook) || ((expected->flags & hook) && !hCBT_hook) ||
((expected->flags & winevent_hook) && !hEvent_hook)) ((expected->flags & winevent_hook) && !hEvent_hook) ||
((expected->flags & kbd_hook) && !hKBD_hook))
expected++; expected++;
else if (todo) else if (todo)
{ {
@ -13213,7 +13215,7 @@ static void test_hotkey(void)
} }
hKBD_hook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, GetModuleHandle(NULL), 0); hKBD_hook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, GetModuleHandle(NULL), 0);
ok(hKBD_hook != NULL, "failed to install hook, err %i\n", GetLastError()); if (!hKBD_hook) win_skip("WH_KEYBOARD_LL is not supported\n");
/* Same key combination, different id */ /* Same key combination, different id */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
@ -13409,7 +13411,7 @@ static void test_hotkey(void)
ret = UnregisterHotKey(NULL, 5); ret = UnregisterHotKey(NULL, 5);
ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError()); ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError());
UnhookWindowsHookEx(hKBD_hook); if (hKBD_hook) UnhookWindowsHookEx(hKBD_hook);
hKBD_hook = NULL; hKBD_hook = NULL;
end: end: