Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 86 ++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 55c70702e47..6288e3095dd 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -5156,12 +5156,12 @@ static void test_set_notify_flags(void) IMediaEventEx *media_event; struct testfilter filter; LONG_PTR param1, param2; + LONG code, flags; HANDLE event; HWND window; BSTR status; HRESULT hr; ULONG ref; - LONG code; MSG msg;
window = CreateWindowA("static", NULL, WS_OVERLAPPEDWINDOW, @@ -5196,9 +5196,25 @@ static void test_set_notify_flags(void)
while (PeekMessageA(&msg, window, WM_USER, WM_USER, PM_REMOVE));
+ hr = IMediaEventEx_SetNotifyFlags(media_event, 2); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IMediaEventEx_GetNotifyFlags(media_event, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + flags = 0xdeadbeef; + hr = IMediaEventEx_GetNotifyFlags(media_event, &flags); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!flags, "Got flags %#x\n", flags); + hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY); ok(hr == S_OK, "Got hr %#x.\n", hr);
+ flags = 0xdeadbeef; + hr = IMediaEventEx_GetNotifyFlags(media_event, &flags); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(flags == AM_MEDIAEVENT_NONOTIFY, "Got flags %#x\n", flags); + todo_wine ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
hr = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 50); @@ -5249,6 +5265,11 @@ static void test_set_notify_flags(void) hr = IMediaEventEx_SetNotifyFlags(media_event, 0); ok(hr == S_OK, "Got hr %#x.\n", hr);
+ flags = 0xdeadbeef; + hr = IMediaEventEx_GetNotifyFlags(media_event, &flags); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!flags, "Got flags %#x\n", flags); + hr = IMediaControl_Stop(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMediaControl_Run(media_control); @@ -5295,6 +5316,8 @@ static void check_events_(unsigned int line, IMediaEventEx *media_event, ++ec_complete_count; if (code == EC_STATUS) ++ec_status_count; + hr = IMediaEventEx_FreeEventParams(media_event, code, param1, param2); + ok(hr == S_OK, "Got hr %#x.\n", hr); } ok(hr == E_ABORT, "Got hr %#x.\n", hr); todo_wine_if(todo) ok_(__FILE__, line)(ec_complete_count == expected_ec_complete_count, @@ -5336,9 +5359,51 @@ static void test_events(void) hr = IMediaEventEx_GetEventHandle(media_event, (OAEVENT *)&event); ok(hr == S_OK, "Got hr %#x.\n", hr);
+ code = 0xdeadbeef; + param1 = 0xdeadbeef; + param2 = 0xdeadbeef; + hr = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 0); + ok(hr == E_ABORT, "Got hr %#x.\n", hr); + ok(!code, "Got code %#x.\n", code); + todo_wine ok(!param1, "Got param1 %#Ix.\n", param1); + todo_wine ok(!param2, "Got param2 %#Ix.\n", param2); + + /* EC_COMPLETE is ignored while in stopped or paused state. */ + + hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, + (LONG_PTR)&filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + check_events(media_event, 0, 2, FALSE); + + hr = IMediaControl_Pause(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, + (LONG_PTR)&filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + check_events(media_event, 0, 2, FALSE); + hr = IMediaControl_Run(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr);
+ check_events(media_event, 0, 0, FALSE); + + /* Pausing and then running the graph clears pending EC_COMPLETE events. + * This remains true even with default handling canceled. */ + + hr = IMediaEventEx_CancelDefaultHandling(media_event, EC_COMPLETE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, @@ -5385,6 +5450,25 @@ static void test_events(void)
check_events(media_event, 1, 2, FALSE);
+ hr = IMediaControl_Run(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, + (LONG_PTR)&filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_Pause(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaControl_Run(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + check_events(media_event, 0, 2, TRUE); + + /* GetEvent() resets the event object if there are no events available. */ + SetEvent(event);
hr = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 50);