[PATCH 6/7] qedit/tests: Add some tests for IBaseFilter::FindPin() on the sample grabber.

Zebediah Figura z.figura12 at gmail.com
Sun Apr 14 00:56:09 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/qedit/tests/samplegrabber.c | 43 ++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c
index b171932174..094ef317c0 100644
--- a/dlls/qedit/tests/samplegrabber.c
+++ b/dlls/qedit/tests/samplegrabber.c
@@ -23,6 +23,11 @@
 #include "qedit.h"
 #include "wine/test.h"
 
+static const WCHAR sink_id[] = {'I','n',0};
+static const WCHAR source_id[] = {'O','u','t',0};
+static const WCHAR sink_name[] = {'I','n','p','u','t',0};
+static const WCHAR source_name[] = {'O','u','t','p','u','t',0};
+
 static IBaseFilter *create_sample_grabber(void)
 {
     IBaseFilter *filter = NULL;
@@ -214,12 +219,50 @@ static void test_enum_pins(void)
     ok(!ref, "Got outstanding refcount %d.\n", ref);
 }
 
+static void test_find_pin(void)
+{
+    IBaseFilter *filter = create_sample_grabber();
+    IEnumPins *enum_pins;
+    IPin *pin, *pin2;
+    HRESULT hr;
+    ULONG ref;
+
+    hr = IBaseFilter_FindPin(filter, sink_name, &pin);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    hr = IBaseFilter_FindPin(filter, source_name, &pin);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+
+    hr = IBaseFilter_EnumPins(filter, &enum_pins);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IBaseFilter_FindPin(filter, sink_id, &pin);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(pin2 == pin, "Expected pin %p, got %p.\n", pin, pin2);
+    IPin_Release(pin2);
+    IPin_Release(pin);
+
+    hr = IBaseFilter_FindPin(filter, source_id, &pin);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(pin2 == pin, "Expected pin %p, got %p.\n", pin, pin2);
+    IPin_Release(pin2);
+    IPin_Release(pin);
+
+    IEnumPins_Release(enum_pins);
+    ref = IBaseFilter_Release(filter);
+    ok(!ref, "Got outstanding refcount %d.\n", ref);
+}
+
 START_TEST(samplegrabber)
 {
     CoInitialize(NULL);
 
     test_interfaces();
     test_enum_pins();
+    test_find_pin();
 
     CoUninitialize();
 }
-- 
2.21.0




More information about the wine-devel mailing list