https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1321c802fc9a34f007e3c…
commit 1321c802fc9a34f007e3cee96ff4d9d0e212c03e
Author: Roy Tam <roytam(a)gmail.com>
AuthorDate: Sat Jan 21 21:05:28 2023 +0800
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Sun Jan 22 22:18:11 2023 +0300
[USER32_WINETEST] Add test for WM_CONTEXTMENU from grandchild window
Cherry-picked from
https://github.com/wine-mirror/wine/commit/3af8415ca9dc50e6c394c1001aad97db…
---
modules/rostests/winetests/user32/msg.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/modules/rostests/winetests/user32/msg.c
b/modules/rostests/winetests/user32/msg.c
index ecc63baf6f7..6249c6f178d 100644
--- a/modules/rostests/winetests/user32/msg.c
+++ b/modules/rostests/winetests/user32/msg.c
@@ -112,6 +112,7 @@ typedef struct
} MEASURE_ITEM_STRUCT;
static BOOL test_DestroyWindow_flag;
+static BOOL test_context_menu;
static HWINEVENTHOOK hEvent_hook;
static HHOOK hKBD_hook;
static HHOOK hCBT_hook;
@@ -9514,7 +9515,7 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message,
return 0;
}
- if (message == WM_CONTEXTMENU)
+ if (!test_context_menu && message == WM_CONTEXTMENU)
{
/* don't create context menu */
return 0;
@@ -15506,6 +15507,13 @@ static const struct message WmRestoreMinimizedOverlappedSeq[] =
{ 0 }
};
+static struct message WmContextMenuSeq[] = {
+ { WM_CONTEXTMENU, sent|wparam, 0 }, /* wparams set in the code */
+ { WM_CONTEXTMENU, sent|wparam|defwinproc, 0 },
+ { WM_CONTEXTMENU, sent|wparam|defwinproc, 0 },
+ { 0 }
+};
+
struct rbuttonup_thread_data
{
HWND hwnd;
@@ -15527,7 +15535,7 @@ static DWORD CALLBACK post_rbuttonup_msg( void *arg )
static void test_defwinproc(void)
{
- HWND hwnd;
+ HWND hwnd, child[3];
MSG msg;
BOOL gotwmquit = FALSE;
POINT pos;
@@ -15569,6 +15577,23 @@ static void test_defwinproc(void)
ok_sequence(WmRestoreMinimizedOverlappedSeq,
"DefWindowProcA(SC_RESTORE):overlapped", TRUE);
flush_sequence();
+ child[0] = CreateWindowExA(0, "TestWindowClass", "1st child",
+ WS_VISIBLE | WS_CHILD, 0,0,500,100, hwnd, 0, 0, NULL);
+ child[1] = CreateWindowExA(0, "TestWindowClass", "2nd child",
+ WS_VISIBLE | WS_CHILD, 0,0,500,100, child[0], 0, 0,
NULL);
+ child[2] = CreateWindowExA(0, "TestWindowClass", "3rd child",
+ WS_VISIBLE | WS_CHILD, 0,0,500,100, child[1], 0, 0,
NULL);
+ flush_events();
+ flush_sequence();
+ test_context_menu = TRUE;
+ DefWindowProcA(child[2], WM_CONTEXTMENU, 0xcafe, 0);
+ test_context_menu = FALSE;
+ WmContextMenuSeq[0].wParam = (WPARAM)child[2];
+ WmContextMenuSeq[1].wParam = (WPARAM)child[1];
+ WmContextMenuSeq[2].wParam = (WPARAM)child[0];
+ ok_sequence(WmContextMenuSeq, "DefWindowProcA(WM_CONTEXTMENU)", FALSE);
+ DestroyWindow(child[0]);
+
GetCursorPos(&pos);
GetWindowRect(hwnd, &rect);
x = (rect.left+rect.right) / 2;