Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/user32/tests/win.c | 164 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 154 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 5ce7eb02f1c..4aeb3816db2 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -764,6 +764,7 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR } case WM_WINDOWPOSCHANGED: { + LRESULT ret; RECT rc1, rc2; WINDOWPOS *winpos = (WINDOWPOS *)lparam; ok(winpos->x >= -32768 && winpos->x <= 32767, "bad winpos->x %d\n", winpos->x); @@ -784,7 +785,8 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR wine_dbgstr_rect(&rc2));
GetClientRect(hwnd, &rc2); - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1); + ok(!ret, "got %08lx\n", ret); MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2); ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); @@ -837,6 +839,13 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR break; case WM_MOUSEACTIVATE: return MA_ACTIVATE; + + case WM_NCCALCSIZE: + { + LRESULT ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, wparam, lparam); + ok(!ret, "got %08lx (%08lx %08lx)\n", ret, wparam, lparam); + return ret; + } }
return DefWindowProcA(hwnd, msg, wparam, lparam); @@ -867,6 +876,13 @@ static LRESULT WINAPI main_window_procW(HWND hwnd, UINT msg, WPARAM wparam, LPAR return 0; } break; + + case WM_NCCALCSIZE: + { + LRESULT ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, wparam, lparam); + ok(!ret, "got %08lx (%08lx %08lx)\n", ret, wparam, lparam); + return ret; + } }
return DefWindowProcA(hwnd, msg, wparam, lparam); @@ -892,6 +908,13 @@ static LRESULT WINAPI tool_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR ok(!got_getminmaxinfo, "tool: WM_GETMINMAXINFO should NOT have been received before WM_NCCREATE\n"); break; } + + case WM_NCCALCSIZE: + { + LRESULT ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, wparam, lparam); + ok(!ret, "got %08lx (%08lx %08lx)\n", ret, wparam, lparam); + return ret; + } }
return DefWindowProcA(hwnd, msg, wparam, lparam); @@ -1156,6 +1179,14 @@ static LRESULT CALLBACK test_standard_scrollbar_proc(HWND hwnd, UINT msg, WPARAM DeleteObject(region); return 0; } + + case WM_NCCALCSIZE: + { + LRESULT ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, wp, lp); + ok(!ret, "got %08lx (%08lx %08lx)\n", ret, wp, lp); + return ret; + } + default: return DefWindowProcA(hwnd, msg, wp, lp); } @@ -1204,7 +1235,9 @@ static void test_nonclient_area(HWND hwnd)
rc = rc_window; - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); +todo_wine_if(ret != 0) + ok(!ret, "got %08lx\n", ret); MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2); ok(EqualRect(&rc, &rc_client), "client rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d client=%s, calc=%s\n", @@ -1221,7 +1254,9 @@ static void test_nonclient_area(HWND hwnd) FixedAdjustWindowRectEx(&rc_window, style, menu, exstyle);
rc = rc_window; - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); +todo_wine_if(ret != 0) + ok(!ret, "got %08lx\n", ret); MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2); ok(EqualRect(&rc, &rc_client), "synthetic rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, client=%s, calc=%s\n", @@ -2114,6 +2149,7 @@ static LRESULT WINAPI mdi_child_wnd_proc_2(HWND hwnd, UINT msg, WPARAM wparam, L
case WM_WINDOWPOSCHANGED: { + LRESULT ret; WINDOWPOS *winpos = (WINDOWPOS *)lparam; RECT rc1, rc2;
@@ -2125,7 +2161,8 @@ static LRESULT WINAPI mdi_child_wnd_proc_2(HWND hwnd, UINT msg, WPARAM wparam, L wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); GetWindowRect(hwnd, &rc1); GetClientRect(hwnd, &rc2); - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1); + ok(!ret, "got %08lx\n", ret); MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2); ok(EqualRect(&rc1, &rc2), "rects do not match, window=%s client=%s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); @@ -2151,7 +2188,15 @@ static LRESULT WINAPI mdi_child_wnd_proc_2(HWND hwnd, UINT msg, WPARAM wparam, L
return 1; } + + case WM_NCCALCSIZE: + { + LRESULT ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, wparam, lparam); + ok(!ret, "got %08lx (%08lx %08lx)\n", ret, wparam, lparam); + return ret; + } } + return DefWindowProcA(hwnd, msg, wparam, lparam); }
@@ -2207,6 +2252,13 @@ static LRESULT WINAPI mdi_main_wnd_procA(HWND hwnd, UINT msg, WPARAM wparam, LPA return 1; }
+ case WM_NCCALCSIZE: + { + LRESULT ret = DefFrameProcA(hwnd, mdi_client, WM_NCCALCSIZE, wparam, lparam); + ok(!ret, "got %08lx (%08lx %08lx)\n", ret, wparam, lparam); + return ret; + } + case WM_CLOSE: PostQuitMessage(0); break; @@ -4418,11 +4470,13 @@ static void test_validatergn(HWND hwnd)
static void nccalchelper(HWND hwnd, INT x, INT y, RECT *prc) { + LRESULT ret; RECT rc; MoveWindow( hwnd, 0, 0, x, y, 0); GetWindowRect( hwnd, prc); rc = *prc; - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)prc); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)prc); + ok(!ret, "got %08lx\n", ret); if (winetest_debug > 1) trace("window rect is %s, nccalc rect is %s\n", wine_dbgstr_rect(&rc), wine_dbgstr_rect(prc)); } @@ -6314,11 +6368,14 @@ static LRESULT CALLBACK winsizes_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM } case WM_NCCALCSIZE: { + LRESULT ret; RECT rect, *r = (RECT *)lp; GetWindowRect( hwnd, &rect ); ok( EqualRect( &rect, r ), "passed rect %s doesn't match window rect %s\n", wine_dbgstr_rect( r ), wine_dbgstr_rect( &rect )); - return DefWindowProcA(hwnd, msg, wp, lp); + ret = DefWindowProcA(hwnd, msg, wp, lp); + ok(!ret, "got %08lx\n", ret); + return ret; } default: return DefWindowProcA(hwnd, msg, wp, lp); @@ -7228,7 +7285,8 @@ static void test_ShowWindow(void) /* test NC area */ GetWindowRect(hwnd, &rc); SetRect(&rcNonClient, rc.left, rc.top, rc.left, rc.top); - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); + ok(!ret, "got %08lx\n", ret); ok(EqualRect(&rc, &rcNonClient), "expected %s, got %s\n", wine_dbgstr_rect(&rcNonClient), wine_dbgstr_rect(&rc));
@@ -7516,7 +7574,8 @@ static void test_ShowWindow_owned(HWND hwndMain) /* test NC area */ GetWindowRect(hwnd, &rect); SetRect(&nc, rect.left, rect.top, rect.left, rect.top); - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rect); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rect); + ok(!ret, "got %08lx\n", ret); ok(EqualRect(&rect, &nc), "expected %s, got %s\n", wine_dbgstr_rect(&nc), wine_dbgstr_rect(&rect));
@@ -7648,7 +7707,8 @@ static void test_ShowWindow_child(HWND hwndMain) /* test NC area */ GetWindowRect(hwnd, &rect); SetRect(&nc, rect.left, rect.top, rect.left, rect.top); - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rect); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rect); + ok(!ret, "got %08lx\n", ret); ok(EqualRect(&rect, &nc), "expected %s, got %s\n", wine_dbgstr_rect(&nc), wine_dbgstr_rect(&rect));
@@ -7776,7 +7836,8 @@ static void test_ShowWindow_mdichild(HWND hwndMain) /* test NC area */ GetWindowRect(hwnd, &rect); SetRect(&nc, rect.left, rect.top, rect.left, rect.top); - DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rect); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rect); + ok(!ret, "got %08lx\n", ret); ok(EqualRect(&rect, &nc), "expected %s, got %s\n", wine_dbgstr_rect(&nc), wine_dbgstr_rect(&rect));
@@ -8810,6 +8871,12 @@ static LRESULT CALLBACK fullscreen_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPAR ok(minmax->ptMaxSize.y >= mi.rcMonitor.bottom, "%d >= %d\n", minmax->ptMaxSize.y, mi.rcMonitor.bottom); break; } + case WM_NCCALCSIZE: + { + LRESULT ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, wp, lp); + ok(!ret, "got %08lx (%08lx %08lx)\n", ret, wp, lp); + return ret; + } } return DefWindowProcA(hwnd, msg, wp, lp); } @@ -9069,6 +9136,13 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
break; } + + case WM_NCCALCSIZE: + { + LRESULT ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, wparam, lparam); + ok(!ret, "got %08lx (%08lx %08lx)\n", ret, wparam, lparam); + return ret; + } }
return DefWindowProcA(hwnd, msg, wparam, lparam); @@ -12555,6 +12629,75 @@ static void test_DragDetect(void) ok(!(GetKeyState( VK_LBUTTON ) & 0x8000), "got VK_LBUTTON\n"); }
+static void test_WM_NCCALCSIZE(void) +{ + WNDCLASSA cls; + HWND hwnd; + NCCALCSIZE_PARAMS params; + WINDOWPOS winpos; + RECT client_rect, window_rect; + LRESULT ret; + + cls.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; + cls.lpfnWndProc = DefWindowProcA; + cls.cbClsExtra = 0; + cls.cbWndExtra = 0; + cls.hInstance = GetModuleHandleA(0); + cls.hIcon = 0; + cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW); + cls.hbrBackground = GetStockObject(WHITE_BRUSH); + cls.lpszMenuName = NULL; + cls.lpszClassName = "dummy_window_class"; + ret = RegisterClassA(&cls); + ok(ret, "RegisterClass error %u\n", GetLastError()); + + hwnd = CreateWindowExA(0, "dummy_window_class", NULL, + WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP, + 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); + ok(hwnd != 0, "CreateWindowEx error %u\n", GetLastError()); + + GetWindowRect(hwnd, &window_rect); + params.rgrc[0] = window_rect; + params.rgrc[1] = window_rect; + GetClientRect(hwnd, &client_rect); + MapWindowPoints(hwnd, 0, (POINT *)&client_rect, 2); + params.rgrc[2] = client_rect; + + winpos.hwnd = hwnd; + winpos.hwndInsertAfter = HWND_TOP; + winpos.x = window_rect.left; + winpos.y = window_rect.top; + winpos.cx = window_rect.right - window_rect.left; + winpos.cy = window_rect.bottom - window_rect.top; + winpos.flags = SWP_NOMOVE; + params.lppos = &winpos; + + ret = SendMessageW(hwnd, WM_NCCALCSIZE, TRUE, (LPARAM)¶ms); +todo_wine + ok(!ret, "got %08lx\n", ret); + ok(EqualRect(¶ms.rgrc[0], &client_rect), "got %s\n", wine_dbgstr_rect(¶ms.rgrc[0])); + + params.rgrc[0] = window_rect; + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, TRUE, (LPARAM)¶ms); +todo_wine + ok(!ret, "got %08lx\n", ret); + ok(EqualRect(¶ms.rgrc[0], &client_rect), "got %s\n", wine_dbgstr_rect(¶ms.rgrc[0])); + + GetWindowRect(hwnd, &window_rect); + ret = SendMessageW(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&window_rect); +todo_wine + ok(!ret, "got %08lx\n", ret); + ok(EqualRect(&window_rect, &client_rect), "got %s\n", wine_dbgstr_rect(&window_rect)); + + GetWindowRect(hwnd, &window_rect); + ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&window_rect); +todo_wine + ok(!ret, "got %08lx\n", ret); + ok(EqualRect(&window_rect, &client_rect), "got %s\n", wine_dbgstr_rect(&window_rect)); + + DestroyWindow(hwnd); +} + START_TEST(win) { char **argv; @@ -12731,6 +12874,7 @@ START_TEST(win) test_SC_SIZE(); test_cancel_mode(); test_DragDetect(); + test_WM_NCCALCSIZE();
/* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=106955
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w7u_adm (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w7u_el (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w8 (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w8adm (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w864 (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064v1507 (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064v1809 (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064 (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064_tsign (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w10pro64 (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w864 (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064v1507 (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064v1809 (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064 (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064_2qxl (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w1064_tsign (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w10pro64 (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w10pro64_ar (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w10pro64_he (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w10pro64_ja (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== w10pro64_zh_CN (64 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0 win.c:10565: Test failed: pos = 00fa00fa win.c:10569: Test failed: pos = 00fa00fa win.c:10573: Test failed: pos = 00fa00fa
=== debian11 (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (32 bit Arabic:Morocco report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (32 bit German report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (32 bit French report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (32 bit Hebrew:Israel report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (32 bit Hindi:India report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (32 bit Japanese:Japan report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (32 bit Chinese:China report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (32 bit WoW report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
=== debian11 (64 bit WoW report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
Marvin testbot@winehq.org wrote:
=== w7u_2qxl (32 bit report) ===
user32: win.c:7294: Test failed: not expected ret: 0 win.c:7308: Test failed: not expected ret: 0
All these failures are pre-existing, and supposed to be fixed by the patch user32/tests: Actually test ShowWindow() return value.