[PATCH v3 0/2] MR1245: comctl32:edit test fixes for flaky failures (message sequences)
-- v3: comctl32/tests: Flush events before testing edit control IME messages. comctl32/tests: Flush events before testing edit control SetFocus() messages. https://gitlab.winehq.org/wine/wine/-/merge_requests/1245
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/comctl32/tests/edit.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index 5f23fff2c9c..1e4f068a46a 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,12 +3463,13 @@ 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); SetFocus(hwnd); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); - ok_sequence(sequences, COMBINED_SEQ_INDEX, setfocus_combined_seq, "Set focus", TRUE); + ok_sequence(sequences, COMBINED_SEQ_INDEX, setfocus_combined_seq, "Set focus", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); SetFocus(parent_wnd); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1245
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/comctl32/tests/edit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index 1e4f068a46a..91d16e044a0 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -3641,6 +3641,7 @@ static void test_ime(void) /* Test IME messages when EIMES_GETCOMPSTRATONCE is not set */ old_proc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)edit_ime_subclass_proc); SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)old_proc); + flush_events(); himc = ImmGetContext(hwnd); ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1245
On Fri Nov 4 11:57:07 2022 +0000, Nikolay Sivov wrote:
We have flush_events() helpers duplicate across source files in comctl32/tests. Maybe we could reuse that, by moving them to msg.h? Thank you very much for your feedback. Done.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1245#note_13144
On Fri Nov 4 11:57:06 2022 +0000, Jinoh Kang wrote:
Thank you very much for your feedback. Done. Sorry for misreading your comment.
The `flush_events` functions are not exact duplicates, so I wonder if unifying the implementation would impact existing tests due to subtle differences? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1245#note_13201
On Fri Nov 4 19:24:17 2022 +0000, Jinoh Kang wrote:
Sorry for misreading your comment. The `flush_events` functions are not exact duplicates, so I wonder if unifying the implementation would impact existing tests due to subtle differences? Sure, it might. There is a number of them in user32 tests as well, so unifying with that is also useful.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1245#note_13202
This merge request was approved by Nikolay Sivov. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1245
participants (3)
-
Jinoh Kang -
Jinoh Kang (@iamahuman) -
Nikolay Sivov (@nsivov)