Module: wine Branch: master Commit: 7a772a7feb69c0fb0a6e24ac0471fb03b31e8f3c URL: https://gitlab.winehq.org/wine/wine/-/commit/7a772a7feb69c0fb0a6e24ac0471fb0...
Author: Jinoh Kang jinoh.kang.kr@gmail.com Date: Fri Nov 4 00:31:26 2022 +0900
comctl32/tests: Flush events before testing edit control SetFocus() messages.
---
dlls/comctl32/tests/edit.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index 5f23fff2c9c..ccdeed95d92 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -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);