user32/tests: Test that hotkeys are really replaced when using the same id/hwnd.

oldstable
Vincent Povirk 2011-06-17 11:18:47 -05:00 committed by Alexandre Julliard
parent 4f58e11601
commit ba9231993d
1 changed files with 48 additions and 0 deletions

View File

@ -13094,6 +13094,29 @@ static const struct message WmHotkeyCombined[] = {
{ WM_KEYUP, sent|wparam|lparam, VK_LWIN, 0xc0000001 },
{ 0 }
};
static const struct message WmHotkeyPrevious[] = {
{ 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 },
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_LWIN, 1 },
{ WM_KEYDOWN, sent|wparam|lparam, VK_LWIN, 1 },
{ HCBT_KEYSKIPPED, hook|lparam|optional, 0, 1 },
{ WM_KEYDOWN, sent|lparam, 0, 1 },
{ HCBT_KEYSKIPPED, hook|optional|lparam, 0, 0xc0000001 },
{ WM_KEYUP, sent|lparam, 0, 0xc0000001 },
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_LWIN, 0xc0000001 },
{ WM_KEYUP, sent|wparam|lparam, VK_LWIN, 0xc0000001 },
{ 0 }
};
static const struct message WmHotkeyNew[] = {
{ WM_KEYDOWN, kbd_hook|lparam, 0, LLKHF_INJECTED },
{ WM_KEYUP, kbd_hook|lparam, 0, LLKHF_INJECTED|LLKHF_UP },
{ WM_HOTKEY, sent|wparam, 5 },
{ HCBT_KEYSKIPPED, hook|optional, 0, 0x80000001 },
{ WM_KEYUP, sent, 0, 0x80000001 }, /* lparam not checked so the sequence isn't a todo */
{ 0 }
};
static int hotkey_letter;
@ -13261,6 +13284,31 @@ static void test_hotkey(void)
ret = RegisterHotKey(test_window, 5, 0, hotkey_letter);
ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError());
/* Previous key combination does not work */
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))
DispatchMessage(&msg);
ok_sequence(WmHotkeyPrevious, "window hotkey previous", FALSE);
/* New key combination works */
keybd_event(hotkey_letter, 0, 0, 0);
keybd_event(hotkey_letter, 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(0, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
}
DispatchMessage(&msg);
}
ok_sequence(WmHotkeyNew, "window hotkey new", FALSE);
/* Unregister hotkey properly */
ret = UnregisterHotKey(test_window, 5);
ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError());