Zebediah Figura : qcap/tests: Test (dis)connecting while not stopped.

Alexandre Julliard julliard at winehq.org
Thu Nov 19 16:10:23 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Nov 19 11:19:34 2020 -0600

qcap/tests: Test (dis)connecting while not stopped.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/qcap/tests/filewriter.c     | 14 ++++++++++++++
 dlls/qcap/tests/smartteefilter.c | 37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/dlls/qcap/tests/filewriter.c b/dlls/qcap/tests/filewriter.c
index e3bdcb76560..d6dbc3faded 100644
--- a/dlls/qcap/tests/filewriter.c
+++ b/dlls/qcap/tests/filewriter.c
@@ -768,6 +768,13 @@ static void test_connect_pin(void)
     hr = IPin_ConnectionMediaType(pin, &mt);
     ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
 
+    hr = IMediaControl_Pause(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    hr = IMediaControl_Stop(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
     ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
     req_mt.majortype = MEDIATYPE_Stream;
@@ -783,6 +790,13 @@ static void test_connect_pin(void)
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ok(!memcmp(&mt, &req_mt, sizeof(AM_MEDIA_TYPE)), "Media types didn't match.\n");
 
+    hr = IMediaControl_Pause(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    hr = IFilterGraph2_Disconnect(graph, pin);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    hr = IMediaControl_Stop(control);
+    todo_wine ok(hr == VFW_E_NO_ALLOCATOR, "Got hr %#x.\n", hr);
+
     CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
             &IID_IMemAllocator, (void **)&allocator);
 
diff --git a/dlls/qcap/tests/smartteefilter.c b/dlls/qcap/tests/smartteefilter.c
index 1364beef161..1019fd3c1ba 100644
--- a/dlls/qcap/tests/smartteefilter.c
+++ b/dlls/qcap/tests/smartteefilter.c
@@ -2519,7 +2519,7 @@ static void test_source_media_types(AM_MEDIA_TYPE req_mt, const AM_MEDIA_TYPE *s
 }
 
 static void test_source_connection(AM_MEDIA_TYPE req_mt, IFilterGraph2 *graph,
-        struct testfilter *testsink, IPin *source)
+        IMediaControl *control, struct testfilter *testsink, IPin *source)
 {
     const AM_MEDIA_TYPE sink_mt = req_mt;
     AM_MEDIA_TYPE mt;
@@ -2536,6 +2536,13 @@ static void test_source_connection(AM_MEDIA_TYPE req_mt, IFilterGraph2 *graph,
 
     /* Exact connection. */
 
+    hr = IMediaControl_Pause(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &req_mt);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    hr = IMediaControl_Stop(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &req_mt);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
@@ -2549,6 +2556,13 @@ static void test_source_connection(AM_MEDIA_TYPE req_mt, IFilterGraph2 *graph,
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
     ok(compare_media_types(&testsink->sink.pin.mt, &req_mt), "Media types didn't match.\n");
 
+    hr = IMediaControl_Pause(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    hr = IFilterGraph2_Disconnect(graph, source);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    hr = IMediaControl_Stop(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
     hr = IFilterGraph2_Disconnect(graph, source);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
@@ -2662,6 +2676,7 @@ static void test_connect_pin(void)
     IPin *sink, *capture, *preview, *peer;
     AM_MEDIA_TYPE mt, *mts[3];
     IEnumMediaTypes *enummt;
+    IMediaControl *control;
     IFilterGraph2 *graph;
     HRESULT hr;
     ULONG ref;
@@ -2673,6 +2688,7 @@ static void test_connect_pin(void)
     IFilterGraph2_AddFilter(graph, &testsource.filter.IBaseFilter_iface, L"source");
     IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink");
     IFilterGraph2_AddFilter(graph, filter, L"sample grabber");
+    IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
     IBaseFilter_FindPin(filter, L"Input", &sink);
     IBaseFilter_FindPin(filter, L"Capture", &capture);
     IBaseFilter_FindPin(filter, L"Preview", &preview);
@@ -2709,6 +2725,13 @@ static void test_connect_pin(void)
     hr = IPin_ConnectionMediaType(sink, &mt);
     ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
 
+    hr = IMediaControl_Pause(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    hr = IMediaControl_Stop(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
@@ -2729,8 +2752,15 @@ static void test_connect_pin(void)
 
     test_source_media_types(req_mt, &testsource.source_mt, capture);
     test_source_media_types(req_mt, &testsource.source_mt, preview);
-    test_source_connection(req_mt, graph, &testsink, capture);
-    test_source_connection(req_mt, graph, &testsink, preview);
+    test_source_connection(req_mt, graph, control, &testsink, capture);
+    test_source_connection(req_mt, graph, control, &testsink, preview);
+
+    hr = IMediaControl_Pause(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    hr = IFilterGraph2_Disconnect(graph, sink);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    hr = IMediaControl_Stop(control);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IFilterGraph2_Disconnect(graph, sink);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -2750,6 +2780,7 @@ static void test_connect_pin(void)
     IPin_Release(sink);
     IPin_Release(capture);
     IPin_Release(preview);
+    IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
     ok(!ref, "Got outstanding refcount %d.\n", ref);
     ref = IBaseFilter_Release(filter);




More information about the wine-cvs mailing list