Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56109
-- v4: user32: Send parent BN_CLICKED notification when a radio button get focused comctl32: Send parent BN_CLICKED notification when a radio button get focused user32/tests: Add tests for radio button WM_SETFOCUS comctl32/tests: Add tests for radio button WM_SETFOCUS
From: Fabian Maurer dark.shadow4@web.de
--- dlls/comctl32/tests/button.c | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c index cfcdb44019c..6052c24d62d 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -2373,6 +2373,55 @@ static void test_visual(void) DestroyWindow(parent); }
+static void test_radiobutton_focus(void) +{ + HWND hwnd, button; + MSG msg; + int i; + DWORD types[] = { BS_RADIOBUTTON, BS_AUTORADIOBUTTON }; + + static const struct message set_focus1[] = + { + { WM_SETFOCUS, sent }, + { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) }, + { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_BUTTON, BN_CLICKED) }, + { WM_PAINT, sent }, + { 0 } + }; + + static const struct message set_focus2[] = + { + { WM_SETFOCUS, sent }, + { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) }, + { WM_PAINT, sent }, + { WM_NCPAINT, sent|defwinproc|optional }, /* FIXME: Wine sends it */ + { 0 } + }; + + hwnd = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, 0, NULL); + ok(hwnd != 0, "Failed to create parent window\n"); + + for (i = 0; i < ARRAY_SIZE(types); i++) + { + button = create_button(types[i] | WS_VISIBLE, hwnd); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(button, WM_SETFOCUS, 0, 0); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(sequences, COMBINED_SEQ_INDEX, set_focus1, "WM_SETFOCUS on a radiobutton 1", TRUE); + + SendMessageA(button, BM_SETCHECK, BST_CHECKED, 0); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(button, WM_SETFOCUS, 0, 0); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(sequences, COMBINED_SEQ_INDEX, set_focus2, "WM_SETFOCUS on a radiobutton 2", FALSE); + DestroyWindow(button); + } + + DestroyWindow(hwnd); +} + START_TEST(button) { BOOL (WINAPI * pIsThemeActive)(VOID); @@ -2408,6 +2457,7 @@ START_TEST(button) test_bcm_get_ideal_size(); test_style(); test_visual(); + test_radiobutton_focus();
unload_v6_module(ctx_cookie, hCtx); }
From: Fabian Maurer dark.shadow4@web.de
--- dlls/user32/tests/msg.c | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index bcb376cb14b..36bb23ee0db 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -20442,6 +20442,54 @@ static void test_hook_changing_window_proc(void) DestroyWindow( hwnd ); }
+static void test_radiobutton_focus(void) +{ + HWND hwnd, button; + DWORD style; + MSG msg; + int i; + DWORD types[] = { BS_RADIOBUTTON, BS_AUTORADIOBUTTON }; + + static const struct message set_focus1[] = + { + { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) }, + { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_BUTTON, BN_CLICKED) }, + { 0 } + }; + + static const struct message set_focus2[] = + { + { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_BUTTON, BN_SETFOCUS) }, + { 0 } + }; + + hwnd = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, 0, NULL); + ok(hwnd != 0, "Failed to create parent window\n"); + + for (i = 0; i < ARRAY_SIZE(types); i++) + { + style = types[i] | WS_CHILD | WS_VISIBLE | BS_NOTIFY; + button = CreateWindowExA(0, WC_BUTTONA, "test", style, 0, 0, 50, 14, hwnd, (HMENU)ID_BUTTON, 0, NULL); + ok(button != NULL, "failed to create a button, 0x%08lx, %p\n", style, hwnd); + + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + flush_sequence(); + SendMessageA(button, WM_SETFOCUS, 0, 0); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(set_focus1, "WM_SETFOCUS on a radiobutton 1", TRUE); + + SendMessageA(button, BM_SETCHECK, BST_CHECKED, 0); + flush_sequence(); + SendMessageA(button, WM_SETFOCUS, 0, 0); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(set_focus2, "WM_SETFOCUS on a radiobutton 2", FALSE); + DestroyWindow(button); + } + + DestroyWindow(hwnd); +} + START_TEST(msg) { char **test_argv; @@ -20489,6 +20537,7 @@ START_TEST(msg) test_setparent_status(); test_InSendMessage(); test_SetFocus(); + test_radiobutton_focus(); test_SetParent(); test_PostMessage(); test_broadcast();
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56109 --- dlls/comctl32/button.c | 6 ++++++ dlls/comctl32/tests/button.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c index 77eb54fbcf1..b39439799db 100644 --- a/dlls/comctl32/button.c +++ b/dlls/comctl32/button.c @@ -866,6 +866,12 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
if (style & BS_NOTIFY) BUTTON_NOTIFY_PARENT(hWnd, BN_SETFOCUS); + + if (((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON)) && + !(infoPtr->state & BST_CHECKED)) + { + BUTTON_NOTIFY_PARENT(hWnd, BN_CLICKED); + } break;
case WM_KILLFOCUS: diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c index 6052c24d62d..ed8ff1b7a4c 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -2409,7 +2409,7 @@ static void test_radiobutton_focus(void) flush_sequences(sequences, NUM_MSG_SEQUENCES); SendMessageA(button, WM_SETFOCUS, 0, 0); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); - ok_sequence(sequences, COMBINED_SEQ_INDEX, set_focus1, "WM_SETFOCUS on a radiobutton 1", TRUE); + ok_sequence(sequences, COMBINED_SEQ_INDEX, set_focus1, "WM_SETFOCUS on a radiobutton 1", FALSE);
SendMessageA(button, BM_SETCHECK, BST_CHECKED, 0); flush_sequences(sequences, NUM_MSG_SEQUENCES);
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56109 --- dlls/user32/button.c | 6 ++++++ dlls/user32/tests/msg.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c index 10a111562a7..51954c7562b 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -381,6 +381,12 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, paint_button( hWnd, btn_type, ODA_FOCUS ); if (style & BS_NOTIFY) BUTTON_NOTIFY_PARENT(hWnd, BN_SETFOCUS); + + if (((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON)) && + !(get_button_state(hWnd) & BST_CHECKED)) + { + BUTTON_NOTIFY_PARENT(hWnd, BN_CLICKED); + } break;
case WM_KILLFOCUS: diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 36bb23ee0db..255aa7c5ecd 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -20477,7 +20477,7 @@ static void test_radiobutton_focus(void) flush_sequence(); SendMessageA(button, WM_SETFOCUS, 0, 0); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); - ok_sequence(set_focus1, "WM_SETFOCUS on a radiobutton 1", TRUE); + ok_sequence(set_focus1, "WM_SETFOCUS on a radiobutton 1", FALSE);
SendMessageA(button, BM_SETCHECK, BST_CHECKED, 0); flush_sequence();
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=145969
Your paranoid android.
=== debian11 (32 bit report) ===
comctl32: taskdialog.c:597: Test failed: default radio button: radio button after clicking: in msg 0x8000 expecting wParam 0x1 got 0x28 taskdialog.c:597: Test failed: default radio button: radio button after clicking: in msg 0x8000 expecting id 2 got 6 taskdialog.c:597: Test failed: default radio button: radio button after clicking: in msg 0x8000 expecting wParam 0x0 got 0x1 taskdialog.c:597: Test failed: default radio button: radio button after clicking: in msg 0x8000 expecting id 5 got 2 taskdialog.c:597: Test failed: default radio button: radio button after clicking: the msg sequence is not complete: expected 0000 - actual 8000 taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: in msg 0x8000 expecting wParam 0x1 got 0xfffffffe taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: in msg 0x8000 expecting id 2 got 6 taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: in msg 0x8000 expecting wParam 0x0 got 0x1 taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: in msg 0x8000 expecting id 5 got 2 taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: the msg sequence is not complete: expected 0000 - actual 8000
user32: input.c:4067: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 01230084, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
=== debian11b (64 bit WoW report) ===
comctl32: taskdialog.c:597: Test failed: default radio button: radio button after clicking: in msg 0x8000 expecting wParam 0x1 got 0x28 taskdialog.c:597: Test failed: default radio button: radio button after clicking: in msg 0x8000 expecting id 2 got 6 taskdialog.c:597: Test failed: default radio button: radio button after clicking: in msg 0x8000 expecting wParam 0x0 got 0x1 taskdialog.c:597: Test failed: default radio button: radio button after clicking: in msg 0x8000 expecting id 5 got 2 taskdialog.c:597: Test failed: default radio button: radio button after clicking: the msg sequence is not complete: expected 0000 - actual 8000 taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: in msg 0x8000 expecting wParam 0x1 got 0xfffffffffffffffe taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: in msg 0x8000 expecting id 2 got 6 taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: in msg 0x8000 expecting wParam 0x0 got 0x1 taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: in msg 0x8000 expecting id 5 got 2 taskdialog.c:627: Test failed: radio button: manually click radio button with negative id: the msg sequence is not complete: expected 0000 - actual 8000
Any news on this?