user32: Add a test to find the queue containing hotkey messages.

This commit is contained in:
Vincent Povirk 2011-06-13 12:31:08 -05:00 committed by Alexandre Julliard
parent 9eb6af791f
commit 1e2e3d1a05
1 changed files with 34 additions and 0 deletions

View File

@ -13078,6 +13078,22 @@ static const struct message WmHotkeyReleaseLWIN[] = {
{ WM_KEYUP, sent|wparam|lparam, VK_LWIN, 0xc0000001 },
{ 0 }
};
static const struct message WmHotkeyCombined[] = {
{ WM_KEYDOWN, kbd_hook|wparam|lparam, VK_LWIN, LLKHF_INJECTED },
{ WM_KEYDOWN, kbd_hook|lparam, 0, LLKHF_INJECTED },
{ WM_KEYUP, kbd_hook|lparam, 0, LLKHF_INJECTED|LLKHF_UP },
{ WM_KEYUP, kbd_hook|wparam|lparam, VK_LWIN, LLKHF_INJECTED|LLKHF_UP },
{ WM_APP, sent, 0, 0 },
{ WM_HOTKEY, sent|wparam, 5 },
{ WM_APP+1, sent, 0, 0 },
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_LWIN, 1 },
{ WM_KEYDOWN, sent|wparam|lparam, VK_LWIN, 1 },
{ HCBT_KEYSKIPPED, hook|optional, 0, 0x80000001 },
{ WM_KEYUP, sent, 0, 0x80000001 }, /* lparam not checked so the sequence isn't a todo */
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_LWIN, 0xc0000001 },
{ WM_KEYUP, sent|wparam|lparam, VK_LWIN, 0xc0000001 },
{ 0 }
};
static int hotkey_letter;
@ -13223,6 +13239,24 @@ static void test_hotkey(void)
DispatchMessage(&msg);
ok_sequence(WmHotkeyReleaseLWIN, "window hotkey release LWIN", FALSE);
/* Send and process all messages at once */
PostMessage(test_window, WM_APP, 0, 0);
keybd_event(VK_LWIN, 0, 0, 0);
keybd_event(hotkey_letter, 0, 0, 0);
keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_HOTKEY)
{
ok(msg.hwnd == test_window, "unexpected hwnd %p\n", msg.hwnd);
ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
}
DispatchMessage(&msg);
}
ok_sequence(WmHotkeyCombined, "window hotkey combined", FALSE);
/* Register same hwnd/id with different key combination */
ret = RegisterHotKey(test_window, 5, 0, hotkey_letter);
ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError());