Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/avico.c | 72 ++++++++++++++++++++ dlls/qcap/tests/avimux.c | 109 +++++++++++++++++++++++++++++++ dlls/qcap/tests/smartteefilter.c | 45 +++++++++++++ 3 files changed, 226 insertions(+)
diff --git a/dlls/qcap/tests/avico.c b/dlls/qcap/tests/avico.c index 837c86d4039..10402897575 100644 --- a/dlls/qcap/tests/avico.c +++ b/dlls/qcap/tests/avico.c @@ -584,6 +584,77 @@ static void test_media_types(IBaseFilter *filter) IPin_Release(pin); }
+static void test_enum_media_types(IBaseFilter *filter) +{ + IEnumMediaTypes *enum1, *enum2; + AM_MEDIA_TYPE *mts[2]; + ULONG count; + HRESULT hr; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Clone(enum1, &enum2); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enum1); + IEnumMediaTypes_Release(enum2); + IPin_Release(pin); + + IBaseFilter_FindPin(filter, source_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Clone(enum1, &enum2); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enum1); + IEnumMediaTypes_Release(enum2); + IPin_Release(pin); +} + START_TEST(avico) { static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':', @@ -625,6 +696,7 @@ START_TEST(avico) test_find_pin(filter); test_pin_info(filter); test_media_types(filter); + test_enum_media_types(filter);
ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref); diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index 8218d0e5eb2..98a775433c6 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -556,6 +556,114 @@ static void test_media_types(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_enum_media_types(void) +{ + IBaseFilter *filter = create_avi_mux(); + IEnumMediaTypes *enum1, *enum2; + AM_MEDIA_TYPE *mts[2]; + ULONG ref, count; + HRESULT hr; + IPin *pin; + + IBaseFilter_FindPin(filter, source_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + CoTaskMemFree(mts[0]); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + CoTaskMemFree(mts[0]); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 2, mts, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + CoTaskMemFree(mts[0]); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Clone(enum1, &enum2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 2); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 1); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + CoTaskMemFree(mts[0]); + + IEnumMediaTypes_Release(enum1); + IEnumMediaTypes_Release(enum2); + IPin_Release(pin); + + IBaseFilter_FindPin(filter, sink0_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Clone(enum1, &enum2); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enum1); + IEnumMediaTypes_Release(enum2); + IPin_Release(pin); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_seeking(void) { IBaseFilter *filter = create_avi_mux(); @@ -700,6 +808,7 @@ START_TEST(avimux) test_find_pin(); test_pin_info(); test_media_types(); + test_enum_media_types(); test_seeking();
CoUninitialize(); diff --git a/dlls/qcap/tests/smartteefilter.c b/dlls/qcap/tests/smartteefilter.c index b3b05840aa2..361b0603d85 100644 --- a/dlls/qcap/tests/smartteefilter.c +++ b/dlls/qcap/tests/smartteefilter.c @@ -418,6 +418,50 @@ static void test_pin_info(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_enum_media_types(void) +{ + IBaseFilter *filter = create_smart_tee(); + IEnumMediaTypes *enum1, *enum2; + AM_MEDIA_TYPE *mts[2]; + ULONG ref, count; + HRESULT hr; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + + hr = IPin_EnumMediaTypes(pin, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumMediaTypes_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Clone(enum1, &enum2); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + IEnumMediaTypes_Release(enum1); + IEnumMediaTypes_Release(enum2); + IPin_Release(pin); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + typedef struct { IBaseFilter IBaseFilter_iface; LONG ref; @@ -2336,6 +2380,7 @@ START_TEST(smartteefilter) test_enum_pins(); test_find_pin(); test_pin_info(); + test_enum_media_types();
test_smart_tee_filter_aggregation(); test_smart_tee_filter();