Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index a18fb9256d6..a2aa082fbbb 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -614,6 +614,16 @@ static BOOL expect_event_(IMFMediaEventGenerator *generator, MediaEventType expe return met == expected_met; }
+#define expect_no_event(a) expect_no_event_(a, __LINE__) +static void expect_no_event_(IMFMediaEventGenerator *generator, int line) +{ + MediaEventType met; + BOOL ret; + + ret = get_event_(generator, &met, NULL, line); + ok_(__FILE__, line)(!ret, "Got event %d when none was expected.\n", met); +} + static void test_source_resolver(void) { struct test_callback callback = { { &test_create_from_url_callback_vtbl } }; @@ -849,7 +859,9 @@ todo_wine }
expect_event((IMFMediaEventGenerator *)mediasource, MESourceStarted, NULL); + expect_no_event((IMFMediaEventGenerator *)mediasource); expect_event((IMFMediaEventGenerator *)video_stream, MEStreamStarted, NULL); + expect_no_event((IMFMediaEventGenerator *)video_stream);
sample_count = 10;
@@ -896,16 +908,13 @@ todo_wine
if (i == sample_count) { - IMFMediaEvent *event; - /* MEEndOfStream isn't queued until after a one request beyond the last frame is submitted */ - Sleep(100); - hr = IMFMediaEventGenerator_GetEvent((IMFMediaEventGenerator *)video_stream, MF_EVENT_FLAG_NO_WAIT, &event); - ok (hr == MF_E_NO_EVENTS_AVAILABLE, "Unexpected hr %#x.\n", hr); + expect_no_event((IMFMediaEventGenerator *)video_stream);
hr = IMFMediaStream_RequestSample(video_stream, NULL); ok (hr == S_OK || hr == MF_E_END_OF_STREAM, "Unexpected hr %#x.\n", hr); expect_event((IMFMediaEventGenerator *)video_stream, MEEndOfStream, NULL); + expect_no_event((IMFMediaEventGenerator *)video_stream); }
@@ -913,6 +922,7 @@ todo_wine ok(hr == MF_E_END_OF_STREAM, "Unexpected hr %#x.\n", hr);
expect_event((IMFMediaEventGenerator *)mediasource, MEEndOfPresentation, NULL); + expect_no_event((IMFMediaEventGenerator *)mediasource);
IMFMediaStream_Release(video_stream); IMFMediaTypeHandler_Release(handler);