Commit 444b781f authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

user32: Add a test for activating a menu consisting from a single menu item using a hot key.

parent dfbf47b0
......@@ -11965,6 +11965,33 @@ static const struct message wm_popup_menu_3[] =
{ 0 }
};
static const struct message wm_single_menu_item[] =
{
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_MENU, 0x20000001 },
{ WM_SYSKEYDOWN, sent|wparam|lparam, VK_MENU, 0x20000001 },
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, 'Q', 0x20000001 },
{ WM_SYSKEYDOWN, sent|wparam|lparam, 'Q', 0x20000001 },
{ WM_SYSCHAR, sent|wparam|lparam, 'q', 0x20000001 },
{ HCBT_SYSCOMMAND, hook|wparam|lparam, SC_KEYMENU, 'q' },
{ WM_ENTERMENULOOP, sent|wparam|lparam, 0, 0 },
{ WM_INITMENU, sent|lparam, 0, 0 },
{ WM_MENUSELECT, sent|wparam|optional, MAKEWPARAM(300,MF_HILITE) },
{ WM_MENUSELECT, sent|wparam|lparam, MAKEWPARAM(0,0xffff), 0 },
{ WM_EXITMENULOOP, sent|wparam|lparam, 0, 0 },
{ WM_MENUCOMMAND, sent },
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, 'Q', 0xe0000001 },
{ WM_SYSKEYUP, sent|wparam|lparam, 'Q', 0xe0000001 },
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_MENU, 0xc0000001 },
{ WM_KEYUP, sent|wparam|lparam, VK_MENU, 0xc0000001 },
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_ESCAPE, 1 },
{ WM_KEYDOWN, sent|wparam|lparam, VK_ESCAPE, 1 },
{ WM_CHAR, sent|wparam|lparam, VK_ESCAPE, 0x00000001 },
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_ESCAPE, 0xc0000001 },
{ WM_KEYUP, sent|wparam|lparam, VK_ESCAPE, 0xc0000001 },
{ 0 }
};
static LRESULT WINAPI parent_menu_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
{
if (message == WM_ENTERIDLE ||
......@@ -12123,6 +12150,21 @@ static void test_menu_messages(void)
}
ok_sequence(wm_popup_menu_2, "submenu of a popup menu command", FALSE);
trace("testing single menu item command\n");
flush_sequence();
keybd_event(VK_MENU, 0, 0, 0);
keybd_event('Q', 0, 0, 0);
keybd_event('Q', 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_ESCAPE, 0, 0, 0);
keybd_event(VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0);
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
ok_sequence(wm_single_menu_item, "single menu item command", TRUE);
set_menu_style(hmenu, 0);
style = get_menu_style(hmenu);
ok(style == 0, "expected 0, got %u\n", style);
......
......@@ -190,4 +190,5 @@ FONT 8, "MS Shell Dlg"
MENUITEM "&Paste", 203
MENUITEM "&Delete", 204
}
MENUITEM "&Quit", 300
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment