Stefan Dösinger : d3d9/tests: Skip test_cursor_pos if we can't move the cursor.

Alexandre Julliard julliard at winehq.org
Mon Jan 31 15:55:18 CST 2022


Module: wine
Branch: master
Commit: dfd645734bf44b3095d0aea7f1bd3373e73cc629
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=dfd645734bf44b3095d0aea7f1bd3373e73cc629

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Jan 31 13:19:44 2022 +0300

d3d9/tests: Skip test_cursor_pos if we can't move the cursor.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d9/tests/device.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index d4ff9d0e4ed..2c909176c8e 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -5180,6 +5180,7 @@ static void test_cursor_pos(void)
     HWND window;
     HRESULT hr;
     BOOL ret;
+    POINT pt;
 
     /* Note that we don't check for movement we're not supposed to receive.
      * That's because it's hard to distinguish from the user accidentally
@@ -5211,6 +5212,18 @@ static void test_cursor_pos(void)
     ok(ret, "Failed to set cursor position.\n");
     flush_events();
 
+    /* Check if we can move the cursor. If we're running in a virtual desktop
+     * that does not have focus or the mouse is outside the desktop window, some
+     * window managers (e.g. kwin) will refuse to let us steal the pointer. That
+     * is reasonable, but breaks the test. */
+    ret = GetCursorPos(&pt);
+    ok(ret, "Failed to get cursor position.\n");
+    if (pt.x != 99 || pt.y != 99)
+    {
+        skip("Could not warp the cursor (cur pos %ux%u), skipping test.\n", pt.x, pt.y);
+        return;
+    }
+
     wc.lpfnWndProc = test_cursor_proc;
     wc.lpszClassName = "d3d9_test_cursor_wc";
     ok(RegisterClassA(&wc), "Failed to register window class.\n");




More information about the wine-cvs mailing list