From: Zebediah Figura Subject: [PATCH] quartz/tests: Avoid some test failures related to timing. Message-Id: <20201124045920.1256448-1-z.figura12@gmail.com> Date: Mon, 23 Nov 2020 22:59:20 -0600 Signed-off-by: Zebediah Figura --- dlls/quartz/tests/vmr7.c | 11 ++++++++--- dlls/quartz/tests/vmr9.c | 17 +++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index d7daa6deed5..fd39945b2e3 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -1181,7 +1181,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control thread = send_frame(input); ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); - hr = IMediaControl_GetState(control, 0, &state); + hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IPin_BeginFlush(pin); @@ -1201,10 +1201,15 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control hr = IMediaControl_GetState(control, 0, &state); todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %#x.\n", state); thread = send_frame(input); ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %#x.\n", state); + hr = IMediaControl_Run(control); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = join_thread(thread); @@ -2108,8 +2113,8 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our params.message = WM_SYSCOLORCHANGE; thread = CreateThread(NULL, 0, notify_message_proc, ¶ms, 0, NULL); ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block.\n"); - ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE); - ok(ret == ((QS_SENDMESSAGE << 16) | QS_SENDMESSAGE), "Got unexpected status %#x.\n", ret); + ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 1000, QS_SENDMESSAGE); + ok(!ret, "Did not find a sent message.\n"); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok(!WaitForSingleObject(thread, 1000), "Wait timed out.\n"); diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index f88c43b07b5..8b46e4706a5 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -1220,10 +1220,15 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control hr = IMediaControl_GetState(control, 0, &state); todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %#x.\n", state); thread = send_frame(input); ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %#x.\n", state); + hr = IMediaControl_Run(control); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = join_thread(thread); @@ -1432,18 +1437,14 @@ static void test_sample_time(IPin *pin, IMemInputPin *input, IMediaControl *cont hr = join_thread(send_frame_time(input, -2, 0x00ff0000)); /* red */ ok(hr == S_OK, "Got hr %#x.\n", hr); - thread = send_frame_time(input, 2, 0x00ff00ff); /* magenta */ - ok(WaitForSingleObject(thread, 500) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); - hr = join_thread(thread); - ok(hr == S_OK, "Got hr %#x.\n", hr); - thread = send_frame_time(input, 1000000, 0x00ffffff); /* white */ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); hr = IPin_BeginFlush(pin); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = join_thread(thread); - ok(hr == S_OK, "Got hr %#x.\n", hr); + /* If the frame makes it to Receive() in time to be rendered, we get S_OK. */ + ok(hr == S_OK || hr == S_FALSE, "Got hr %#x.\n", hr); hr = IPin_EndFlush(pin); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -2351,8 +2352,8 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our params.message = WM_SYSCOLORCHANGE; thread = CreateThread(NULL, 0, notify_message_proc, ¶ms, 0, NULL); ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block.\n"); - ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE); - ok(ret == ((QS_SENDMESSAGE << 16) | QS_SENDMESSAGE), "Got unexpected status %#x.\n", ret); + ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 1000, QS_SENDMESSAGE); + ok(!ret, "Did not find a sent message.\n"); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok(!WaitForSingleObject(thread, 1000), "Wait timed out.\n"); -- 2.29.2