Zebediah Figura : qedit/tests: Add some tests for IBaseFilter::EnumPins() on the sample grabber.
Alexandre Julliard
julliard at winehq.org
Mon Apr 15 16:26:41 CDT 2019
Module: wine
Branch: master
Commit: 0c52e96f59712f9de262987bb5fb45eae9c2431f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0c52e96f59712f9de262987bb5fb45eae9c2431f
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Apr 14 00:56:08 2019 -0500
qedit/tests: Add some tests for IBaseFilter::EnumPins() on the sample grabber.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/qedit/tests/samplegrabber.c | 122 +++++++++++++++++++++++++++++++++++++++
1 file changed, 122 insertions(+)
diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c
index ed774c4..b171932 100644
--- a/dlls/qedit/tests/samplegrabber.c
+++ b/dlls/qedit/tests/samplegrabber.c
@@ -93,11 +93,133 @@ static void test_interfaces(void)
ok(!ref, "Got unexpected refcount %d.\n", ref);
}
+static void test_enum_pins(void)
+{
+ IBaseFilter *filter = create_sample_grabber();
+ IEnumPins *enum1, *enum2;
+ ULONG count, ref;
+ IPin *pins[3];
+ HRESULT hr;
+
+ ref = get_refcount(filter);
+ ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+
+ hr = IBaseFilter_EnumPins(filter, NULL);
+ ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+
+ hr = IBaseFilter_EnumPins(filter, &enum1);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ref = get_refcount(filter);
+ ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+ ref = get_refcount(enum1);
+ ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+
+ hr = IEnumPins_Next(enum1, 1, NULL, NULL);
+ ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Next(enum1, 1, pins, NULL);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ref = get_refcount(filter);
+ ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+ ref = get_refcount(pins[0]);
+ ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+ ref = get_refcount(enum1);
+ ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+ IPin_Release(pins[0]);
+ ref = get_refcount(filter);
+ ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+
+ hr = IEnumPins_Next(enum1, 1, pins, NULL);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ref = get_refcount(filter);
+ ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+ ref = get_refcount(pins[0]);
+ ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+ ref = get_refcount(enum1);
+ ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+ IPin_Release(pins[0]);
+ ref = get_refcount(filter);
+ ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+
+ hr = IEnumPins_Next(enum1, 1, pins, NULL);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Reset(enum1);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Next(enum1, 1, pins, &count);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(count == 1, "Got count %u.\n", count);
+ IPin_Release(pins[0]);
+
+ hr = IEnumPins_Next(enum1, 1, pins, &count);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(count == 1, "Got count %u.\n", count);
+ IPin_Release(pins[0]);
+
+ hr = IEnumPins_Next(enum1, 1, pins, &count);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+ ok(!count, "Got count %u.\n", count);
+
+ hr = IEnumPins_Reset(enum1);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Next(enum1, 2, pins, NULL);
+ ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Next(enum1, 2, pins, &count);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(count == 2, "Got count %u.\n", count);
+ IPin_Release(pins[0]);
+ IPin_Release(pins[1]);
+
+ hr = IEnumPins_Next(enum1, 2, pins, &count);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+ ok(!count, "Got count %u.\n", count);
+
+ hr = IEnumPins_Reset(enum1);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Next(enum1, 3, pins, &count);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+ ok(count == 2, "Got count %u.\n", count);
+ IPin_Release(pins[0]);
+ IPin_Release(pins[1]);
+
+ hr = IEnumPins_Reset(enum1);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Clone(enum1, &enum2);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Skip(enum1, 3);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Skip(enum1, 2);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Skip(enum1, 1);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Next(enum1, 1, pins, NULL);
+ ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+
+ hr = IEnumPins_Next(enum2, 1, pins, NULL);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ IPin_Release(pins[0]);
+
+ IEnumPins_Release(enum2);
+ IEnumPins_Release(enum1);
+ ref = IBaseFilter_Release(filter);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+}
+
START_TEST(samplegrabber)
{
CoInitialize(NULL);
test_interfaces();
+ test_enum_pins();
CoUninitialize();
}
More information about the wine-cvs
mailing list