Commit e256e988 authored by Alexandre Julliard's avatar Alexandre Julliard

user32/tests: Fix a couple of failing menu tests.

parent d387cf32
...@@ -114,6 +114,7 @@ typedef struct ...@@ -114,6 +114,7 @@ typedef struct
/* globals to communicate between test and wndproc */ /* globals to communicate between test and wndproc */
static BOOL bMenuVisible; static BOOL bMenuVisible;
static BOOL got_input;
static HMENU hMenus[4]; static HMENU hMenus[4];
#define MOD_SIZE 10 #define MOD_SIZE 10
...@@ -211,7 +212,8 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg, ...@@ -211,7 +212,8 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg,
} }
case WM_ENTERIDLE: case WM_ENTERIDLE:
{ {
ok( lparam, "Menu window handle is NULL!\n"); ok( lparam || broken(!lparam), /* win9x, nt4 */
"Menu window handle is NULL!\n");
PostMessage(hwnd, WM_CANCELMODE, 0, 0); PostMessage(hwnd, WM_CANCELMODE, 0, 0);
return TRUE; return TRUE;
} }
...@@ -263,7 +265,7 @@ static void test_menu_locked_by_window(void) ...@@ -263,7 +265,7 @@ static void test_menu_locked_by_window(void)
ok(ret, "DrawMenuBar failed with error %d\n", GetLastError()); ok(ret, "DrawMenuBar failed with error %d\n", GetLastError());
} }
ret = IsMenu(GetMenu(hwnd)); ret = IsMenu(GetMenu(hwnd));
ok(!ret, "Menu handle should have been destroyed\n"); ok(!ret || broken(ret) /* nt4 */, "Menu handle should have been destroyed\n");
SendMessage(hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0); SendMessage(hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0);
/* did we process the WM_INITMENU message? */ /* did we process the WM_INITMENU message? */
...@@ -1830,6 +1832,8 @@ static DWORD WINAPI test_menu_input_thread(LPVOID lpParameter) ...@@ -1830,6 +1832,8 @@ static DWORD WINAPI test_menu_input_thread(LPVOID lpParameter)
{ {
int elapsed = 0; int elapsed = 0;
got_input = i && menu_tests[i-1].bMenuVisible;
if (menu_tests[i].type == INPUT_KEYBOARD) if (menu_tests[i].type == INPUT_KEYBOARD)
for (j = 0; menu_tests[i].wVk[j] != 0; j++) for (j = 0; menu_tests[i].wVk[j] != 0; j++)
send_key(menu_tests[i].wVk[j]); send_key(menu_tests[i].wVk[j]);
...@@ -1845,6 +1849,12 @@ static DWORD WINAPI test_menu_input_thread(LPVOID lpParameter) ...@@ -1845,6 +1849,12 @@ static DWORD WINAPI test_menu_input_thread(LPVOID lpParameter)
Sleep(20); Sleep(20);
} }
if (!got_input)
{
skip( "test %u: didn't receive input\n", i );
return 0;
}
if (menu_tests[i]._todo_wine) if (menu_tests[i]._todo_wine)
{ {
todo_wine { todo_wine {
...@@ -1867,6 +1877,16 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -1867,6 +1877,16 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_EXITMENULOOP: case WM_EXITMENULOOP:
bMenuVisible = FALSE; bMenuVisible = FALSE;
break; break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_MOUSEMOVE:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_NCMOUSEMOVE:
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONUP:
got_input = TRUE;
/* fall through */
default: default:
return( DefWindowProcA( hWnd, msg, wParam, lParam ) ); return( DefWindowProcA( hWnd, msg, wParam, lParam ) );
} }
......
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