Commit 7a772a7f authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

comctl32/tests: Flush events before testing edit control SetFocus() messages.

parent 225daac8
......@@ -54,6 +54,24 @@ struct edit_notify {
static struct edit_notify notifications;
/* try to make sure pending X events have been processed before continuing */
static void flush_events(void)
{
MSG msg;
int diff = 200;
int min_timeout = 100;
DWORD time = GetTickCount() + diff;
while (diff > 0)
{
if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT)
break;
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
DispatchMessageA(&msg);
diff = time - GetTickCount();
}
}
static INT_PTR CALLBACK multi_edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
static int num_ok_commands = 0;
......@@ -3445,6 +3463,7 @@ static void test_change_focus(void)
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
SetCursorPos(400, 400);
flush_events();
SetFocus(parent_wnd);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
......
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