[PATCH v2 2/8] user32/tests: Add rawinput test for cross-thread interactions.

Rémi Bernon rbernon at codeweavers.com
Thu Nov 14 15:28:58 CST 2019


The rawinput messages are received on the target window if is from the
same process as the foreground window, it doesn't need to be the
foreground window itself.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/user32/tests/input.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 8b26f8ed4be..ca66ecb51c9 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1881,6 +1881,7 @@ static DWORD WINAPI rawinput_mouse_thread(void *arg)
     struct rawinput_mouse_thread_params *params = arg;
     RECT rect_105 = { 105, 105, 105, 105 };
     RECT rect_110 = { 110, 110, 110, 110 };
+    HWND window;
     int i;
 
     while (WaitForSingleObject(params->ready, INFINITE) == 0)
@@ -1921,6 +1922,26 @@ static DWORD WINAPI rawinput_mouse_thread(void *arg)
                     Sleep(5);
                 }
                 break;
+            case 5:
+            case 6:
+                window = CreateWindowA("static", "static", WS_VISIBLE | WS_POPUP, 100, 100, 100, 100, 0, NULL, NULL, NULL);
+                ok(window != 0, "%d: CreateWindow failed\n", params->step);
+
+                ShowWindow(window, SW_SHOW);
+                SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
+                SetForegroundWindow(window);
+                UpdateWindow(window);
+                empty_message_queue();
+
+                mouse_event(MOUSEEVENTF_MOVE, 1, 1, 0, 0);
+                SendMessageA(GetForegroundWindow(), WM_USER, 0, 0);
+                mouse_event(MOUSEEVENTF_MOVE, -1, -1, 0, 0);
+                SendMessageA(GetForegroundWindow(), WM_USER, 0, 0);
+
+                empty_message_queue();
+
+                DestroyWindow(window);
+                break;
             default:
                 return 0;
         }
@@ -1956,8 +1977,14 @@ static void test_rawinput_mouse(void)
         { FALSE, FALSE, 0, 0, 0, 0, 0, FALSE },
         { TRUE, FALSE, 0, 2, 2, -1, -1, FALSE },
         { TRUE, TRUE, 0, 2, 2, -1, -1, FALSE },
+
+        /* clip cursor tests */
         { TRUE, TRUE, 0, 0, 0, 0, 0, TRUE },
         { TRUE, TRUE, 0, 20, 20, 20, 20, TRUE },
+
+        /* same-process foreground tests */
+        { TRUE, TRUE, 0, 2, 2, 0, 0, TRUE },
+        { TRUE, TRUE, RIDEV_INPUTSINK, 2, 2, 0, 0, TRUE },
     };
 
     mouse_event(MOUSEEVENTF_ABSOLUTE, 100, 100, 0, 0);
-- 
2.24.0.rc2




More information about the wine-devel mailing list