[PATCH v3 1/2] user32/tests: Test that ShowWindow(SW_SHOWMINIMIZED) shouldn't make a window visible.
Zhiyi Zhang
zzhang at codeweavers.com
Mon Mar 14 01:57:12 CDT 2022
This bug can be triggered on Mutter because it unminimizes windows when handling map requests.
Also see https://gitlab.gnome.org/GNOME/mutter/-/blob/main/src/x11/events.c#L1525 for how map
requests are handled.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
v3: Supersede 227676~227677. Fix test failures.
dlls/user32/tests/win.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index cfcec5cc78f..f47fcd2fe65 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -7420,7 +7420,9 @@ static void test_ShowWindow(void)
RECT rcMain, rc, rcMinimized, rcClient, rcEmpty, rcMaximized, rcResized, rcNonClient, rcBroken;
LPARAM ret;
MONITORINFO mon_info;
- unsigned int i;
+ unsigned int i, timeout = 0;
+ COLORREF color;
+ HDC hdc;
DWORD test_style[] =
{
@@ -7693,6 +7695,30 @@ static void test_ShowWindow(void)
flush_events(TRUE);
+ /* Test SW_SHOWMINIMIZED shouldn't restore windows from minimized state */
+ SetWindowPos(hwndMain, 0, 100, 100, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ hwnd = CreateWindowA("static", "test", WS_POPUP, 100, 100, 200, 200, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindowA failed, error %d.\n", GetLastError());
+ ShowWindow(hwnd, SW_SHOWMINIMIZED);
+ flush_events(TRUE);
+
+ hdc = GetDC(0);
+ color = GetPixel(hdc, 150, 150);
+ /* Desktop pixels may take a while to update */
+ while (color != 0xffffff && timeout < 1000)
+ {
+ Sleep(100);
+ timeout += 100;
+ color = GetPixel(hdc, 150, 150);
+ }
+ /* The window rectangle of hwndMain is (100, 100, 300, 300). If the window manager unminimizes
+ * hwnd, hwnd will end up obscuring hwndMain. Mutter is such a window manager that unminimizes
+ * windows when handling map requests and thus can demonstrate this bug */
+ todo_wine_if(color != 0xffffff)
+ ok(color == 0xffffff, "Expected color %#x, got %#x.\n", 0xffffff, color);
+ ReleaseDC(0, hdc);
+ DestroyWindow(hwnd);
+
/* test maximize and restore windows without setting WS_CAPTION */
for (i = 0; i < ARRAY_SIZE(test_style); ++i)
--
2.32.0
More information about the wine-devel
mailing list