Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/user32/tests/msg.c | 125 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 28b58b6787..b39d0b251b 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -6670,6 +6670,130 @@ static void test_button_bm_get_set_image(void) ReleaseDC(0, hdc); }
+#define ID_RADIO1 0x00e1 +#define ID_RADIO2 0x00e2 + +static const struct message auto_radio_button_WM_CLICK[] = +{ + { BM_CLICK, sent|wparam|lparam, 0, 0 }, + { WM_LBUTTONDOWN, sent|wparam|lparam|defwinproc, 0, 0 }, + { EVENT_SYSTEM_CAPTURESTART, winevent_hook|wparam|lparam, 0, 0 }, + { BM_SETSTATE, sent|wparam|lparam|defwinproc, BST_CHECKED, 0 }, + { WM_CTLCOLORSTATIC, sent|parent }, + { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, + { WM_LBUTTONUP, sent|wparam|lparam|defwinproc, 0, 0 }, + { BM_SETSTATE, sent|wparam|lparam|defwinproc, BST_UNCHECKED, 0 }, + { WM_CTLCOLORSTATIC, sent|parent }, + { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, + { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, 0, 0 }, + { BM_SETCHECK, sent|wparam|lparam|defwinproc, BST_CHECKED, 0 }, + { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, 0, 0 }, + { BM_SETCHECK, sent|wparam|lparam|defwinproc, 0, 0 }, + { WM_CTLCOLORSTATIC, sent|parent }, + { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, + { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, 0, 0 }, + { BM_SETCHECK, sent|wparam|lparam|defwinproc, 0, 0 }, + { WM_CTLCOLORSTATIC, sent|parent }, + { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, + { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, 0, 0 }, + { EVENT_SYSTEM_CAPTUREEND, winevent_hook|wparam|lparam, 0, 0 }, + { WM_CAPTURECHANGED, sent|wparam|lparam|defwinproc, 0, 0 }, + { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_RADIO2, BN_CLICKED) }, + { WM_NCHITTEST, sent|optional, 0, 0 }, /* FIXME: Wine doesn't send it */ + { WM_SETCURSOR, sent|optional, 0, 0 }, /* FIXME: Wine doesn't send it */ + { WM_MOUSEMOVE, sent|optional, 0, 0 }, /* FIXME: Wine doesn't send it */ + { 0 } +}; + +static void test_autoradio_messages(void) +{ + HWND parent, radio1, radio2, radio3, child; + RECT rc; + MSG msg; + DWORD ret; + + subclass_button(); + + parent = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 200, 200, 0, 0, 0, NULL); + ok(parent != 0, "failed to create parent window\n"); + radio1 = CreateWindowExA(0, "my_button_class", "radio1", WS_VISIBLE | WS_CHILD | WS_GROUP | BS_AUTORADIOBUTTON | BS_NOTIFY, + 0, 0, 70, 18, parent, (HMENU)ID_RADIO1, 0, NULL); + ok(radio1 != 0, "failed to create child window\n"); + radio3 = CreateWindowExA(0, "my_button_class", "radio3", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON | BS_NOTIFY, + 0, 25, 70, 18, parent, (HMENU)-1, 0, NULL); + ok(radio3 != 0, "failed to create child window\n"); + child = CreateWindowExA(0, "my_button_class", "text", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_NOTIFY, + 0, 50, 70, 18, parent, (HMENU)-1, 0, NULL); + ok(child != 0, "failed to create child window\n"); + radio2 = CreateWindowExA(0, "my_button_class", "radio2", WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_NOTIFY, + 0, 75, 70, 18, parent, (HMENU)ID_RADIO2, 0, NULL); + ok(radio2 != 0, "failed to create child window\n"); + + /* this avoids focus messages in the generated sequence */ + SetFocus(radio2); + + flush_events(); + flush_sequence(); + + ret = SendMessageA(radio1, BM_GETCHECK, 0, 0); + ok(ret == BST_UNCHECKED, "got %08x\n", ret); + ret = SendMessageA(radio2, BM_GETCHECK, 0, 0); + ok(ret == BST_UNCHECKED, "got %08x\n", ret); + ret = SendMessageA(radio3, BM_GETCHECK, 0, 0); + ok(ret == BST_UNCHECKED, "got %08x\n", ret); + + SendMessageA(radio1, BM_SETCHECK, BST_CHECKED, 0); + + ret = SendMessageA(radio1, BM_GETCHECK, 0, 0); + ok(ret == BST_CHECKED, "got %08x\n", ret); + ret = SendMessageA(radio2, BM_GETCHECK, 0, 0); + ok(ret == BST_UNCHECKED, "got %08x\n", ret); + ret = SendMessageA(radio3, BM_GETCHECK, 0, 0); + ok(ret == BST_UNCHECKED, "got %08x\n", ret); + + SendMessageA(radio2, BM_SETCHECK, BST_CHECKED, 0); + + ret = SendMessageA(radio1, BM_GETCHECK, 0, 0); + ok(ret == BST_CHECKED, "got %08x\n", ret); + ret = SendMessageA(radio2, BM_GETCHECK, 0, 0); + ok(ret == BST_CHECKED, "got %08x\n", ret); + ret = SendMessageA(radio3, BM_GETCHECK, 0, 0); + ok(ret == BST_UNCHECKED, "got %08x\n", ret); + + SendMessageA(radio3, BM_SETCHECK, BST_CHECKED, 0); + + ret = SendMessageA(radio1, BM_GETCHECK, 0, 0); + ok(ret == BST_CHECKED, "got %08x\n", ret); + ret = SendMessageA(radio2, BM_GETCHECK, 0, 0); + ok(ret == BST_CHECKED, "got %08x\n", ret); + ret = SendMessageA(radio3, BM_GETCHECK, 0, 0); + ok(ret == BST_CHECKED, "got %08x\n", ret); + + GetWindowRect(radio2, &rc); + SetCursorPos(rc.left+1, rc.top+1); + + flush_events(); + flush_sequence(); + + log_all_parent_messages++; + + SendMessageA(radio2, BM_CLICK, 0, 0); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(auto_radio_button_WM_CLICK, "BM_CLICK on auto-radio button", FALSE); + + log_all_parent_messages--; + + ret = SendMessageA(radio1, BM_GETCHECK, 0, 0); + ok(ret == BST_UNCHECKED, "got %08x\n", ret); + ret = SendMessageA(radio2, BM_GETCHECK, 0, 0); + ok(ret == BST_CHECKED, "got %08x\n", ret); + ret = SendMessageA(radio3, BM_GETCHECK, 0, 0); + ok(ret == BST_UNCHECKED, "got %08x\n", ret); + + DestroyWindow(parent); +} + /****************** static message test *************************/ static const struct message WmSetFontStaticSeq2[] = { @@ -17130,6 +17254,7 @@ START_TEST(msg) test_mdi_messages(); test_button_messages(); test_button_bm_get_set_image(); + test_autoradio_messages(); test_static_messages(); test_listbox_messages(); test_combobox_messages();
Hi,
While running your changed tests on Windows, 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=44960
Your paranoid android.
=== wvistau64_fr (32 bit report) ===
user32: msg.c:11998: Test failed: expected PeekMessage to return FALSE, got 1
=== debian9 (32 bit report) ===
user32: menu.c:2354: Test failed: test 25 menu: Timeout msg.c:8387: Test failed: WaitForSingleObject failed 102 msg.c:8393: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8393: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8393: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000