Commit aa8e69a6 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

parent 2945f467
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment