mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Added patch to implement support for navigating a group of radio buttons using a keyboard.
This commit is contained in:
parent
77452f30f8
commit
eaff208f0d
@ -7049,14 +7049,20 @@ fi
|
||||
# | * [#42010] Move the auto radio button group logic from BM_SETCHECK to WM_LBUTTONUP handler
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/user32/button.c, dlls/user32/tests/msg.c
|
||||
# | * dlls/user32/button.c, dlls/user32/dialog.c, dlls/user32/tests/msg.c, dlls/user32/tests/resource.rc
|
||||
# |
|
||||
if test "$enable_user32_Auto_Radio_Button" -eq 1; then
|
||||
patch_apply user32-Auto_Radio_Button/0001-user32-Move-the-auto-radio-button-group-logic-from-B.patch
|
||||
patch_apply user32-Auto_Radio_Button/0002-user32-tests-Add-a-message-test-for-group-of-radio-b.patch
|
||||
patch_apply user32-Auto_Radio_Button/0003-user32-tests-Simplify-the-test-for-BM_CLICK-on-autor.patch
|
||||
patch_apply user32-Auto_Radio_Button/0004-user32-tests-Add-a-test-for-navigating-a-group-of-bu.patch
|
||||
patch_apply user32-Auto_Radio_Button/0005-user32-Add-support-for-navigating-a-group-of-radio-b.patch
|
||||
(
|
||||
echo '+ { "Dmitry Timoshkov", "user32: Move the auto radio button group logic from BM_SETCHECK to WM_LBUTTONUP handler.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "user32/tests: Add a message test for group of radio buttons.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "user32/tests: Simplify the test for BM_CLICK on autoradio button by using a dialog.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "user32/tests: Add a test for navigating a group of buttons using keyboard events.", 1 },';
|
||||
echo '+ { "Dmitry Timoshkov", "user32: Add support for navigating a group of radio buttons using a keyboard.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
@ -0,0 +1,183 @@
|
||||
From 65acbf528d5686523eff349221d49e4ee0d08fd7 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Tue, 10 Jan 2017 15:58:14 +0800
|
||||
Subject: user32/tests: Simplify the test for BM_CLICK on autoradio button by
|
||||
using a dialog.
|
||||
|
||||
---
|
||||
dlls/user32/tests/msg.c | 78 ++++++++++++++++++++++++++-----------------
|
||||
dlls/user32/tests/resource.rc | 11 ++++++
|
||||
2 files changed, 59 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
|
||||
index 30328156f7a..5ed36df1a82 100644
|
||||
--- a/dlls/user32/tests/msg.c
|
||||
+++ b/dlls/user32/tests/msg.c
|
||||
@@ -123,6 +123,8 @@ static DWORD cbt_hook_thread_id;
|
||||
static const WCHAR testWindowClassW[] =
|
||||
{ 'T','e','s','t','W','i','n','d','o','w','C','l','a','s','s','W',0 };
|
||||
|
||||
+static LRESULT WINAPI ParentMsgCheckProcA(HWND, UINT, WPARAM, LPARAM);
|
||||
+
|
||||
/*
|
||||
FIXME: add tests for these
|
||||
Window Edge Styles (Win31/Win95/98 look), in order of precedence:
|
||||
@@ -5744,7 +5746,24 @@ static LRESULT CALLBACK button_hook_proc(HWND hwnd, UINT message, WPARAM wParam,
|
||||
case BM_SETSTATE:
|
||||
if (GetCapture())
|
||||
ok(GetCapture() == hwnd, "GetCapture() = %p\n", GetCapture());
|
||||
+
|
||||
+ lParam = (ULONG_PTR)GetMenu(hwnd);
|
||||
+ goto log_it;
|
||||
+
|
||||
+ case WM_GETDLGCODE:
|
||||
+ if (lParam)
|
||||
+ {
|
||||
+ MSG *msg = (MSG *)lParam;
|
||||
+ lParam = MAKELPARAM(msg->message, msg->wParam);
|
||||
+ }
|
||||
+ wParam = (ULONG_PTR)GetMenu(hwnd);
|
||||
+ goto log_it;
|
||||
+
|
||||
+ case BM_SETCHECK:
|
||||
+ case BM_GETCHECK:
|
||||
+ lParam = (ULONG_PTR)GetMenu(hwnd);
|
||||
/* fall through */
|
||||
+log_it:
|
||||
default:
|
||||
msg.hwnd = hwnd;
|
||||
msg.message = message;
|
||||
@@ -6064,32 +6083,34 @@ static void test_button_messages(void)
|
||||
DestroyWindow(parent);
|
||||
}
|
||||
|
||||
-#define ID_RADIO1 0x00e1
|
||||
-#define ID_RADIO2 0x00e2
|
||||
+#define ID_RADIO1 501
|
||||
+#define ID_RADIO2 502
|
||||
+#define ID_RADIO3 503
|
||||
+#define ID_TEXT 504
|
||||
|
||||
-static const struct message auto_radio_button_WM_CLICK[] =
|
||||
+static const struct message auto_radio_button_BM_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 },
|
||||
+ { BM_SETSTATE, sent|wparam|lparam|defwinproc, BST_CHECKED, ID_RADIO2 },
|
||||
{ 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 },
|
||||
+ { BM_SETSTATE, sent|wparam|lparam|defwinproc, BST_UNCHECKED, ID_RADIO2 },
|
||||
{ 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_GETDLGCODE, sent|wparam|lparam|defwinproc, ID_RADIO2, 0 },
|
||||
+ { BM_SETCHECK, sent|wparam|lparam|defwinproc, BST_CHECKED, ID_RADIO2 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, ID_RADIO1, 0 },
|
||||
+ { BM_SETCHECK, sent|wparam|lparam|defwinproc, 0, ID_RADIO1 },
|
||||
{ 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_GETDLGCODE, sent|wparam|lparam|defwinproc, ID_RADIO3, 0 },
|
||||
+ { BM_SETCHECK, sent|wparam|lparam|defwinproc, 0, ID_RADIO3 },
|
||||
{ WM_CTLCOLORSTATIC, sent|parent },
|
||||
{ EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
|
||||
- { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, 0, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, ID_TEXT, 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) },
|
||||
@@ -6099,30 +6120,27 @@ static const struct message auto_radio_button_WM_CLICK[] =
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
-static void test_autoradio_messages(void)
|
||||
+static INT_PTR WINAPI radio_test_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
- HWND parent, radio1, radio2, radio3, child;
|
||||
+ ParentMsgCheckProcA(hwnd, msg, wp, lp);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static void test_autoradio_BM_CLICK(void)
|
||||
+{
|
||||
+ HWND parent, radio1, radio2, radio3;
|
||||
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);
|
||||
+ parent = CreateDialogParamA(0, "AUTORADIO_TEST_DIALOG_1", 0, radio_test_dlg_proc, 0);
|
||||
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");
|
||||
+
|
||||
+ radio1 = GetDlgItem(parent, ID_RADIO1);
|
||||
+ radio2 = GetDlgItem(parent, ID_RADIO2);
|
||||
+ radio3 = GetDlgItem(parent, ID_RADIO3);
|
||||
|
||||
/* this avoids focus messages in the generated sequence */
|
||||
SetFocus(radio2);
|
||||
@@ -6174,7 +6192,7 @@ static void test_autoradio_messages(void)
|
||||
|
||||
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);
|
||||
+ ok_sequence(auto_radio_button_BM_CLICK, "BM_CLICK on auto-radio button", FALSE);
|
||||
|
||||
log_all_parent_messages--;
|
||||
|
||||
@@ -16281,7 +16299,7 @@ START_TEST(msg)
|
||||
invisible_parent_tests();
|
||||
test_mdi_messages();
|
||||
test_button_messages();
|
||||
- test_autoradio_messages();
|
||||
+ test_autoradio_BM_CLICK();
|
||||
test_static_messages();
|
||||
test_listbox_messages();
|
||||
test_combobox_messages();
|
||||
diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc
|
||||
index a9e45e90ce1..1557291c145 100644
|
||||
--- a/dlls/user32/tests/resource.rc
|
||||
+++ b/dlls/user32/tests/resource.rc
|
||||
@@ -75,6 +75,17 @@ FONT 8, "MS Shell Dlg"
|
||||
PUSHBUTTON "Cancel", IDCANCEL,109,20,50,14, WS_TABSTOP | WS_GROUP
|
||||
}
|
||||
|
||||
+AUTORADIO_TEST_DIALOG_1 DIALOGEX 0, 0, 200, 200
|
||||
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
|
||||
+CAPTION "Radio Button Test Dialog"
|
||||
+FONT 8, "MS Shell Dlg"
|
||||
+{
|
||||
+ CONTROL "Radio1",501,"my_button_class",WS_VISIBLE | WS_CHILD | WS_GROUP | BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,10,70,18
|
||||
+ CONTROL "Radio3",503,"my_button_class",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,35,70,18
|
||||
+ CONTROL "Text",504,"my_button_class",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_NOTIFY | WS_TABSTOP,10,60,70,18
|
||||
+ CONTROL "Radio2",502,"my_button_class",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,85,70,18
|
||||
+}
|
||||
+
|
||||
CLASS_TEST_DIALOG DIALOG 0, 0, 91, 28
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "CreateDialogParams Test"
|
||||
--
|
||||
2.11.0
|
||||
|
@ -0,0 +1,377 @@
|
||||
From a1ce594db785f9266c522755919000df7fc16f71 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Tue, 10 Jan 2017 16:02:36 +0800
|
||||
Subject: user32/tests: Add a test for navigating a group of buttons using
|
||||
keyboard events.
|
||||
|
||||
---
|
||||
dlls/user32/tests/msg.c | 316 ++++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/user32/tests/resource.rc | 11 ++
|
||||
2 files changed, 327 insertions(+)
|
||||
|
||||
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
|
||||
index 5ed36df1a82..ba7320d9c41 100644
|
||||
--- a/dlls/user32/tests/msg.c
|
||||
+++ b/dlls/user32/tests/msg.c
|
||||
@@ -6120,6 +6120,132 @@ static const struct message auto_radio_button_BM_CLICK[] =
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
+static const struct message auto_radio_button_VK_UP_child[] =
|
||||
+{
|
||||
+ { WM_KEYDOWN, sent|wparam|lparam, VK_UP, 0 },
|
||||
+ { WM_KEYUP, sent|wparam|lparam, VK_UP, 0 },
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
+static const struct message auto_radio_button_VK_UP_parent[] =
|
||||
+{
|
||||
+ { WM_KEYDOWN, sent|wparam|lparam|parent, VK_UP, 0 },
|
||||
+ { WM_KEYUP, sent|wparam|lparam|parent, VK_UP, 0 },
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
+static const struct message auto_radio_button_VK_UP_dialog[] =
|
||||
+{
|
||||
+ { WM_GETDLGCODE, sent|parent, 0, 0 },
|
||||
+
|
||||
+ /* optional trailer seen on some windows setups */
|
||||
+ { WM_CHANGEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent|optional },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent|optional },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent|optional },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_CTLCOLORBTN, sent|parent|optional },
|
||||
+ { WM_CTLCOLORBTN, sent|parent|optional },
|
||||
+ { WM_UPDATEUISTATE, sent|optional },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent|optional },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent|optional },
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
+static const struct message auto_radio_button_VK_DOWN_dialog[] =
|
||||
+{
|
||||
+ { WM_GETDLGCODE, sent|parent, 0, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam, ID_RADIO1, MAKELPARAM(WM_KEYDOWN, VK_DOWN) },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam, ID_RADIO1, 0 },
|
||||
+ { HCBT_SETFOCUS, hook },
|
||||
+ { WM_KILLFOCUS, sent, 0, 0 },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent },
|
||||
+ { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_RADIO3, BN_KILLFOCUS) },
|
||||
+ { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
|
||||
+ { WM_SETFOCUS, sent, 0, 0 },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent },
|
||||
+ { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_RADIO1, BN_SETFOCUS) },
|
||||
+ { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_RADIO1, BN_CLICKED) },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam, ID_RADIO1, 0 },
|
||||
+ { WM_GETDLGCODE, sent|parent, 0, 0 },
|
||||
+ { DM_GETDEFID, sent|parent, 0, 0 },
|
||||
+ { BM_GETCHECK, sent|wparam|lparam, 0, ID_RADIO1 },
|
||||
+ { BM_CLICK, sent|wparam|lparam, 1, 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, ID_RADIO1 },
|
||||
+ { 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, ID_RADIO1 },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent },
|
||||
+ { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, ID_RADIO1, 0 },
|
||||
+ { BM_SETCHECK, sent|wparam|lparam|defwinproc, BST_CHECKED, ID_RADIO1 },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent },
|
||||
+ { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, ID_RADIO3, 0 },
|
||||
+ { BM_SETCHECK, sent|wparam|lparam|defwinproc, BST_UNCHECKED, ID_RADIO3 },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent },
|
||||
+ { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, ID_TEXT, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam|defwinproc, ID_RADIO2, 0 },
|
||||
+ { BM_SETCHECK, sent|wparam|lparam|defwinproc, BST_UNCHECKED, ID_RADIO2 },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent },
|
||||
+ { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 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_RADIO1, 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 */
|
||||
+ { WM_PAINT, sent },
|
||||
+ { WM_CTLCOLORSTATIC, sent|parent },
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
+static const struct message auto_radio_button_VK_DOWN_radio3[] =
|
||||
+{
|
||||
+ { BM_GETCHECK, sent|wparam|lparam, 0, ID_RADIO1 },
|
||||
+ { BM_GETCHECK, sent|wparam|lparam, 0, ID_RADIO2 },
|
||||
+ { BM_GETCHECK, sent|wparam|lparam, 0, ID_RADIO3 },
|
||||
+ { WM_GETDLGCODE, sent|parent, 0, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam, ID_RADIO1, MAKELPARAM(WM_KEYDOWN, VK_DOWN) },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam, ID_RADIO1, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam, ID_RADIO1, 0 },
|
||||
+ { WM_GETDLGCODE, sent|wparam|lparam|parent, 0, 0 },
|
||||
+ { WM_USER, sent|parent, 0, 0 },
|
||||
+ { BM_GETCHECK, sent|wparam|lparam, 0, ID_RADIO1 },
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
+static const struct message auto_radio_button_VK_UP_radio1[] =
|
||||
+{
|
||||
+ { WM_GETDLGCODE, sent|parent, 0, 0 },
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
static INT_PTR WINAPI radio_test_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
ParentMsgCheckProcA(hwnd, msg, wp, lp);
|
||||
@@ -6206,6 +6332,195 @@ static void test_autoradio_BM_CLICK(void)
|
||||
DestroyWindow(parent);
|
||||
}
|
||||
|
||||
+#define test_radio(r1, s1, r2, s2, r3, s3) test_radio_dbg(r1, s1, r2, s2, r3, s3, __LINE__)
|
||||
+static void test_radio_dbg(HWND radio1, int state1, HWND radio2, int state2, HWND radio3, int state3, int line)
|
||||
+{
|
||||
+ DWORD ret;
|
||||
+
|
||||
+ ret = SendMessageA(radio1, BM_GETCHECK, 0, 0);
|
||||
+ ok_(__FILE__,line)(ret == state1 ? BST_CHECKED : BST_UNCHECKED, "got %08x\n", ret);
|
||||
+ ret = SendMessageA(radio2, BM_GETCHECK, 0, 0);
|
||||
+ ok_(__FILE__,line)(ret == state2 ? BST_CHECKED : BST_UNCHECKED, "got %08x\n", ret);
|
||||
+ ret = SendMessageA(radio3, BM_GETCHECK, 0, 0);
|
||||
+ ok_(__FILE__,line)(ret == state3 ? BST_CHECKED : BST_UNCHECKED, "got %08x\n", ret);
|
||||
+}
|
||||
+
|
||||
+static void set_radio(HWND radio1, int state1, HWND radio2, int state2, HWND radio3, int state3)
|
||||
+{
|
||||
+ SendMessageA(radio1, BM_SETCHECK, state1 ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
+ SendMessageA(radio2, BM_SETCHECK, state2 ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
+ SendMessageA(radio3, BM_SETCHECK, state3 ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
+}
|
||||
+
|
||||
+static void test_autoradio_kbd_move(void)
|
||||
+{
|
||||
+ HWND parent, radio1, radio2, radio3, hwnd;
|
||||
+ RECT rc;
|
||||
+ MSG msg;
|
||||
+ DWORD ret;
|
||||
+
|
||||
+ subclass_button();
|
||||
+
|
||||
+ parent = CreateDialogParamA(0, "AUTORADIO_TEST_DIALOG_2", 0, radio_test_dlg_proc, 0);
|
||||
+ ok(parent != 0, "failed to create parent window\n");
|
||||
+
|
||||
+ radio1 = GetDlgItem(parent, ID_RADIO1);
|
||||
+ radio2 = GetDlgItem(parent, ID_RADIO2);
|
||||
+ radio3 = GetDlgItem(parent, ID_RADIO3);
|
||||
+
|
||||
+ flush_events();
|
||||
+ flush_sequence();
|
||||
+
|
||||
+ test_radio(radio1, 0, radio2, 0, radio3, 0);
|
||||
+ set_radio(radio1, 1, radio2, 1, radio3, 1);
|
||||
+ test_radio(radio1, 1, radio2, 1, radio3, 1);
|
||||
+
|
||||
+ SetFocus(radio3);
|
||||
+
|
||||
+ flush_events();
|
||||
+ flush_sequence();
|
||||
+
|
||||
+ log_all_parent_messages++;
|
||||
+
|
||||
+ SendMessageA(radio3, WM_KEYDOWN, VK_UP, 0);
|
||||
+ SendMessageA(radio3, WM_KEYUP, VK_UP, 0);
|
||||
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
+ ok_sequence(auto_radio_button_VK_UP_child, "press/release VK_UP on auto-radio button", FALSE);
|
||||
+
|
||||
+ test_radio(radio1, 1, radio2, 1, radio3, 1);
|
||||
+
|
||||
+ flush_events();
|
||||
+ flush_sequence();
|
||||
+
|
||||
+ DefDlgProcA(parent, WM_KEYDOWN, VK_UP, 0);
|
||||
+ DefDlgProcA(parent, WM_KEYUP, VK_UP, 0);
|
||||
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
+ ok_sequence(auto_radio_button_VK_UP_parent, "press/release VK_UP on dialog", FALSE);
|
||||
+
|
||||
+ test_radio(radio1, 1, radio2, 1, radio3, 1);
|
||||
+
|
||||
+ SetFocus(radio3);
|
||||
+ GetWindowRect(radio3, &rc);
|
||||
+
|
||||
+ flush_events();
|
||||
+ flush_sequence();
|
||||
+
|
||||
+ msg.hwnd = parent;
|
||||
+ msg.message = WM_KEYDOWN;
|
||||
+ msg.wParam = VK_UP;
|
||||
+ msg.lParam = 0;
|
||||
+ msg.pt.x = rc.left + 1;
|
||||
+ msg.pt.y = rc.top + 1;
|
||||
+ ret = IsDialogMessageA(parent, &msg);
|
||||
+ ok(ret, "IsDialogMessage should return TRUE\n");
|
||||
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
+if (0) /* actual message sequence is different on every run in some Windows setups */
|
||||
+ ok_sequence(auto_radio_button_VK_UP_dialog, "IsDialogMessage(VK_UP) #1", FALSE);
|
||||
+ /* what really matters is that nothing has changed */
|
||||
+ test_radio(radio1, 1, radio2, 1, radio3, 1);
|
||||
+
|
||||
+ set_radio(radio1, 0, radio2, 1, radio3, 1);
|
||||
+ test_radio(radio1, 0, radio2, 1, radio3, 1);
|
||||
+
|
||||
+ flush_events();
|
||||
+ flush_sequence();
|
||||
+
|
||||
+ ret = IsDialogMessageA(parent, &msg);
|
||||
+ ok(ret, "IsDialogMessage should return TRUE\n");
|
||||
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
+if (0) /* actual message sequence is different on every run in some Windows setups */
|
||||
+ ok_sequence(auto_radio_button_VK_UP_dialog, "IsDialogMessage(VK_UP) #2", FALSE);
|
||||
+ /* what really matters is that nothing has changed */
|
||||
+ test_radio(radio1, 0, radio2, 1, radio3, 1);
|
||||
+
|
||||
+ /* switch from radio3 ro radio1 */
|
||||
+ SetFocus(radio3);
|
||||
+ GetWindowRect(radio3, &rc);
|
||||
+
|
||||
+ flush_events();
|
||||
+ flush_sequence();
|
||||
+
|
||||
+ msg.hwnd = parent;
|
||||
+ msg.message = WM_KEYDOWN;
|
||||
+ msg.wParam = VK_DOWN;
|
||||
+ msg.lParam = 0;
|
||||
+ msg.pt.x = rc.left + 1;
|
||||
+ msg.pt.y = rc.top + 1;
|
||||
+ ret = IsDialogMessageA(parent, &msg);
|
||||
+ ok(ret, "IsDialogMessage should return TRUE\n");
|
||||
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
+ ok_sequence(auto_radio_button_VK_DOWN_dialog, "IsDialogMessage(VK_DOWN)", TRUE);
|
||||
+
|
||||
+todo_wine
|
||||
+ test_radio(radio1, 1, radio2, 0, radio3, 0);
|
||||
+
|
||||
+ hwnd = GetFocus();
|
||||
+todo_wine
|
||||
+ ok(hwnd == radio1, "focus should be on radio1, not on %p\n", hwnd);
|
||||
+ GetWindowRect(radio1, &rc);
|
||||
+
|
||||
+ msg.hwnd = parent;
|
||||
+ msg.message = WM_KEYDOWN;
|
||||
+ msg.wParam = VK_DOWN;
|
||||
+ msg.lParam = 0;
|
||||
+ msg.pt.x = rc.left + 1;
|
||||
+ msg.pt.y = rc.top + 1;
|
||||
+ ret = IsDialogMessageA(parent, &msg);
|
||||
+ ok(ret, "IsDialogMessage should return TRUE\n");
|
||||
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
+ ok_sequence(auto_radio_button_VK_DOWN_radio3, "down to radio3", TRUE);
|
||||
+
|
||||
+todo_wine
|
||||
+ test_radio(radio1, 1, radio2, 0, radio3, 0);
|
||||
+
|
||||
+ hwnd = GetFocus();
|
||||
+todo_wine
|
||||
+ ok(hwnd == radio1, "focus should be on radio1, not on %p\n", hwnd);
|
||||
+
|
||||
+ flush_events();
|
||||
+ flush_sequence();
|
||||
+
|
||||
+ msg.hwnd = parent;
|
||||
+ msg.message = WM_KEYDOWN;
|
||||
+ msg.wParam = VK_UP;
|
||||
+ msg.lParam = 0;
|
||||
+ msg.pt.x = rc.left + 1;
|
||||
+ msg.pt.y = rc.top + 1;
|
||||
+ ret = IsDialogMessageA(parent, &msg);
|
||||
+ ok(ret, "IsDialogMessage should return TRUE\n");
|
||||
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
+ ok_sequence(auto_radio_button_VK_UP_radio1, "up to radio1", TRUE);
|
||||
+
|
||||
+todo_wine
|
||||
+ test_radio(radio1, 1, radio2, 0, radio3, 0);
|
||||
+
|
||||
+ hwnd = GetFocus();
|
||||
+todo_wine
|
||||
+ ok(hwnd == radio1, "focus should be on radio1, not on %p\n", hwnd);
|
||||
+
|
||||
+ flush_events();
|
||||
+ flush_sequence();
|
||||
+
|
||||
+ msg.hwnd = parent;
|
||||
+ msg.message = WM_KEYDOWN;
|
||||
+ msg.wParam = VK_UP;
|
||||
+ msg.lParam = 0;
|
||||
+ msg.pt.x = rc.left + 1;
|
||||
+ msg.pt.y = rc.top + 1;
|
||||
+ ret = IsDialogMessageA(parent, &msg);
|
||||
+ ok(ret, "IsDialogMessage should return TRUE\n");
|
||||
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
+if (0) /* actual message sequence is different on every run in some Windows setups */
|
||||
+ ok_sequence(auto_radio_button_VK_UP_dialog, "IsDialogMessage(VK_UP) #3", FALSE);
|
||||
+ /* what really matters is that nothing has changed */
|
||||
+todo_wine
|
||||
+ test_radio(radio1, 1, radio2, 0, radio3, 0);
|
||||
+
|
||||
+ log_all_parent_messages--;
|
||||
+
|
||||
+ DestroyWindow(parent);
|
||||
+}
|
||||
+
|
||||
/****************** static message test *************************/
|
||||
static const struct message WmSetFontStaticSeq2[] =
|
||||
{
|
||||
@@ -16300,6 +16615,7 @@ START_TEST(msg)
|
||||
test_mdi_messages();
|
||||
test_button_messages();
|
||||
test_autoradio_BM_CLICK();
|
||||
+ test_autoradio_kbd_move();
|
||||
test_static_messages();
|
||||
test_listbox_messages();
|
||||
test_combobox_messages();
|
||||
diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc
|
||||
index 1557291c145..3823ed39e42 100644
|
||||
--- a/dlls/user32/tests/resource.rc
|
||||
+++ b/dlls/user32/tests/resource.rc
|
||||
@@ -86,6 +86,17 @@ FONT 8, "MS Shell Dlg"
|
||||
CONTROL "Radio2",502,"my_button_class",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,85,70,18
|
||||
}
|
||||
|
||||
+AUTORADIO_TEST_DIALOG_2 DIALOGEX 0, 0, 200, 200
|
||||
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
|
||||
+CAPTION "Radio Button Test Dialog"
|
||||
+FONT 8, "MS Shell Dlg"
|
||||
+{
|
||||
+ CONTROL "Radio1",501,"my_button_class",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,10,10,70,18
|
||||
+ CONTROL "Radio3",503,"my_button_class",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON | BS_NOTIFY,10,35,70,18
|
||||
+ CONTROL "Text",504,"my_button_class",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_NOTIFY,10,60,70,18
|
||||
+ CONTROL "Radio2",502,"my_button_class",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_NOTIFY,10,85,70,18
|
||||
+}
|
||||
+
|
||||
CLASS_TEST_DIALOG DIALOG 0, 0, 91, 28
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "CreateDialogParams Test"
|
||||
--
|
||||
2.11.0
|
||||
|
@ -0,0 +1,87 @@
|
||||
From ab101021de9c3881cf70d9fc5e1af2dc2d38ebf9 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Tue, 10 Jan 2017 16:08:03 +0800
|
||||
Subject: user32: Add support for navigating a group of radio buttons using a
|
||||
keyboard.
|
||||
|
||||
It approximates the behaviour observed in the message tests but still
|
||||
doesn't make the message tests pass without failures.
|
||||
---
|
||||
dlls/user32/dialog.c | 12 ++++++++++--
|
||||
dlls/user32/tests/msg.c | 7 -------
|
||||
2 files changed, 10 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
|
||||
index 7f9a72d59ee..f8571498643 100644
|
||||
--- a/dlls/user32/dialog.c
|
||||
+++ b/dlls/user32/dialog.c
|
||||
@@ -1239,8 +1239,16 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
|
||||
if (!(dlgCode & DLGC_WANTARROWS))
|
||||
{
|
||||
BOOL fPrevious = (msg->wParam == VK_LEFT || msg->wParam == VK_UP);
|
||||
- HWND hwndNext = GetNextDlgGroupItem (hwndDlg, GetFocus(), fPrevious );
|
||||
- SendMessageW( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndNext, 1 );
|
||||
+ HWND hwndNext = GetNextDlgGroupItem( hwndDlg, msg->hwnd, fPrevious );
|
||||
+ if (hwndNext && SendMessageW( hwndNext, WM_GETDLGCODE, msg->wParam, (LPARAM)msg ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
|
||||
+ {
|
||||
+ SetFocus( hwndNext );
|
||||
+ if ((GetWindowLongW( hwndNext, GWL_STYLE ) & BS_TYPEMASK) == BS_AUTORADIOBUTTON &&
|
||||
+ SendMessageW( hwndNext, BM_GETCHECK, 0, 0 ) != BST_CHECKED)
|
||||
+ SendMessageW( hwndNext, BM_CLICK, 1, 0 );
|
||||
+ }
|
||||
+ else
|
||||
+ SendMessageW( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndNext, 1 );
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
|
||||
index ba7320d9c41..bfd2b915280 100644
|
||||
--- a/dlls/user32/tests/msg.c
|
||||
+++ b/dlls/user32/tests/msg.c
|
||||
@@ -6451,11 +6451,9 @@ if (0) /* actual message sequence is different on every run in some Windows setu
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(auto_radio_button_VK_DOWN_dialog, "IsDialogMessage(VK_DOWN)", TRUE);
|
||||
|
||||
-todo_wine
|
||||
test_radio(radio1, 1, radio2, 0, radio3, 0);
|
||||
|
||||
hwnd = GetFocus();
|
||||
-todo_wine
|
||||
ok(hwnd == radio1, "focus should be on radio1, not on %p\n", hwnd);
|
||||
GetWindowRect(radio1, &rc);
|
||||
|
||||
@@ -6470,11 +6468,9 @@ todo_wine
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(auto_radio_button_VK_DOWN_radio3, "down to radio3", TRUE);
|
||||
|
||||
-todo_wine
|
||||
test_radio(radio1, 1, radio2, 0, radio3, 0);
|
||||
|
||||
hwnd = GetFocus();
|
||||
-todo_wine
|
||||
ok(hwnd == radio1, "focus should be on radio1, not on %p\n", hwnd);
|
||||
|
||||
flush_events();
|
||||
@@ -6491,11 +6487,9 @@ todo_wine
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||
ok_sequence(auto_radio_button_VK_UP_radio1, "up to radio1", TRUE);
|
||||
|
||||
-todo_wine
|
||||
test_radio(radio1, 1, radio2, 0, radio3, 0);
|
||||
|
||||
hwnd = GetFocus();
|
||||
-todo_wine
|
||||
ok(hwnd == radio1, "focus should be on radio1, not on %p\n", hwnd);
|
||||
|
||||
flush_events();
|
||||
@@ -6513,7 +6507,6 @@ todo_wine
|
||||
if (0) /* actual message sequence is different on every run in some Windows setups */
|
||||
ok_sequence(auto_radio_button_VK_UP_dialog, "IsDialogMessage(VK_UP) #3", FALSE);
|
||||
/* what really matters is that nothing has changed */
|
||||
-todo_wine
|
||||
test_radio(radio1, 1, radio2, 0, radio3, 0);
|
||||
|
||||
log_all_parent_messages--;
|
||||
--
|
||||
2.11.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user