user32/tests: Add a message test for group of radio buttons.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-11-25 20:58:08 +03:00 committed by Alexandre Julliard
parent 96d0af52eb
commit af88297f4a
1 changed files with 125 additions and 0 deletions

View File

@ -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();