v4: Rebased to current git.
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 3ace25056de..2d9487bb953 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -1003,6 +1003,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); @@ -1023,7 +1024,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)); @@ -1076,6 +1078,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); @@ -1106,6 +1115,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); @@ -1131,6 +1147,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); @@ -1395,6 +1418,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); } @@ -1443,7 +1474,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", @@ -1460,7 +1493,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", @@ -2353,6 +2388,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;
@@ -2364,7 +2400,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)); @@ -2390,7 +2427,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); }
@@ -2446,6 +2491,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; @@ -4657,11 +4709,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)); } @@ -6553,11 +6607,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); @@ -7467,7 +7524,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));
@@ -7755,7 +7813,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));
@@ -7887,7 +7946,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));
@@ -8015,7 +8075,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));
@@ -9049,6 +9110,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); } @@ -9308,6 +9375,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); @@ -12848,6 +12922,75 @@ static void test_ncdestroy(void) DestroyWindow(hwnd); }
+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; @@ -13029,6 +13172,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=107562
Your paranoid android.
=== debian11 (32 bit report) ===
user32: win.c:10977: Test failed: GetActiveWindow() = 00000000 win.c:10977: Test failed: GetFocus() = 00000000 win.c:10979: Test failed: Expected foreground window 00020052, got 00F600C2 win.c:10982: Test failed: Received WM_ACTIVATEAPP(0), did not expect it. win.c:10989: Test failed: Expected foreground window 00020052, got 00000000 win.c:10991: Test failed: GetActiveWindow() = 00000000 win.c:10991: Test failed: GetFocus() = 00000000 win.c:10999: Test failed: Received WM_ACTIVATEAPP(1), did not expect it.
Hi Dmitry,
This creates new warnings.
../dlls/user32/tests/win.c: In function ‘test_ShowWindow_owned’: ../dlls/user32/tests/win.c:7817:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 7817 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x ../dlls/user32/tests/win.c: In function ‘test_ShowWindow_child’: ../dlls/user32/tests/win.c:7950:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 7950 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x ../dlls/user32/tests/win.c: In function ‘test_ShowWindow_mdichild’: ../dlls/user32/tests/win.c:8079:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 8079 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x
Thanks, Zhiyi
On 2/10/22 15:49, Dmitry Timoshkov wrote:
v4: Rebased to current git.
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 3ace25056de..2d9487bb953 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -1003,6 +1003,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);
@@ -1023,7 +1024,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));
@@ -1076,6 +1078,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);
@@ -1106,6 +1115,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);
@@ -1131,6 +1147,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);
@@ -1395,6 +1418,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); }
@@ -1443,7 +1474,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",
@@ -1460,7 +1493,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",
@@ -2353,6 +2388,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;
@@ -2364,7 +2400,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));
@@ -2390,7 +2427,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);
}
@@ -2446,6 +2491,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;
@@ -4657,11 +4709,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));
} @@ -6553,11 +6607,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);
} default: return DefWindowProcA(hwnd, msg, wp, lp);return ret;
@@ -7467,7 +7524,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));
@@ -7755,7 +7813,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));
@@ -7887,7 +7946,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));
@@ -8015,7 +8075,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));
@@ -9049,6 +9110,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);}
} @@ -9308,6 +9375,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);
@@ -12848,6 +12922,75 @@ static void test_ncdestroy(void) DestroyWindow(hwnd); }
+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; @@ -13029,6 +13172,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);
Zhiyi Zhang zzhang@codeweavers.com wrote:
Hi Dmitry,
This creates new warnings.
../dlls/user32/tests/win.c: In function ‘test_ShowWindow_owned’: ../dlls/user32/tests/win.c:7817:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 7817 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x ../dlls/user32/tests/win.c: In function ‘test_ShowWindow_child’: ../dlls/user32/tests/win.c:7950:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 7950 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x ../dlls/user32/tests/win.c: In function ‘test_ShowWindow_mdichild’: ../dlls/user32/tests/win.c:8079:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 8079 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x
Thanks for spotting this. I guess that's a gcc/mingw build since I don't see these warnings when building with clang.
I'll send an updated patch.
Hi Zhiyi,
Dmitry Timoshkov dmitry@baikal.ru wrote:
This creates new warnings.
../dlls/user32/tests/win.c: In function ‘test_ShowWindow_owned’: ../dlls/user32/tests/win.c:7817:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 7817 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x ../dlls/user32/tests/win.c: In function ‘test_ShowWindow_child’: ../dlls/user32/tests/win.c:7950:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 7950 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x ../dlls/user32/tests/win.c: In function ‘test_ShowWindow_mdichild’: ../dlls/user32/tests/win.c:8079:23: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘BOOL’ {aka ‘int’} [-Wformat=] 8079 | ok(!ret, "got %08lx\n", ret); | ~~~~^ ~~~ | | | | | BOOL {aka int} | long unsigned int | %08x
Thanks for spotting this. I guess that's a gcc/mingw build since I don't see these warnings when building with clang.
I also checked with a gcc build and I don't get the warnings above since both clang and gcc are running with explicit -Wno-format option specified. Could you please provide more info about your setup? Are you enabling format warnings by hand?