Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/qedit/tests/nullrenderer.c | 104 ++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+)
diff --git a/dlls/qedit/tests/nullrenderer.c b/dlls/qedit/tests/nullrenderer.c index 1800f4dad4c..b4003f43cf4 100644 --- a/dlls/qedit/tests/nullrenderer.c +++ b/dlls/qedit/tests/nullrenderer.c @@ -32,6 +32,15 @@ static IBaseFilter *create_null_renderer(void) return filter; }
+static IFilterGraph2 *create_graph(void) +{ + IFilterGraph2 *ret; + HRESULT hr; + hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret); + ok(hr == S_OK, "Failed to create FilterGraph: %#x\n", hr); + return ret; +} + static ULONG get_refcount(void *iface) { IUnknown *unknown = iface; @@ -791,6 +800,34 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) IMediaControl_Release(control); }
+static unsigned int check_event_code(IMediaEvent *eventsrc, DWORD timeout, LONG expected_code, LONG_PTR expected1, LONG_PTR expected2) +{ + LONG_PTR param1, param2; + unsigned int ret = 0; + HRESULT hr; + LONG code; + + while ((hr = IMediaEvent_GetEvent(eventsrc, &code, ¶m1, ¶m2, timeout)) == S_OK) + { + if (code == expected_code) + { + ok(param1 == expected1, "Got param1 %#lx.\n", param1); + ok(param2 == expected2, "Got param2 %#lx.\n", param2); + ret++; + } + IMediaEvent_FreeEventParams(eventsrc, code, param1, param2); + timeout = 0; + } + ok(hr == E_ABORT, "Got hr %#x.\n", hr); + + return ret; +} + +static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout) +{ + return check_event_code(eventsrc, timeout, EC_COMPLETE, S_OK, 0); +} + static void test_connect_pin(void) { static const AM_MEDIA_TYPE req_mt = @@ -900,6 +937,72 @@ static void test_connect_pin(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_unconnected_eos(void) +{ + IBaseFilter *filter = create_null_renderer(); + IFilterGraph2 *graph = create_graph(); + IMediaControl *control; + IMediaEvent *eventsrc; + unsigned int ret; + HRESULT hr; + ULONG ref; + + hr = IFilterGraph2_AddFilter(graph, filter, L"renderer"); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ret = check_ec_complete(eventsrc, 0); + ok(!ret, "Got %u EC_COMPLETE events.\n", ret); + + hr = IMediaControl_Pause(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ret = check_ec_complete(eventsrc, 0); + ok(!ret, "Got %u EC_COMPLETE events.\n", ret); + + hr = IMediaControl_Run(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ret = check_ec_complete(eventsrc, 0); + todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret); + + hr = IMediaControl_Pause(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ret = check_ec_complete(eventsrc, 0); + ok(!ret, "Got %u EC_COMPLETE events.\n", ret); + + hr = IMediaControl_Run(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ret = check_ec_complete(eventsrc, 0); + todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret); + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ret = check_ec_complete(eventsrc, 0); + ok(!ret, "Got %u EC_COMPLETE events.\n", ret); + + hr = IMediaControl_Run(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ret = check_ec_complete(eventsrc, 0); + todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret); + + IMediaControl_Release(control); + IMediaEvent_Release(eventsrc); + ref = IFilterGraph2_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(nullrenderer) { IBaseFilter *filter; @@ -924,6 +1027,7 @@ START_TEST(nullrenderer) test_media_types(); test_enum_media_types(); test_connect_pin(); + test_unconnected_eos();
CoUninitialize(); }