diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c index 3e4cf93..fab7539 100644 --- a/dlls/user32/tests/menu.c +++ b/dlls/user32/tests/menu.c @@ -120,8 +120,11 @@ typedef struct static BOOL bMenuVisible; static INT popmenu; static BOOL got_input; +static BOOL got_last_input; static HMENU hMenus[4]; +#define WM_LAST_INPUT (WM_USER + 1) + #define MOD_SIZE 10 #define MOD_NRMENUS 8 @@ -2113,6 +2116,7 @@ static DWORD WINAPI test_menu_input_thread(LPVOID lpParameter) int ret = TRUE, elapsed = 0; got_input = i && menu_tests[i-1].bMenuVisible; + got_last_input = FALSE; if (menu_tests[i].type == INPUT_KEYBOARD) for (j = 0; menu_tests[i].wVk[j] != 0; j++) @@ -2121,19 +2125,19 @@ static DWORD WINAPI test_menu_input_thread(LPVOID lpParameter) for (j = 0; menu_tests[i].menu_item_pairs[j].uMenu != 0; j++) if (!(ret = click_menu(hWnd, &menu_tests[i].menu_item_pairs[j]))) break; + PostMessage( hWnd, WM_LAST_INPUT, 0, 0); if (!ret) { skip( "test %u: failed to send input\n", i ); PostMessage( hWnd, WM_CANCELMODE, 0, 0 ); return 0; } - while (menu_tests[i].bMenuVisible != bMenuVisible) - { + do { if (elapsed > 200) break; elapsed += 20; Sleep(20); - } + } while (!got_last_input); if (!got_input) { @@ -2166,6 +2170,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, case WM_EXITMENULOOP: case WM_MENUSELECT: break; + case WM_LAST_INPUT: + got_last_input = TRUE; + break; case WM_KEYDOWN: case WM_SYSKEYDOWN: