From d95be60ff65b96b82576b5bc0ead5fb6c6729cd7 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 21 Dec 2017 01:21:02 -0600 Subject: [PATCH] user32/tests: Add a basic test for maximizing windows. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/user32/tests/win.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 6268042369b..f9472ecfa55 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -6528,8 +6528,9 @@ static void test_ShowWindow(void) { HWND hwnd; DWORD style; - RECT rcMain, rc, rcMinimized, rcClient, rcEmpty; + RECT rcMain, rc, rcMinimized, rcClient, rcEmpty, rcMaximized, rcResized; LPARAM ret; + MONITORINFO mon_info; SetRect(&rcClient, 0, 0, 90, 90); rcMain = rcClient; @@ -6547,6 +6548,12 @@ static void test_ShowWindow(void) 0, 0, 0, NULL); assert(hwnd); + mon_info.cbSize = sizeof(mon_info); + GetMonitorInfoW(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), &mon_info); + rcMaximized = mon_info.rcWork; + AdjustWindowRectEx(&rcMaximized, GetWindowLongA(hwnd, GWL_STYLE) & ~WS_BORDER, + 0, GetWindowLongA(hwnd, GWL_EXSTYLE)); + style = GetWindowLongA(hwnd, GWL_STYLE); ok(!(style & WS_DISABLED), "window should not be disabled\n"); ok(!(style & WS_VISIBLE), "window should not be visible\n"); @@ -6617,6 +6624,35 @@ static void test_ShowWindow(void) ok(EqualRect(&rcClient, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcClient), wine_dbgstr_rect(&rc)); + ShowWindow(hwnd, SW_MAXIMIZE); + ok(ret, "not expected ret: %lu\n", ret); + style = GetWindowLongA(hwnd, GWL_STYLE); + ok(!(style & WS_DISABLED), "window should not be disabled\n"); + ok(style & WS_VISIBLE, "window should be visible\n"); + ok(!(style & WS_MINIMIZE), "window should be minimized\n"); + ok(style & WS_MAXIMIZE, "window should not be maximized\n"); + GetWindowRect(hwnd, &rc); + ok(EqualRect(&rcMaximized, &rc), "expected %s, got %s\n", + wine_dbgstr_rect(&rcMaximized), wine_dbgstr_rect(&rc)); + /* maximized windows can be resized */ + ret = SetWindowPos(hwnd, 0, 300, 300, 200, 200, SWP_NOACTIVATE | SWP_NOZORDER); + ok(ret, "not expected ret: %lu\n", ret); + SetRect(&rcResized, 300, 300, 500, 500); + GetWindowRect(hwnd, &rc); + ok(EqualRect(&rcResized, &rc), "expected %s, got %s\n", + wine_dbgstr_rect(&rcResized), wine_dbgstr_rect(&rc)); + + ShowWindow(hwnd, SW_RESTORE); + ok(ret, "not expected ret: %lu\n", ret); + style = GetWindowLongA(hwnd, GWL_STYLE); + ok(!(style & WS_DISABLED), "window should not be disabled\n"); + ok(style & WS_VISIBLE, "window should be visible\n"); + ok(!(style & WS_MINIMIZE), "window should not be minimized\n"); + ok(!(style & WS_MAXIMIZE), "window should not be maximized\n"); + GetWindowRect(hwnd, &rc); + ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain), + wine_dbgstr_rect(&rc)); + ret = EnableWindow(hwnd, FALSE); ok(!ret, "not expected ret: %lu\n", ret); style = GetWindowLongA(hwnd, GWL_STYLE);