[PATCH] user32/tests: check that SetCursorPos doesn't call hooks.
Lauri Kenttä
lauri.kentta at gmail.com
Thu Jan 21 03:05:14 CST 2010
SetCursorPos should not call mouse low-level hooks.
---
dlls/user32/tests/input.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 7713ff6..a5dba06 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1198,6 +1198,7 @@ static void test_keynames(void)
static POINT pt_old, pt_new;
static BOOL clipped;
+static int hook_proc2_call_times;
#define STEP 3
static LRESULT CALLBACK hook_proc1( int code, WPARAM wparam, LPARAM lparam )
@@ -1231,6 +1232,8 @@ static LRESULT CALLBACK hook_proc2( int code, WPARAM wparam, LPARAM lparam )
MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
POINT pt;
+ ++hook_proc2_call_times;
+
if (code == HC_ACTION)
{
ok(hook->pt.x == pt_new.x && hook->pt.y == pt_new.y,
@@ -1281,6 +1284,7 @@ static void test_mouse_ll_hook(void)
HHOOK hook1, hook2;
POINT pt_org, pt;
RECT rc;
+ int hook_proc2_call_times_old;
GetCursorPos(&pt_org);
hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
@@ -1347,6 +1351,18 @@ static void test_mouse_ll_hook(void)
GetCursorPos(&pt);
ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
+ /* Check that SetCursorPos doesn't call hooks.
+ * Check twice: first moving to old coordinates, then to new. */
+ SetCursorPos(10, 10);
+
+ hook_proc2_call_times_old = hook_proc2_call_times;
+ SetCursorPos(10, 10);
+ ok(hook_proc2_call_times_old == hook_proc2_call_times, "Hooks called\n");
+
+ hook_proc2_call_times_old = hook_proc2_call_times;
+ SetCursorPos(20, 20);
+ ok(hook_proc2_call_times_old == hook_proc2_call_times, "Hooks called\n");
+
UnhookWindowsHookEx(hook2);
done:
DestroyWindow(hwnd);
--
1.6.6
More information about the wine-patches
mailing list