From b1ffe12e43908ea1a78cce09b25ab6b986216b6a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 29 Jun 2019 13:43:47 -0500 Subject: [PATCH] qedit/tests: Add some tests for media types. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/qedit/tests/nullrenderer.c | 28 ++++++++++++++++++++++++++ dlls/qedit/tests/samplegrabber.c | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/dlls/qedit/tests/nullrenderer.c b/dlls/qedit/tests/nullrenderer.c index d39b28d5779..3d5221b0a9e 100644 --- a/dlls/qedit/tests/nullrenderer.c +++ b/dlls/qedit/tests/nullrenderer.c @@ -352,6 +352,33 @@ static void test_aggregation(void) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); } +static void test_media_types(void) +{ + IBaseFilter *filter = create_null_renderer(); + AM_MEDIA_TYPE mt = {}, *pmt; + IEnumMediaTypes *enummt; + HRESULT hr; + ULONG ref; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enummt); + + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPin_Release(pin); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(nullrenderer) { IBaseFilter *filter; @@ -373,6 +400,7 @@ START_TEST(nullrenderer) test_find_pin(); test_pin_info(); test_aggregation(); + test_media_types(); CoUninitialize(); } diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c index 8bc44b9c22f..9bb4eb4f01c 100644 --- a/dlls/qedit/tests/samplegrabber.c +++ b/dlls/qedit/tests/samplegrabber.c @@ -449,6 +449,39 @@ static void test_aggregation(void) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); } +static void test_media_types(void) +{ + IBaseFilter *filter = create_sample_grabber(); + IEnumMediaTypes *enummt; + AM_MEDIA_TYPE mt = {}; + HRESULT hr; + ULONG ref; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPin_Release(pin); + + IBaseFilter_FindPin(filter, source_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enummt); + todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr); + + hr = IPin_QueryAccept(pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPin_Release(pin); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(samplegrabber) { IBaseFilter *filter; @@ -470,6 +503,7 @@ START_TEST(samplegrabber) test_find_pin(); test_pin_info(); test_aggregation(); + test_media_types(); CoUninitialize(); }