quartz/tests: Add a test for IGraphBuilder_Connect().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-02-27 00:01:28 -06:00 committed by Alexandre Julliard
parent e5db13a8c8
commit 6c0954d60f
1 changed files with 45 additions and 0 deletions

View File

@ -431,6 +431,49 @@ static void rungraph(IFilterGraph2 *graph)
ok(hr==1, "Releasing mediacontrol returned: %x\n", hr); ok(hr==1, "Releasing mediacontrol returned: %x\n", hr);
} }
static void test_graph_builder_connect(WCHAR *filename)
{
static const WCHAR outputW[] = {'O','u','t','p','u','t',0};
static const WCHAR inW[] = {'I','n',0};
IBaseFilter *source_filter, *video_filter;
IPin *pin_in, *pin_out;
IFilterGraph2 *graph;
IVideoWindow *window;
HRESULT hr;
graph = create_graph();
hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, &IID_IVideoWindow, (void **)&window);
ok(hr == S_OK, "Failed to create VideoRenderer: %#x\n", hr);
hr = IFilterGraph2_AddSourceFilter(graph, filename, NULL, &source_filter);
ok(hr == S_OK, "AddSourceFilter failed: %#x\n", hr);
hr = IVideoWindow_QueryInterface(window, &IID_IBaseFilter, (void **)&video_filter);
ok(hr == S_OK, "QueryInterface(IBaseFilter) failed: %#x\n", hr);
hr = IFilterGraph2_AddFilter(graph, video_filter, NULL);
ok(hr == S_OK, "AddFilter failed: %#x\n", hr);
hr = IBaseFilter_FindPin(source_filter, outputW, &pin_out);
ok(hr == S_OK, "FindPin failed: %#x\n", hr);
hr = IBaseFilter_FindPin(video_filter, inW, &pin_in);
ok(hr == S_OK, "FindPin failed: %#x\n", hr);
hr = IFilterGraph2_Connect(graph, pin_out, pin_in);
if (hr != VFW_E_NO_ACCEPTABLE_TYPES)
{
ok(SUCCEEDED(hr), "Connect failed: %#x\n", hr);
rungraph(graph);
}
IPin_Release(pin_in);
IPin_Release(pin_out);
IBaseFilter_Release(source_filter);
IBaseFilter_Release(video_filter);
IVideoWindow_Release(window);
IFilterGraph2_Release(graph);
}
static void test_render_run(const WCHAR *file) static void test_render_run(const WCHAR *file)
{ {
IFilterGraph2 *graph; IFilterGraph2 *graph;
@ -463,6 +506,8 @@ static void test_render_run(const WCHAR *file)
refs = IFilterGraph2_Release(graph); refs = IFilterGraph2_Release(graph);
ok(!refs, "Graph has %u references\n", refs); ok(!refs, "Graph has %u references\n", refs);
test_graph_builder_connect(filename);
/* check reference leaks */ /* check reference leaks */
h = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); h = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
ok(h != INVALID_HANDLE_VALUE, "CreateFile failed: err=%d\n", GetLastError()); ok(h != INVALID_HANDLE_VALUE, "CreateFile failed: err=%d\n", GetLastError());