Anton Baskanov : quartz/tests: Add tests for IBaseFilter_EnumPins() on MPEG audio decoder.

Alexandre Julliard julliard at winehq.org
Mon Apr 25 16:30:35 CDT 2022


Module: wine
Branch: master
Commit: 4e311ec13ad742768f18fbba3f7c33dcc19121d0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4e311ec13ad742768f18fbba3f7c33dcc19121d0

Author: Anton Baskanov <baskanov at gmail.com>
Date:   Mon Apr 25 14:32:10 2022 +0700

quartz/tests: Add tests for IBaseFilter_EnumPins() on MPEG audio decoder.

Signed-off-by: Anton Baskanov <baskanov at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/tests/mpegaudio.c | 129 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)

diff --git a/dlls/quartz/tests/mpegaudio.c b/dlls/quartz/tests/mpegaudio.c
index 9dac3645041..3cf4afd9ca4 100644
--- a/dlls/quartz/tests/mpegaudio.c
+++ b/dlls/quartz/tests/mpegaudio.c
@@ -274,6 +274,134 @@ static void test_unconnected_filter_state(void)
     ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
+static void test_enum_pins(void)
+{
+    IBaseFilter *filter;
+    IEnumPins *enum1, *enum2;
+    ULONG count, ref;
+    IPin *pins[3];
+    HRESULT hr;
+
+    filter = create_mpeg_audio_codec();
+    if (!filter)
+    {
+        skip("Failed to create MPEG audio decoder instance, skipping tests.\n");
+        return;
+    }
+
+    ref = get_refcount(filter);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+
+    hr = IBaseFilter_EnumPins(filter, NULL);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
+
+    hr = IBaseFilter_EnumPins(filter, &enum1);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ref = get_refcount(filter);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ref = get_refcount(enum1);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+
+    hr = IEnumPins_Next(enum1, 1, NULL, NULL);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Next(enum1, 1, pins, NULL);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ref = get_refcount(filter);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
+    ref = get_refcount(pins[0]);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
+    ref = get_refcount(enum1);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    IPin_Release(pins[0]);
+    ref = get_refcount(filter);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+
+    hr = IEnumPins_Next(enum1, 1, pins, NULL);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ref = get_refcount(filter);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
+    ref = get_refcount(pins[0]);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
+    ref = get_refcount(enum1);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    IPin_Release(pins[0]);
+    ref = get_refcount(filter);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+
+    hr = IEnumPins_Next(enum1, 1, pins, NULL);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Reset(enum1);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Next(enum1, 1, pins, &count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
+    IPin_Release(pins[0]);
+
+    hr = IEnumPins_Next(enum1, 1, pins, &count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
+    IPin_Release(pins[0]);
+
+    hr = IEnumPins_Next(enum1, 1, pins, &count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
+
+    hr = IEnumPins_Reset(enum1);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Next(enum1, 2, pins, NULL);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Next(enum1, 2, pins, &count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
+    IPin_Release(pins[0]);
+    IPin_Release(pins[1]);
+
+    hr = IEnumPins_Next(enum1, 2, pins, &count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
+
+    hr = IEnumPins_Reset(enum1);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Next(enum1, 3, pins, &count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
+    IPin_Release(pins[0]);
+    IPin_Release(pins[1]);
+
+    hr = IEnumPins_Reset(enum1);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Clone(enum1, &enum2);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Skip(enum1, 3);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Skip(enum1, 2);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Skip(enum1, 1);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Next(enum1, 1, pins, NULL);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+
+    hr = IEnumPins_Next(enum2, 1, pins, NULL);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    IPin_Release(pins[0]);
+
+    IEnumPins_Release(enum2);
+    IEnumPins_Release(enum1);
+    ref = IBaseFilter_Release(filter);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+}
+
 START_TEST(mpegaudio)
 {
     CoInitialize(NULL);
@@ -281,6 +409,7 @@ START_TEST(mpegaudio)
     test_interfaces();
     test_aggregation();
     test_unconnected_filter_state();
+    test_enum_pins();
 
     CoUninitialize();
 }




More information about the wine-cvs mailing list