[PATCH 0/5] MR169: user32/tests: Cleanup some msg.c tests.
From: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/user32/tests/msg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 2705914d5e5..235724a5ff9 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -14089,9 +14089,11 @@ static void test_ShowWindow(void) ok(wp.ptMaxPosition.x == sw[i].wp_max.x && wp.ptMaxPosition.y == sw[i].wp_max.y, "expected %ld,%ld got %ld,%ld\n", sw[i].wp_max.x, sw[i].wp_max.y, wp.ptMaxPosition.x, wp.ptMaxPosition.y); -if (0) /* FIXME: Wine behaves completely different here */ - ok(EqualRect(&win_rc, &wp.rcNormalPosition), "expected %s got %s\n", - wine_dbgstr_rect(&win_rc), wine_dbgstr_rect(&wp.rcNormalPosition)); + if (0) /* FIXME: Wine behaves completely different here */ + { + ok(EqualRect(&win_rc, &wp.rcNormalPosition), "expected %s got %s\n", + wine_dbgstr_rect(&win_rc), wine_dbgstr_rect(&wp.rcNormalPosition)); + } } DestroyWindow(hwnd); flush_events(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/169
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=115934 Your paranoid android. === w1064_adm (64 bit report) === user32: msg.c:12879: Test failed: message time not advanced: d30f d30f msg.c:12880: Test failed: coords not changed: (105 105) (105 105) === w10pro64 (64 bit report) === user32: msg.c:12861: Test failed: message time not advanced: c5a1 c5a1 msg.c:12862: Test failed: coords not changed: (101 101) (101 101) msg.c:12879: Test failed: message time not advanced: c5a1 c5a1 msg.c:12880: Test failed: coords not changed: (101 101) (101 101) === w10pro64_ar (64 bit report) === user32: msg.c:12861: Test failed: message time not advanced: 155cc 155cc msg.c:12862: Test failed: coords not changed: (101 101) (101 101) msg.c:12879: Test failed: message time not advanced: 155cc 155cc msg.c:12880: Test failed: coords not changed: (101 101) (101 101)
From: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/user32/tests/win.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 3727efb1b41..c6667cafeff 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -1453,10 +1453,6 @@ static void test_nonclient_area(HWND hwnd) GetWindowRect(hwnd, &rc_window); GetClientRect(hwnd, &rc_client); - /* avoid some cases when things go wrong */ - if (IsRectEmpty(&rc_window) || IsRectEmpty(&rc_client) || - rc_window.right > 32768 || rc_window.bottom > 32768) return; - rc = rc_client; MapWindowPoints(hwnd, 0, (LPPOINT)&rc, 2); FixedAdjustWindowRectEx(&rc, style, menu, exstyle); @@ -4314,7 +4310,7 @@ static void test_capture_4(void) WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 400, 200, NULL, NULL, hInstance, NULL); ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError()); - if (!hwnd) return; + hmenu = CreatePopupMenu(); ret = AppendMenuA( hmenu, MF_STRING, 1, "winetest2"); @@ -4379,11 +4375,8 @@ static void test_keyboard_input(HWND hwnd) ok(GetFocus() == hwnd, "wrong focus window %p\n", GetFocus()); keybd_event(VK_SPACE, 0, 0, 0); - if (!peek_message(&msg)) - { - skip( "keybd_event didn't work, skipping keyboard test\n" ); - return; - } + ret = peek_message(&msg); + ok( ret, "message %04x available\n", msg.message); ok(msg.hwnd == hwnd && msg.message == WM_KEYDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message); ret = peek_message(&msg); ok( !ret, "message %04x available\n", msg.message); @@ -11289,12 +11282,6 @@ static void test_LockWindowUpdate(HWND parent) {parent, parent, 1, 1} }; - if (!child) - { - skip("CreateWindow failed, skipping LockWindowUpdate tests\n"); - return; - } - ShowWindow(parent, SW_SHOW); UpdateWindow(parent); flush_events(TRUE); @@ -12181,11 +12168,6 @@ static void test_destroy_quit(void) "destroy test main", WS_OVERLAPPED | WS_CAPTION, 100, 100, 100, 100, 0, 0, GetModuleHandleA(NULL), NULL); ok(destroy_data.main_wnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError()); - if (!destroy_data.main_wnd) - { - CloseHandle(destroy_data.evt); - return; - } thread1 = CreateThread(NULL, 0, destroy_thread1, 0, 0, NULL); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/169
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=115935 Your paranoid android. === w864 (32 bit report) === user32: win.c:2684: Test failed: style 0x200000: expected !100 win.c:2684: Test failed: style 0x300000: expected !100 === w864 (64 bit report) === user32: win.c:2684: Test failed: style 0x200000: expected !100 win.c:2684: Test failed: style 0x300000: expected !100 === w10pro64_ar (64 bit report) === user32: win.c:4552: Test failed: hwnd 0000000000020330/0000000000020330 message 0200 win.c:4557: Test failed: hwnd 0000000000020330/0000000000020330 message 0203 win.c:4561: Test failed: message 0202 available === w10pro64_ja (64 bit report) === user32: win.c:4379: Test failed: message 0100 available win.c:4380: Test failed: hwnd 0000000000000000 message 0100 win.c:4409: Test failed: no message available win.c:4410: Test failed: hwnd 0000000000000000 message 0100 win.c:10800: Test failed: pos = 00fa00fa win.c:10804: Test failed: pos = 00fa00fa win.c:10808: Test failed: pos = 00fa00fa === w10pro64_zh_CN (64 bit report) === user32: win.c:4379: Test failed: message 0100 available win.c:4380: Test failed: hwnd 0000000000000000 message 0100 win.c:4409: Test failed: no message available win.c:4410: Test failed: hwnd 0000000000000000 message 0100 win.c:10800: Test failed: pos = 00fa00fa win.c:10804: Test failed: pos = 00fa00fa win.c:10808: Test failed: pos = 00fa00fa
From: Rémi Bernon <rbernon(a)codeweavers.com> It's not supposed to fail and skipping the tests simply creates false successful runs. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/user32/tests/win.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index c6667cafeff..e5b50b55482 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3491,12 +3491,7 @@ static void test_popup_zorder(HWND hwnd_D, HWND hwnd_E, DWORD style) HWND hwnd_A, hwnd_B, hwnd_C, hwnd_F; /* Give current thread foreground state otherwise the tests may fail. */ - if (!SetForegroundWindow(hwnd_D)) - { - skip("SetForegroundWindow not working\n"); - return; - } - + SetForegroundWindow(hwnd_D); SetWindowPos(hwnd_E, hwnd_D, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); check_z_order(hwnd_D, hwnd_E, 0, 0, FALSE); @@ -3954,12 +3949,7 @@ static void test_SetForegroundWindow(HWND hwnd) ShowWindow(hwnd, SW_SHOW); check_wnd_state(hwnd, hwnd, hwnd, 0); - ret = SetForegroundWindow(hwnd); - if (!ret) - { - skip( "SetForegroundWindow not working\n" ); - return; - } + SetForegroundWindow(hwnd); check_wnd_state(hwnd, hwnd, hwnd, 0); SetLastError(0xdeadbeef); @@ -11606,12 +11596,7 @@ static void test_topmost(void) ok(owner != 0, "Failed to create owner window (%ld)\n", GetLastError()); /* Give current thread foreground state otherwise the tests may fail. */ - if (!SetForegroundWindow(owner)) - { - DestroyWindow(owner); - skip("SetForegroundWindow not working\n"); - return; - } + SetForegroundWindow(owner); hwnd = create_tool_window(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE, owner); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/169
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=115936 Your paranoid android. === w10pro64 (32 bit report) === user32: win.c:4372: Test failed: message 0200 available === w864 (64 bit report) === user32: win.c:2684: Test failed: style 0x200000: expected !100 win.c:2684: Test failed: style 0x300000: expected !100 === w1064_tsign (64 bit report) === user32: win.c:10821: Test failed: pos = 01400154 === w10pro64_ar (64 bit report) === user32: win.c:189: Test failed: didn't get start_event win.c:10283: Test failed: WindowFromPoint returned 0000000000020320, expected 0000000000000000 win.c:10291: Test failed: WindowFromPoint returned 00000000000B02C8, expected 0000000000000000 win.c:10220: Test failed: transparent window didn't get WM_NCHITTEST message win.c:10221: Test failed: button under static window didn't get WM_LBUTTONUP === w10pro64_ja (64 bit report) === user32: win.c:4369: Test failed: message 0100 available win.c:4370: Test failed: hwnd 0000000000000000 message 0100 win.c:4399: Test failed: no message available win.c:4400: Test failed: hwnd 0000000000000000 message 0100 win.c:10790: Test failed: pos = 00fa00fa win.c:10794: Test failed: pos = 00fa00fa win.c:10798: Test failed: pos = 00fa00fa === w10pro64_zh_CN (64 bit report) === user32: win.c:4369: Test failed: message 0100 available win.c:4370: Test failed: hwnd 0000000000000000 message 0100 win.c:4399: Test failed: no message available win.c:4400: Test failed: hwnd 0000000000000000 message 0100 win.c:10790: Test failed: pos = 00fa00fa win.c:10794: Test failed: pos = 00fa00fa win.c:10798: Test failed: pos = 00fa00fa
On 6/1/22 09:12, Rémi Bernon wrote:
It's not supposed to fail and skipping the tests simply creates false successful runs.
If it's not supposed to fail, shouldn't we have an ok() call checking the return value?
From: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/user32/tests/win.c | 48 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index e5b50b55482..2f538874496 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -1161,10 +1161,11 @@ static LRESULT WINAPI tool_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR static const WCHAR mainclassW[] = {'M','a','i','n','W','i','n','d','o','w','C','l','a','s','s','W',0}; -static BOOL RegisterWindowClasses(void) +static void RegisterWindowClasses(void) { WNDCLASSW clsW; WNDCLASSA cls; + BOOL ret; cls.style = CS_DBLCLKS; cls.lpfnWndProc = main_window_procA; @@ -1177,7 +1178,8 @@ static BOOL RegisterWindowClasses(void) cls.lpszMenuName = NULL; cls.lpszClassName = "MainWindowClass"; - if(!RegisterClassA(&cls)) return FALSE; + ret = RegisterClassA(&cls); + ok(ret, "RegisterClassA failed, error %lu\n", GetLastError()); clsW.style = CS_DBLCLKS; clsW.lpfnWndProc = main_window_procW; @@ -1190,7 +1192,8 @@ static BOOL RegisterWindowClasses(void) clsW.lpszMenuName = NULL; clsW.lpszClassName = mainclassW; - if(!RegisterClassW(&clsW)) return FALSE; + ret = RegisterClassW(&clsW); + ok(ret, "RegisterClassW failed, error %lu\n", GetLastError()); cls.style = 0; cls.lpfnWndProc = tool_window_procA; @@ -1203,9 +1206,8 @@ static BOOL RegisterWindowClasses(void) cls.lpszMenuName = NULL; cls.lpszClassName = "ToolWindowClass"; - if(!RegisterClassA(&cls)) return FALSE; - - return TRUE; + ret = RegisterClassA(&cls); + ok(ret, "RegisterClassA failed, error %lu\n", GetLastError()); } static void verify_window_info(const char *hook, HWND hwnd, const WINDOWINFO *info) @@ -2499,9 +2501,10 @@ static LRESULT WINAPI mdi_main_wnd_procA(HWND hwnd, UINT msg, WPARAM wparam, LPA return DefFrameProcA(hwnd, mdi_client, msg, wparam, lparam); } -static BOOL mdi_RegisterWindowClasses(void) +static void mdi_RegisterWindowClasses(void) { WNDCLASSA cls; + BOOL ret; cls.style = 0; cls.lpfnWndProc = mdi_main_wnd_procA; @@ -2513,17 +2516,18 @@ static BOOL mdi_RegisterWindowClasses(void) cls.hbrBackground = GetStockObject(WHITE_BRUSH); cls.lpszMenuName = NULL; cls.lpszClassName = "MDI_parent_Class"; - if(!RegisterClassA(&cls)) return FALSE; + ret = RegisterClassA(&cls); + ok(ret, "RegisterClassA failed, error %lu\n", GetLastError()); cls.lpfnWndProc = mdi_child_wnd_proc_1; cls.lpszClassName = "MDI_child_Class_1"; - if(!RegisterClassA(&cls)) return FALSE; + ret = RegisterClassA(&cls); + ok(ret, "RegisterClassA failed, error %lu\n", GetLastError()); cls.lpfnWndProc = mdi_child_wnd_proc_2; cls.lpszClassName = "MDI_child_Class_2"; - if(!RegisterClassA(&cls)) return FALSE; - - return TRUE; + ret = RegisterClassA(&cls); + ok(ret, "RegisterClassA failed, error %lu\n", GetLastError()); } static void test_mdi(void) @@ -2536,7 +2540,7 @@ static void test_mdi(void) MSG msg; HMENU frame_menu, child_menu; - if (!mdi_RegisterWindowClasses()) assert(0); + mdi_RegisterWindowClasses(); mdi_hwndMain = CreateWindowExA(0, "MDI_parent_Class", "MDI parent window", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | @@ -5989,9 +5993,10 @@ static void test_AWRwindow(LPCSTR class, LONG style, LONG exStyle, BOOL menu) DestroyWindow(hwnd); } -static BOOL AWR_init(void) +static void AWR_init(void) { WNDCLASSA class; + BOOL ret; class.style = CS_HREDRAW | CS_VREDRAW; class.lpfnWndProc = DefWindowProcA; @@ -6004,18 +6009,12 @@ static BOOL AWR_init(void) class.lpszMenuName = 0; class.lpszClassName = szAWRClass; - if (!RegisterClassA(&class)) { - ok(FALSE, "RegisterClass failed\n"); - return FALSE; - } + ret = RegisterClassA(&class); + ok(ret, "RegisterClassA failed, error %lu\n", GetLastError()); hmenu = CreateMenu(); - if (!hmenu) - return FALSE; ok(hmenu != 0, "Failed to create menu\n"); ok(AppendMenuA(hmenu, MF_STRING, 1, "Test!"), "Failed to create menu item\n"); - - return TRUE; } @@ -6082,8 +6081,7 @@ static void test_AWR_flags(void) static void test_AdjustWindowRect(void) { - if (!AWR_init()) - return; + AWR_init(); SHOWSYSMETRIC(SM_CYCAPTION); SHOWSYSMETRIC(SM_CYSMCAPTION); @@ -13011,7 +13009,7 @@ START_TEST(win) return; } - if (!RegisterWindowClasses()) assert(0); + RegisterWindowClasses(); hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/169
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=115937 Your paranoid android. === w864 (32 bit report) === user32: win.c:2688: Test failed: style 0x200000: expected !100 win.c:2688: Test failed: style 0x300000: expected !100 === w864 (64 bit report) === user32: win.c:2688: Test failed: style 0x200000: expected !100 win.c:2688: Test failed: style 0x300000: expected !100 === w10pro64_ja (64 bit report) === user32: win.c:4373: Test failed: message 0100 available win.c:4374: Test failed: hwnd 0000000000000000 message 0100 win.c:4403: Test failed: no message available win.c:4404: Test failed: hwnd 0000000000000000 message 0100 win.c:10788: Test failed: pos = 00fa00fa win.c:10792: Test failed: pos = 00fa00fa win.c:10796: Test failed: pos = 00fa00fa === w10pro64_zh_CN (64 bit report) === user32: win.c:189: Test failed: didn't get start_event win.c:4373: Test failed: message 0100 available win.c:4374: Test failed: hwnd 0000000000000000 message 0100 win.c:4403: Test failed: no message available win.c:4404: Test failed: hwnd 0000000000000000 message 0100 win.c:10788: Test failed: pos = 00fa00fa win.c:10792: Test failed: pos = 00fa00fa win.c:10796: Test failed: pos = 00fa00fa
From: Rémi Bernon <rbernon(a)codeweavers.com> The test is randomly failing, processing messages while waiting for events and cleaning up child windows in the other process should fix the issue. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/user32/tests/win.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 2f538874496..800cde0c593 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -10206,21 +10206,29 @@ static void window_from_point_proc(HWND parent) flush_events(TRUE); SetEvent(start_event); - got_hittest = FALSE; got_click = FALSE; - while(!got_click && wait_for_message(&msg)) { - if(msg.message == WM_LBUTTONUP) { - ok(msg.hwnd == win, "msg.hwnd = %p, expected %p\n", msg.hwnd, win); - got_click = TRUE; + got_hittest = FALSE; + while ((ret = MsgWaitForMultipleObjects( 1, &end_event, FALSE, INFINITE, QS_ALLINPUT )) <= 1) + { + while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) + { + if (msg.message == WM_LBUTTONUP) + { + ok(msg.hwnd == win, "msg.hwnd = %p, expected %p\n", msg.hwnd, win); + got_click = TRUE; + } + TranslateMessage( &msg ); + DispatchMessageA( &msg ); } - DispatchMessageA(&msg); + if (ret == 0) break; } + ok(ret == 0, "MsgWaitForMultipleObjects returned %#lx\n", ret); ok(got_hittest, "transparent window didn't get WM_NCHITTEST message\n"); ok(got_click, "button under static window didn't get WM_LBUTTONUP\n"); - ret = WaitForSingleObject(end_event, 5000); - ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %lx\n", ret); - + DestroyWindow(win); + DestroyWindow(child_button); + DestroyWindow(child_static); CloseHandle(start_event); CloseHandle(end_event); } @@ -10240,14 +10248,10 @@ static void test_window_from_point(const char *argv0) pt.x = pt.y = 150; win = WindowFromPoint(pt); + ok(win == hwnd, "WindowFromPoint returned %p, expected %p\n", win, hwnd); pt.x = 250; - if(win == hwnd) - win = WindowFromPoint(pt); - if(win != hwnd) { - skip("there's another window covering test window\n"); - DestroyWindow(hwnd); - return; - } + win = WindowFromPoint(pt); + ok(win == hwnd, "WindowFromPoint returned %p, expected %p\n", win, hwnd); child = CreateWindowExA(0, "static", "static", WS_CHILD | WS_VISIBLE, 0, 0, 100, 100, hwnd, 0, NULL, NULL); @@ -10274,7 +10278,7 @@ static void test_window_from_point(const char *argv0) startup.cb = sizeof(startup); ok(CreateProcessA(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess failed.\n"); - ok(wait_for_events(1, &start_event, 1000) == 0, "didn't get start_event\n"); + wait_for_events(1, &start_event, INFINITE); child = GetWindow(hwnd, GW_CHILD); win = WindowFromPoint(pt); @@ -10289,6 +10293,8 @@ static void test_window_from_point(const char *argv0) ok(win == child, "WindowFromPoint returned %p, expected %p\n", win, child); SetEvent(end_event); + wait_for_events(1, &info.hProcess, INFINITE); + wait_child_process(info.hProcess); CloseHandle(start_event); CloseHandle(end_event); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/169
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=115938 Your paranoid android. === w10pro64_ja (64 bit report) === user32: win.c:4373: Test failed: message 0100 available win.c:4374: Test failed: hwnd 0000000000000000 message 0100 win.c:4403: Test failed: no message available win.c:4404: Test failed: hwnd 0000000000000000 message 0100 win.c:10794: Test failed: pos = 00fa00fa win.c:10798: Test failed: pos = 00fa00fa win.c:10802: Test failed: pos = 00fa00fa === w10pro64_zh_CN (64 bit report) === user32: win.c:4373: Test failed: message 0100 available win.c:4374: Test failed: hwnd 0000000000000000 message 0100 win.c:4403: Test failed: no message available win.c:4404: Test failed: hwnd 0000000000000000 message 0100 win.c:10794: Test failed: pos = 00fa00fa win.c:10798: Test failed: pos = 00fa00fa win.c:10802: Test failed: pos = 00fa00fa
participants (3)
-
Marvin -
Rémi Bernon -
Zebediah Figura