[PATCH 13/18] comctl32: TaskDialog - Flush evens before testing
Fabian Maurer
dark.shadow4 at web.de
Sat Feb 25 10:01:41 CST 2017
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
dlls/comctl32/tests/taskdialog.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c
index 6d0477a5e8..de9661315c 100644
--- a/dlls/comctl32/tests/taskdialog.c
+++ b/dlls/comctl32/tests/taskdialog.c
@@ -222,6 +222,22 @@ static HRESULT CALLBACK TaskDialogCallbackProc(HWND hwnd, UINT uNotification, WP
return S_OK; /* Fallback in case we got a message mismatch */
}
+/* try to make sure pending X events have been processed before continuing - from user32 tests msg.c*/
+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();
+ }
+}
+
#define run_test( info, expect_button, expect_radio, expect_checkbox, expect_messages, send_messages ) \
run_test_( (info), (expect_button), (expect_radio), (expect_checkbox), \
(expect_messages), (send_messages), __FILE__, __LINE__)
@@ -236,6 +252,8 @@ static void run_test_(TASKDIALOGCONFIG *info, int expect_button, int expect_radi
int ret_radio = 0;
BOOL ret_checkbox = 0;
+ flush_events();
+
message_list = expect_messages;
message_send_list = send_messages;
--
2.12.0
More information about the wine-patches
mailing list