From: Fabian Maurer dark.shadow4@web.de
--- dlls/comctl32/tests/button.c | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c index cfcdb44019c..69def1a788f 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -2373,6 +2373,57 @@ static void test_visual(void) DestroyWindow(parent); }
+static void test_radiobutton_focus(void) +{ + HWND hwnd, button; + DWORD type; + MSG msg; + + 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 (type = BS_PUSHBUTTON; type <= BS_DEFCOMMANDLINK; ++type) + { + if (type != BS_RADIOBUTTON && type != BS_AUTORADIOBUTTON) + continue; + + button = create_button(type | 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 +2459,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 | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index bcb376cb14b..762c5705fc5 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -20442,6 +20442,55 @@ static void test_hook_changing_window_proc(void) DestroyWindow( hwnd ); }
+static void test_radiobutton_focus(void) +{ + HWND hwnd, button; + DWORD type, style; + MSG msg; + + 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 (type = BS_PUSHBUTTON; type <= BS_DEFCOMMANDLINK; ++type) + { + if (type != BS_RADIOBUTTON && type != BS_AUTORADIOBUTTON) + continue; + + style = type | 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 +20538,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 69def1a788f..72ff7b3ccfe 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -2411,7 +2411,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 762c5705fc5..de9c076fbc6 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -20478,7 +20478,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=145959
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
=== 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
Nikolay Sivov (@nsivov) commented about dlls/comctl32/tests/button.c:
- {
{ 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 (type = BS_PUSHBUTTON; type <= BS_DEFCOMMANDLINK; ++type)
- {
if (type != BS_RADIOBUTTON && type != BS_AUTORADIOBUTTON)
continue;
This looks strange. You don't need to iterate like that just to use two values.
Nikolay Sivov (@nsivov) commented about dlls/user32/tests/msg.c:
- };
- 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 (type = BS_PUSHBUTTON; type <= BS_DEFCOMMANDLINK; ++type)
- {
if (type != BS_RADIOBUTTON && type != BS_AUTORADIOBUTTON)
continue;
Same here. Also command link button does not exist in user32 to begin with.
Nikolay Sivov (@nsivov) commented about dlls/user32/tests/msg.c:
- };
- 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 (type = BS_PUSHBUTTON; type <= BS_DEFCOMMANDLINK; ++type)
- {
if (type != BS_RADIOBUTTON && type != BS_AUTORADIOBUTTON)
continue;
style = type | 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);
It makes sense to have a helper for this.