[PATCH v2 1/2] user32/tests: Test creating a fullscreen window spanning multiple monitors.

Zhiyi Zhang zzhang at codeweavers.com
Tue Mar 1 00:58:41 CST 2022


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
v2: Supersede 227889 and 227890. Fix a test failure for 2/2.

 dlls/user32/tests/win.c | 44 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index d6087873f21..63c18cd9948 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -9126,12 +9126,12 @@ static void test_fullscreen(void)
     static const DWORD t_ex_style[] = {
         0, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW
     };
+    RECT rc, virtual_rect, expected_rect;
     WNDCLASSA cls;
     int timeout;
     HWND hwnd;
     int i, j;
     POINT pt;
-    RECT rc;
     HMONITOR hmon;
     LRESULT ret;
 
@@ -9278,6 +9278,48 @@ static void test_fullscreen(void)
     DestroyWindow(hwnd);
 
     UnregisterClassA("fullscreen_class", GetModuleHandleA(NULL));
+
+    /* Test fullscreen windows spanning multiple monitors */
+    if (GetSystemMetrics(SM_CMONITORS) > 1)
+    {
+        /* Test windows covering all monitors */
+        virtual_rect.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
+        virtual_rect.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
+        virtual_rect.right = virtual_rect.left + GetSystemMetrics(SM_CXVIRTUALSCREEN);
+        virtual_rect.bottom = virtual_rect.top + GetSystemMetrics(SM_CYVIRTUALSCREEN);
+
+        hwnd = CreateWindowA("static", NULL, WS_POPUP | WS_VISIBLE, virtual_rect.left,
+                             virtual_rect.top, virtual_rect.right - virtual_rect.left,
+                             virtual_rect.bottom - virtual_rect.top, NULL, NULL, NULL, NULL);
+        ok(!!hwnd, "CreateWindow failed, error %#x.\n", GetLastError());
+        flush_events(TRUE);
+
+        GetWindowRect(hwnd, &rc);
+        todo_wine
+        ok(EqualRect(&rc, &virtual_rect), "Expected %s, got %s.\n",
+           wine_dbgstr_rect(&virtual_rect), wine_dbgstr_rect(&rc));
+        DestroyWindow(hwnd);
+
+        /* Test windows covering one monitor and 1 pixel larger on available sides */
+        expected_rect = mi.rcMonitor;
+        InflateRect(&expected_rect, 1, 1);
+        IntersectRect(&expected_rect, &expected_rect, &virtual_rect);
+        hwnd = CreateWindowA("static", NULL, WS_POPUP | WS_VISIBLE, expected_rect.left,
+                             expected_rect.top, expected_rect.right - expected_rect.left,
+                             expected_rect.bottom - expected_rect.top, NULL, NULL, NULL, NULL);
+        ok(!!hwnd, "CreateWindow failed, error %#x.\n", GetLastError());
+        flush_events(TRUE);
+
+        GetWindowRect(hwnd, &rc);
+        todo_wine
+        ok(EqualRect(&rc, &expected_rect), "Expected %s, got %s.\n",
+           wine_dbgstr_rect(&expected_rect), wine_dbgstr_rect(&rc));
+        DestroyWindow(hwnd);
+    }
+    else
+    {
+        skip("This test requires at least two monitors.\n");
+    }
 }
 
 static BOOL test_thick_child_got_minmax;
-- 
2.32.0




More information about the wine-devel mailing list