[PATCH 2/5] quartz/tests: Test (dis)connecting while not stopped.
Zebediah Figura
z.figura12 at gmail.com
Wed Nov 18 18:43:50 CST 2020
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/quartz/tests/avidec.c | 34 +++++++++++++++++++++++++++++++
dlls/quartz/tests/avisplit.c | 28 +++++++++++++++++++++++++
dlls/quartz/tests/dsoundrender.c | 14 +++++++++++++
dlls/quartz/tests/filesource.c | 17 ++++++++++++++++
dlls/quartz/tests/mpegsplit.c | 28 +++++++++++++++++++++++++
dlls/quartz/tests/videorenderer.c | 14 +++++++++++++
dlls/quartz/tests/vmr7.c | 10 +++++++++
dlls/quartz/tests/vmr9.c | 10 +++++++++
8 files changed, 155 insertions(+)
diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c
index 9505bfb591d..ddfe22ed797 100644
--- a/dlls/quartz/tests/avidec.c
+++ b/dlls/quartz/tests/avidec.c
@@ -104,8 +104,13 @@ static LRESULT CALLBACK vfw_driver_proc(DWORD_PTR id, HDRVR driver, UINT msg,
}
case ICM_DECOMPRESS_GET_PALETTE:
+ case ICM_DECOMPRESS_SET_PALETTE:
return ICERR_UNSUPPORTED;
+ case ICM_DECOMPRESS_BEGIN:
+ case ICM_DECOMPRESS_END:
+ return ICERR_OK;
+
case ICM_GETINFO:
{
ICINFO *info = (ICINFO *)lparam1;
@@ -950,6 +955,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);
+ todo_wine 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);
+
req_mt.subtype = MEDIASUBTYPE_RGB24;
hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
@@ -969,6 +981,13 @@ static void test_connect_pin(void)
ok(compare_media_types(&testsource.source.pin.mt, &req_mt), "Media types didn't match.\n");
FreeMediaType(&mt);
+ 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);
+
sink_bih = req_format.bmiHeader;
hr = IPin_EnumMediaTypes(source, &enummt);
@@ -1061,6 +1080,14 @@ static void test_connect_pin(void)
/* Exact connection. */
CopyMediaType(&req_mt, &source_mt);
+
+ 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);
@@ -1075,6 +1102,13 @@ static void test_connect_pin(void)
ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
FreeMediaType(&mt);
+ 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);
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c
index 644807dc32f..c5af19b5aff 100644
--- a/dlls/quartz/tests/avisplit.c
+++ b/dlls/quartz/tests/avisplit.c
@@ -1110,6 +1110,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);
+
req_mt.majortype = MEDIATYPE_Video;
hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
@@ -1133,6 +1140,13 @@ static void test_connect_pin(void)
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
ok(compare_media_types(&testsource.source.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, 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);
+
/* Test source connection. */
IBaseFilter_FindPin(filter, L"Stream 00", &source);
@@ -1152,6 +1166,13 @@ static void test_connect_pin(void)
IEnumMediaTypes_Release(enummt);
CopyMediaType(&req_mt, source_mt);
+ 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);
@@ -1167,6 +1188,13 @@ static void test_connect_pin(void)
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);
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c
index 9aa9a796c9f..5142ca2da6d 100644
--- a/dlls/quartz/tests/dsoundrender.c
+++ b/dlls/quartz/tests/dsoundrender.c
@@ -880,6 +880,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 == S_OK, "Got hr %#x.\n", hr);
@@ -892,6 +899,13 @@ static void test_connect_pin(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
+ hr = IMediaControl_Pause(control);
+ ok(hr == S_FALSE, "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);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
test_allocator(input);
diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c
index b50b06dc10f..4162e248937 100644
--- a/dlls/quartz/tests/filesource.c
+++ b/dlls/quartz/tests/filesource.c
@@ -1296,6 +1296,7 @@ static void test_connect_pin(void)
AM_MEDIA_TYPE mt, *source_mt;
struct testsink testsink;
IEnumMediaTypes *enummt;
+ IMediaControl *control;
IFilterGraph2 *graph;
IPin *source, *peer;
BYTE my_format = 1;
@@ -1308,6 +1309,7 @@ static void test_connect_pin(void)
&IID_IFilterGraph2, (void **)&graph);
IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink");
IFilterGraph2_AddFilter(graph, filter, L"file source");
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
load_file(filter, filename);
IBaseFilter_FindPin(filter, L"Output", &source);
@@ -1325,6 +1327,13 @@ static void test_connect_pin(void)
/* Test exact connection. */
+ hr = IMediaControl_Pause(control);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.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.pin.pin.IPin_iface, &req_mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1338,6 +1347,13 @@ static void test_connect_pin(void)
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
ok(compare_media_types(&testsink.pin.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);
@@ -1449,6 +1465,7 @@ static void test_connect_pin(void)
CoTaskMemFree(source_mt);
IPin_Release(source);
+ IMediaControl_Release(control);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IBaseFilter_Release(filter);
diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c
index f8a0ac56356..26e2d06314c 100644
--- a/dlls/quartz/tests/mpegsplit.c
+++ b/dlls/quartz/tests/mpegsplit.c
@@ -1348,6 +1348,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);
+
req_mt.majortype = MEDIATYPE_Video;
hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
@@ -1371,6 +1378,13 @@ static void test_connect_pin(void)
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
ok(compare_media_types(&testsource.source.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, 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);
+
/* Test source connection. */
IBaseFilter_FindPin(filter, L"Audio", &source);
@@ -1390,6 +1404,13 @@ static void test_connect_pin(void)
IEnumMediaTypes_Release(enummt);
CopyMediaType(&req_mt, source_mt);
+ 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);
@@ -1403,6 +1424,13 @@ static void test_connect_pin(void)
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);
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index f84d553f2aa..ffe370acf43 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -1378,6 +1378,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 == S_OK, "Got hr %#x.\n", hr);
@@ -1390,6 +1397,13 @@ static void test_connect_pin(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
+ hr = IMediaControl_Pause(control);
+ ok(hr == S_FALSE, "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);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
test_allocator(input);
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c
index 0a72cbb9b74..d7daa6deed5 100644
--- a/dlls/quartz/tests/vmr7.c
+++ b/dlls/quartz/tests/vmr7.c
@@ -1425,6 +1425,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 == S_OK, "Got hr %#x.\n", hr);
@@ -1437,6 +1444,9 @@ static void test_connect_pin(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
+ /* Disconnecting while not stopped is broken: it returns S_OK, but
+ * subsequent attempts to connect return VFW_E_ALREADY_CONNECTED. */
+
IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
test_allocator(input);
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 7b470c6e534..f88c43b07b5 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -1635,6 +1635,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 == S_OK, "Got hr %#x.\n", hr);
@@ -1647,6 +1654,9 @@ static void test_connect_pin(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
+ /* Disconnecting while not stopped is broken: it returns S_OK, but
+ * subsequent attempts to connect return VFW_E_ALREADY_CONNECTED. */
+
test_allocator(input);
hr = IMemInputPin_GetAllocator(input, &allocator);
--
2.29.2
More information about the wine-devel
mailing list