Commit 85d631cf authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qcap/tests: Add some tests for IEnumMediaTypes().

parent f8b6b55c
...@@ -584,6 +584,77 @@ static void test_media_types(IBaseFilter *filter) ...@@ -584,6 +584,77 @@ static void test_media_types(IBaseFilter *filter)
IPin_Release(pin); 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) START_TEST(avico)
{ {
static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':', static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':',
...@@ -625,6 +696,7 @@ START_TEST(avico) ...@@ -625,6 +696,7 @@ START_TEST(avico)
test_find_pin(filter); test_find_pin(filter);
test_pin_info(filter); test_pin_info(filter);
test_media_types(filter); test_media_types(filter);
test_enum_media_types(filter);
ref = IBaseFilter_Release(filter); ref = IBaseFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref); ok(!ref, "Got outstanding refcount %d.\n", ref);
......
...@@ -556,6 +556,114 @@ static void test_media_types(void) ...@@ -556,6 +556,114 @@ static void test_media_types(void)
ok(!ref, "Got outstanding refcount %d.\n", ref); 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) static void test_seeking(void)
{ {
IBaseFilter *filter = create_avi_mux(); IBaseFilter *filter = create_avi_mux();
...@@ -700,6 +808,7 @@ START_TEST(avimux) ...@@ -700,6 +808,7 @@ START_TEST(avimux)
test_find_pin(); test_find_pin();
test_pin_info(); test_pin_info();
test_media_types(); test_media_types();
test_enum_media_types();
test_seeking(); test_seeking();
CoUninitialize(); CoUninitialize();
......
...@@ -418,6 +418,50 @@ static void test_pin_info(void) ...@@ -418,6 +418,50 @@ static void test_pin_info(void)
ok(!ref, "Got outstanding refcount %d.\n", ref); 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 { typedef struct {
IBaseFilter IBaseFilter_iface; IBaseFilter IBaseFilter_iface;
LONG ref; LONG ref;
...@@ -2336,6 +2380,7 @@ START_TEST(smartteefilter) ...@@ -2336,6 +2380,7 @@ START_TEST(smartteefilter)
test_enum_pins(); test_enum_pins();
test_find_pin(); test_find_pin();
test_pin_info(); test_pin_info();
test_enum_media_types();
test_smart_tee_filter_aggregation(); test_smart_tee_filter_aggregation();
test_smart_tee_filter(); test_smart_tee_filter();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment