Vincent Povirk : user32/tests: Test that hotkeys are really replaced when using the same id/hwnd.
Alexandre Julliard
julliard at winehq.org
Tue Jun 21 12:25:40 CDT 2011
Module: wine
Branch: master
Commit: ba9231993dc452122bb66f2e0427de681ea405f7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ba9231993dc452122bb66f2e0427de681ea405f7
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Fri Jun 17 11:18:47 2011 -0500
user32/tests: Test that hotkeys are really replaced when using the same id/hwnd.
---
dlls/user32/tests/msg.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 3d9452d..1beed35 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -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());
More information about the wine-cvs
mailing list