user32/tests: Flush events after showing/hiding a window to avoid z-order race conditions.

This commit is contained in:
Alexandre Julliard 2008-02-28 19:56:38 +01:00
parent c0e10d2b97
commit d2b6087999

View File

@ -2672,10 +2672,12 @@ static void test_mouse_input(HWND hwnd)
ShowWindow(hwnd, SW_HIDE);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok( !ret, "message %04x available\n", msg.message);
flush_events();
/* test mouse clicks */
ShowWindow(hwnd, SW_SHOW);
flush_events();
ShowWindow(popup, SW_SHOW);
flush_events();
@ -2685,24 +2687,32 @@ static void test_mouse_input(HWND hwnd)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
ok(PeekMessageA(&msg, 0, 0, 0, 0), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDOWN, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDOWN, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, 0), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, 0), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDBLCLK, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDBLCLK, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDBLCLK, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDBLCLK, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, 0), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
ok(!ret, "message %04x available\n", msg.message);
@ -2716,18 +2726,22 @@ static void test_mouse_input(HWND hwnd)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == hwnd && msg.message == WM_LBUTTONDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == hwnd && msg.message == WM_LBUTTONDOWN, "hwnd %p/%p message %04x\n",
msg.hwnd, hwnd, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == hwnd && msg.message == WM_LBUTTONUP, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == hwnd && msg.message == WM_LBUTTONUP, "hwnd %p/%p message %04x\n",
msg.hwnd, hwnd, msg.message);
test_lbuttondown_flag = TRUE;
SendMessageA(hwnd, WM_COMMAND, (WPARAM)popup, 0);
test_lbuttondown_flag = FALSE;
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDOWN, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONDOWN, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p message %04x\n", msg.hwnd, msg.message);
ok(msg.hwnd == popup && msg.message == WM_LBUTTONUP, "hwnd %p/%p message %04x\n",
msg.hwnd, popup, msg.message);
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
/* Test WM_MOUSEACTIVATE */
@ -3240,6 +3254,7 @@ static void test_scrolldc( HWND parent)
25, 50, 100, 100, parent, 0, 0, NULL);
ShowWindow( parent, SW_SHOW);
UpdateWindow( parent);
flush_events();
GetClientRect( hwnd1, &rc);
hdc = GetDC( hwnd1);
/* paint the upper half of the window black */