user32/tests: Add a basic test for maximizing windows.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2017-12-21 01:21:02 -06:00 committed by Alexandre Julliard
parent b7cdfd312c
commit d95be60ff6
1 changed files with 37 additions and 1 deletions

View File

@ -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);