Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v3: Fix test failures; sorry about the spam.
dlls/quartz/filtergraph.c | 2 +- dlls/quartz/tests/filtergraph.c | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index d1643c3..60c7374 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -1193,7 +1193,7 @@ out: --This->recursioncount; LeaveCriticalSection(&This->cs); TRACE("--> %08x\n", hr); - return SUCCEEDED(hr) ? S_OK : hr; + return SUCCEEDED(hr) ? S_OK : VFW_E_CANNOT_CONNECT; }
static HRESULT FilterGraph2_RenderRecurse(IFilterGraphImpl *This, IPin *ppinOut) diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 8e9d17e..7116283 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -431,7 +431,7 @@ static void rungraph(IFilterGraph2 *graph) ok(hr==1, "Releasing mediacontrol returned: %x\n", hr); }
-static void test_graph_builder_connect(WCHAR *filename) +static HRESULT test_graph_builder_connect(WCHAR *filename) { static const WCHAR outputW[] = {'O','u','t','p','u','t',0}; static const WCHAR inW[] = {'I','n',0}; @@ -460,11 +460,8 @@ static void test_graph_builder_connect(WCHAR *filename) 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); + if (SUCCEEDED(hr)) rungraph(graph); - }
IPin_Release(pin_in); IPin_Release(pin_out); @@ -472,6 +469,8 @@ static void test_graph_builder_connect(WCHAR *filename) IBaseFilter_Release(video_filter); IVideoWindow_Release(window); IFilterGraph2_Release(graph); + + return hr; }
static void test_render_run(const WCHAR *file) @@ -495,19 +494,28 @@ static void test_render_run(const WCHAR *file) graph = create_graph();
hr = IFilterGraph2_RenderFile(graph, filename, NULL); - if (hr == VFW_E_CANNOT_RENDER) + if (FAILED(hr)) + { skip("%s: codec not supported; skipping test\n", wine_dbgstr_w(file)); + + refs = IFilterGraph2_Release(graph); + ok(!refs, "Graph has %u references\n", refs); + + hr = test_graph_builder_connect(filename); + ok(hr == VFW_E_CANNOT_CONNECT, "got %#x\n", hr); + } else { ok(hr == S_OK || hr == VFW_S_AUDIO_NOT_RENDERED, "RenderFile failed: %x\n", hr); rungraph(graph); + + refs = IFilterGraph2_Release(graph); + ok(!refs, "Graph has %u references\n", refs); + + hr = test_graph_builder_connect(filename); + ok(hr == S_OK || hr == VFW_S_PARTIAL_RENDER, "got %#x\n", hr); }
- refs = IFilterGraph2_Release(graph); - ok(!refs, "Graph has %u references\n", refs); - - test_graph_builder_connect(filename); - /* check reference leaks */ h = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); ok(h != INVALID_HANDLE_VALUE, "CreateFile failed: err=%d\n", GetLastError());
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v2: fix test failures
dlls/quartz/tests/filtergraph.c | 100 ++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 44 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 7116283..bf3c98f 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -346,6 +346,58 @@ static void test_mediacontrol(IFilterGraph2 *graph) IMediaFilter_Release(filter); }
+static void test_state_change(IFilterGraph2 *graph) +{ + IMediaControl *control; + OAFilterState state; + HRESULT hr; + + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control); + ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %x\n", hr); + + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "GetState() failed: %x\n", hr); + ok(state == State_Stopped, "wrong state %d\n", state); + + hr = IMediaControl_Run(control); + ok(SUCCEEDED(hr), "Run() failed: %x\n", hr); + hr = IMediaControl_GetState(control, INFINITE, &state); + ok(SUCCEEDED(hr), "GetState() failed: %x\n", hr); + ok(state == State_Running, "wrong state %d\n", state); + + hr = IMediaControl_Stop(control); + ok(SUCCEEDED(hr), "Stop() failed: %x\n", hr); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "GetState() failed: %x\n", hr); + ok(state == State_Stopped, "wrong state %d\n", state); + + hr = IMediaControl_Pause(control); + ok(SUCCEEDED(hr), "Pause() failed: %x\n", hr); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "GetState() failed: %x\n", hr); + ok(state == State_Paused, "wrong state %d\n", state); + + hr = IMediaControl_Run(control); + ok(SUCCEEDED(hr), "Run() failed: %x\n", hr); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "GetState() failed: %x\n", hr); + ok(state == State_Running, "wrong state %d\n", state); + + hr = IMediaControl_Pause(control); + ok(SUCCEEDED(hr), "Pause() failed: %x\n", hr); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "GetState() failed: %x\n", hr); + ok(state == State_Paused, "wrong state %d\n", state); + + hr = IMediaControl_Stop(control); + ok(SUCCEEDED(hr), "Stop() failed: %x\n", hr); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "GetState() failed: %x\n", hr); + ok(state == State_Stopped, "wrong state %d\n", state); + + IMediaControl_Release(control); +} + static void rungraph(IFilterGraph2 *graph) { HRESULT hr; @@ -354,6 +406,10 @@ static void rungraph(IFilterGraph2 *graph) IMediaFilter* pmf; HANDLE hEvent;
+ test_basic_video(graph); + test_mediacontrol(graph); + test_state_change(graph); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&pmc); ok(hr==S_OK, "Cannot get IMediaControl interface returned: %x\n", hr);
@@ -366,53 +422,9 @@ static void rungraph(IFilterGraph2 *graph)
IMediaFilter_Release(pmf);
- test_basic_video(graph); - test_mediacontrol(graph); - hr = IMediaControl_Run(pmc); ok(hr==S_FALSE, "Cannot run the graph returned: %x\n", hr);
- Sleep(10); - /* Crash fun */ - trace("run -> stop\n"); - hr = IMediaControl_Stop(pmc); - ok(hr==S_OK || hr == S_FALSE, "Cannot stop the graph returned: %x\n", hr); - - IFilterGraph2_SetDefaultSyncSource(graph); - - Sleep(10); - trace("stop -> pause\n"); - hr = IMediaControl_Pause(pmc); - ok(hr==S_OK || hr == S_FALSE, "Cannot pause the graph returned: %x\n", hr); - - Sleep(10); - trace("pause -> run\n"); - hr = IMediaControl_Run(pmc); - ok(hr==S_OK || hr == S_FALSE, "Cannot start the graph returned: %x\n", hr); - - Sleep(10); - trace("run -> pause\n"); - hr = IMediaControl_Pause(pmc); - ok(hr==S_OK || hr == S_FALSE, "Cannot pause the graph returned: %x\n", hr); - - Sleep(10); - trace("pause -> stop\n"); - hr = IMediaControl_Stop(pmc); - ok(hr==S_OK || hr == S_FALSE, "Cannot stop the graph returned: %x\n", hr); - - Sleep(10); - trace("pause -> run\n"); - hr = IMediaControl_Run(pmc); - ok(hr==S_OK || hr == S_FALSE, "Cannot start the graph returned: %x\n", hr); - - trace("run -> stop\n"); - hr = IMediaControl_Stop(pmc); - ok(hr==S_OK || hr == S_FALSE, "Cannot stop the graph returned: %x\n", hr); - - trace("stop -> run\n"); - hr = IMediaControl_Run(pmc); - ok(hr==S_OK || hr == S_FALSE, "Cannot start the graph returned: %x\n", hr); - hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (LPVOID*)&pme); ok(hr==S_OK, "Cannot get IMediaEvent interface returned: %x\n", hr);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 125 ++++++++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 38 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index bf3c98f..6c33414 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -398,49 +398,98 @@ static void test_state_change(IFilterGraph2 *graph) IMediaControl_Release(control); }
+static void test_media_event(IFilterGraph2 *graph) +{ + IMediaEvent *media_event; + IMediaSeeking *seeking; + IMediaControl *control; + IMediaFilter *filter; + LONG_PTR lparam1, lparam2; + LONGLONG current, stop; + OAFilterState state; + int got_eos = 0; + HANDLE event; + HRESULT hr; + LONG code; + + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter); + ok(hr == S_OK, "QueryInterface(IMediaFilter) failed: %#x\n", hr); + + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control); + ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %#x\n", hr); + + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&media_event); + ok(hr == S_OK, "QueryInterface(IMediaEvent) failed: %#x\n", hr); + + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaSeeking, (void **)&seeking); + ok(hr == S_OK, "QueryInterface(IMediaEvent) failed: %#x\n", hr); + + hr = IMediaControl_Stop(control); + ok(SUCCEEDED(hr), "Stop() failed: %#x\n", hr); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "GetState() timed out\n"); + + hr = IMediaSeeking_GetDuration(seeking, &stop); + ok(hr == S_OK, "GetDuration() failed: %#x\n", hr); + current = 0; + hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, &stop, AM_SEEKING_AbsolutePositioning); + ok(hr == S_OK, "SetPositions() failed: %#x\n", hr); + + hr = IMediaFilter_SetSyncSource(filter, NULL); + ok(hr == S_OK, "SetSyncSource() failed: %#x\n", hr); + + hr = IMediaEvent_GetEventHandle(media_event, (OAEVENT *)&event); + ok(hr == S_OK, "GetEventHandle() failed: %#x\n", hr); + + /* flush existing events */ + while ((hr = IMediaEvent_GetEvent(media_event, &code, &lparam1, &lparam2, 0)) == S_OK); + + ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "event should not be signaled\n"); + + hr = IMediaControl_Run(control); + ok(SUCCEEDED(hr), "Run() failed: %#x\n", hr); + + while (!got_eos) + { + if (WaitForSingleObject(event, 1000) == WAIT_TIMEOUT) + break; + + while ((hr = IMediaEvent_GetEvent(media_event, &code, &lparam1, &lparam2, 0)) == S_OK) + { + if (code == EC_COMPLETE) + { + got_eos = 1; + break; + } + } + } + ok(got_eos, "didn't get EOS\n"); + + hr = IMediaSeeking_GetCurrentPosition(seeking, ¤t); + ok(hr == S_OK, "GetCurrentPosition() failed: %#x\n", hr); +todo_wine + ok(current == stop, "expected %s, got %s\n", wine_dbgstr_longlong(stop), wine_dbgstr_longlong(current)); + + hr = IMediaControl_Stop(control); + ok(SUCCEEDED(hr), "Run() failed: %#x\n", hr); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "GetState() timed out\n"); + + hr = IFilterGraph2_SetDefaultSyncSource(graph); + ok(hr == S_OK, "SetDefaultSinkSource() failed: %#x\n", hr); + + IMediaSeeking_Release(seeking); + IMediaEvent_Release(media_event); + IMediaControl_Release(control); + IMediaFilter_Release(filter); +} + static void rungraph(IFilterGraph2 *graph) { - HRESULT hr; - IMediaControl* pmc; - IMediaEvent* pme; - IMediaFilter* pmf; - HANDLE hEvent; - test_basic_video(graph); test_mediacontrol(graph); test_state_change(graph); - - hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&pmc); - ok(hr==S_OK, "Cannot get IMediaControl interface returned: %x\n", hr); - - hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&pmf); - ok(hr==S_OK, "Cannot get IMediaFilter interface returned: %x\n", hr); - - IMediaControl_Stop(pmc); - - IMediaFilter_SetSyncSource(pmf, NULL); - - IMediaFilter_Release(pmf); - - hr = IMediaControl_Run(pmc); - ok(hr==S_FALSE, "Cannot run the graph returned: %x\n", hr); - - hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (LPVOID*)&pme); - ok(hr==S_OK, "Cannot get IMediaEvent interface returned: %x\n", hr); - - hr = IMediaEvent_GetEventHandle(pme, (OAEVENT*)&hEvent); - ok(hr==S_OK, "Cannot get event handle returned: %x\n", hr); - - ok(WaitForSingleObject(hEvent, 2000) == WAIT_OBJECT_0, "Wait failed\n"); - - hr = IMediaEvent_Release(pme); - ok(hr==2, "Releasing mediaevent returned: %x\n", hr); - - hr = IMediaControl_Stop(pmc); - ok(hr==S_OK, "Cannot stop the graph returned: %x\n", hr); - - hr = IMediaControl_Release(pmc); - ok(hr==1, "Releasing mediacontrol returned: %x\n", hr); + test_media_event(graph); }
static HRESULT test_graph_builder_connect(WCHAR *filename)
Use CoCreateInstance directly, and try to run the graph on a real file.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 67 ++++++++--------------------------------- 1 file changed, 12 insertions(+), 55 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 6c33414..8444456 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -587,78 +587,35 @@ static void test_render_run(const WCHAR *file)
static DWORD WINAPI call_RenderFile_multithread(LPVOID lParam) { - IFilterGraph2 *filter_graph = lParam; + WCHAR *filename = load_resource(avifile); + IFilterGraph2 *graph = lParam; HRESULT hr; - WCHAR mp3file[] = {'t','e','s','t','.','m','p','3',0}; - HANDLE handle;
- handle = CreateFileW(mp3file, 0, 0, NULL, CREATE_ALWAYS, 0, NULL); - if (handle == INVALID_HANDLE_VALUE) - { - skip("Could not read test file %s, skipping test\n", wine_dbgstr_w(mp3file)); - return 1; - } - CloseHandle(handle); + hr = IFilterGraph2_RenderFile(graph, filename, NULL); +todo_wine + ok(SUCCEEDED(hr), "RenderFile failed: %x\n", hr);
- hr = IFilterGraph2_RenderFile(filter_graph, mp3file, NULL); - todo_wine ok(hr == VFW_E_CANNOT_RENDER || /* xp or older + DirectX 9 */ - hr == VFW_E_NO_TRANSPORT || /* win7 or newer */ - broken(hr == CLASS_E_CLASSNOTAVAILABLE), /* xp or older + DirectX 8 or older */ - "Expected 0x%08x or 0x%08x, returned 0x%08x\n", VFW_E_CANNOT_RENDER, VFW_E_NO_TRANSPORT, hr); + if (SUCCEEDED(hr)) + rungraph(graph);
- DeleteFileW(mp3file); return 0; }
static void test_render_with_multithread(void) { - HRESULT hr; - HMODULE hmod; - static HRESULT (WINAPI *pDllGetClassObject)(REFCLSID rclsid, REFIID riid, void **out); - IClassFactory *classfactory = NULL; - static IGraphBuilder *graph_builder; - static IFilterGraph2 *filter_graph; + IFilterGraph2 *graph; HANDLE thread;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- hmod = LoadLibraryA("quartz.dll"); - if (!hmod) - { - skip("Fail to load quartz.dll.\n"); - return; - } + graph = create_graph();
- pDllGetClassObject = (void*)GetProcAddress(hmod, "DllGetClassObject"); - if (!pDllGetClassObject) - { - skip("Fail to get DllGetClassObject.\n"); - return; - } + thread = CreateThread(NULL, 0, call_RenderFile_multithread, graph, 0, NULL);
- hr = pDllGetClassObject(&CLSID_FilterGraph, &IID_IClassFactory, (void **)&classfactory); - ok(hr == S_OK, "DllGetClassObject failed 0x%08x\n", hr); - if (FAILED(hr)) - { - skip("Can't create IClassFactory 0x%08x.\n", hr); - return; - } - - hr = IClassFactory_CreateInstance(classfactory, NULL, &IID_IUnknown, (LPVOID*)&graph_builder); - ok(hr == S_OK, "IClassFactory_CreateInstance failed 0x%08x\n", hr); - - hr = IGraphBuilder_QueryInterface(graph_builder, &IID_IFilterGraph2, (void**)&filter_graph); - ok(hr == S_OK, "IGraphBuilder_QueryInterface failed 0x%08x\n", hr); - - thread = CreateThread(NULL, 0, call_RenderFile_multithread, filter_graph, 0, NULL); - - WaitForSingleObject(thread, 1000); - IFilterGraph2_Release(filter_graph); - IGraphBuilder_Release(graph_builder); - IClassFactory_Release(classfactory); + ok(WaitForSingleObject(thread, 1000) == WAIT_OBJECT_0, "wait failed\n"); + IFilterGraph2_Release(graph); CloseHandle(thread); CoUninitialize(); - return; }
static void test_graph_builder(void)
Also remove uninteresting IMediaControl test.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 8444456..5cf4a4d 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -284,12 +284,11 @@ static void test_basic_video(IFilterGraph2 *graph) IBasicVideo_Release(pbv); }
-static void test_mediacontrol(IFilterGraph2 *graph) +static void test_media_seeking(IFilterGraph2 *graph) { IMediaSeeking *seeking; IMediaFilter *filter; - IMediaControl *control; - LONGLONG pos; + LONGLONG pos, stop, duration; GUID format; HRESULT hr;
@@ -300,9 +299,6 @@ static void test_mediacontrol(IFilterGraph2 *graph) hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter); ok(hr == S_OK, "QueryInterface(IMediaFilter) failed: %08x\n", hr);
- hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control); - ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %08x\n", hr); - format = GUID_NULL; hr = IMediaSeeking_GetTimeFormat(seeking, &format); ok(hr == S_OK, "GetTimeFormat failed: %#x\n", hr); @@ -327,21 +323,31 @@ static void test_mediacontrol(IFilterGraph2 *graph) ok(hr == S_OK, "GetCurrentPosition failed: %#x\n", hr); ok(pos == 0, "got %s\n", wine_dbgstr_longlong(pos));
+ hr = IMediaSeeking_GetDuration(seeking, &duration); + ok(hr == S_OK, "GetDuration failed: %#x\n", hr); + ok(duration > 0, "got %s\n", wine_dbgstr_longlong(duration)); + + hr = IMediaSeeking_GetStopPosition(seeking, &stop); + ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr); + ok(stop == duration || stop == duration + 1, "expected %s, got %s\n", + wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop)); + hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_ReturnTime, NULL, AM_SEEKING_NoPositioning); ok(hr == S_OK, "SetPositions failed: %#x\n", hr); hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_NoPositioning, NULL, AM_SEEKING_ReturnTime); ok(hr == S_OK, "SetPositions failed: %#x\n", hr);
+ pos = 0; + hr = IMediaSeeking_SetPositions(seeking, &pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); + ok(hr == S_OK, "SetPositions failed: %08x\n", hr); + IMediaFilter_SetSyncSource(filter, NULL); pos = 0xdeadbeef; hr = IMediaSeeking_GetCurrentPosition(seeking, &pos); - ok(hr == S_OK, "GetCurrentPosition failed: %#x\n", hr); - ok(pos == 0, "got %s\n", wine_dbgstr_longlong(pos)); + ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr); + ok(pos == 0, "Position != 0 (%s)\n", wine_dbgstr_longlong(pos)); + IFilterGraph2_SetDefaultSyncSource(graph);
- hr = IMediaControl_GetState(control, 1000, NULL); - ok(hr == E_POINTER, "expected E_POINTER, got %#x\n", hr); - - IMediaControl_Release(control); IMediaSeeking_Release(seeking); IMediaFilter_Release(filter); } @@ -487,7 +493,7 @@ todo_wine static void rungraph(IFilterGraph2 *graph) { test_basic_video(graph); - test_mediacontrol(graph); + test_media_seeking(graph); test_state_change(graph); test_media_event(graph); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 60 +++-------------------------------------- 1 file changed, 3 insertions(+), 57 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 5cf4a4d..94b39cb 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -1824,12 +1824,10 @@ static HRESULT get_connected_filter_name(TestFilterImpl *pFilter, char *FilterNa
hr = IPin_ConnectedTo(pFilter->ppPins[0], &pin); ok(hr == S_OK, "IPin_ConnectedTo failed with %x\n", hr); - if (FAILED(hr)) return hr;
hr = IPin_QueryPinInfo(pin, &pinInfo); ok(hr == S_OK, "IPin_QueryPinInfo failed with %x\n", hr); IPin_Release(pin); - if (FAILED(hr)) return hr;
SetLastError(0xdeadbeef); hr = IBaseFilter_QueryFilterInfo(pinInfo.pFilter, &filterInfo); @@ -1840,7 +1838,6 @@ static HRESULT get_connected_filter_name(TestFilterImpl *pFilter, char *FilterNa } ok(hr == S_OK, "IBaseFilter_QueryFilterInfo failed with %x\n", hr); IBaseFilter_Release(pinInfo.pFilter); - if (FAILED(hr)) return hr;
IFilterGraph_Release(filterInfo.pGraph);
@@ -1940,28 +1937,23 @@ static void test_render_filter_priority(void) * on the order in which filters are added to the graph, thus indicating * no preference given to exact match. */ pgraph2 = create_graph(); - if (!pgraph2) return;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
hr = createtestfilter(&GUID_NULL, PinData2, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName2); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData3, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName3); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr); @@ -1972,41 +1964,27 @@ static void test_render_filter_priority(void) hr = get_connected_filter_name(ptestfilter, ConnectedFilterName1);
IFilterGraph2_Release(pgraph2); - pgraph2 = NULL; IBaseFilter_Release(&ptestfilter->IBaseFilter_iface); - ptestfilter = NULL; IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL; - - if (hr == E_NOTIMPL) - { - win_skip("Needed functions are not implemented\n"); - return; - }
pgraph2 = create_graph(); - if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
hr = createtestfilter(&GUID_NULL, PinData3, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName3); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData2, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName2); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr); @@ -2022,49 +2000,39 @@ static void test_render_filter_priority(void) "expected connected filters to be different but got %s both times\n", ConnectedFilterName1);
IFilterGraph2_Release(pgraph2); - pgraph2 = NULL; IBaseFilter_Release(&ptestfilter->IBaseFilter_iface); - ptestfilter = NULL; IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
/* Test if any preference is given to existing renderer which renders the pin directly vs an existing renderer which renders the pin indirectly, through an additional middle filter, again trying different orders of creation. Native appears not to give a preference. */
pgraph2 = create_graph(); - if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
hr = createtestfilter(&GUID_NULL, PinData2, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName2); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData4, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName3); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData5, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName4); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr); @@ -2077,45 +2045,35 @@ static void test_render_filter_priority(void) "unexpected connected filter: %s\n", ConnectedFilterName1);
IFilterGraph2_Release(pgraph2); - pgraph2 = NULL; IBaseFilter_Release(&ptestfilter->IBaseFilter_iface); - ptestfilter = NULL; IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
pgraph2 = create_graph(); - if (!pgraph2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
hr = createtestfilter(&GUID_NULL, PinData4, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName3); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData5, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName4); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr);
IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
hr = createtestfilter(&GUID_NULL, PinData2, &ptestfilter2); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter2->IBaseFilter_iface, wszFilterInstanceName2); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr); @@ -2130,23 +2088,17 @@ static void test_render_filter_priority(void) "expected connected filters to be different but got %s both times\n", ConnectedFilterName1);
IFilterGraph2_Release(pgraph2); - pgraph2 = NULL; IBaseFilter_Release(&ptestfilter->IBaseFilter_iface); - ptestfilter = NULL; IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - ptestfilter2 = NULL;
/* Test if renderers are tried before non-renderers (intermediary filters). */ pgraph2 = create_graph(); - if (!pgraph2) goto out;
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pMapper2); ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr); - if (!pMapper2) goto out;
hr = createtestfilter(&GUID_NULL, PinData1, &ptestfilter); ok(hr == S_OK, "createtestfilter failed with %08x\n", hr); - if (FAILED(hr)) goto out;
hr = IFilterGraph2_AddFilter(pgraph2, &ptestfilter->IBaseFilter_iface, wszFilterInstanceName1); ok(hr == S_OK, "IFilterGraph2_AddFilter failed with %08x\n", hr); @@ -2156,17 +2108,14 @@ static void test_render_filter_priority(void) (IUnknown *)&Filter1ClassFactory.IClassFactory_iface, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie1); ok(hr == S_OK, "CoRegisterClassObject failed with %08x\n", hr); - if (FAILED(hr)) goto out; hr = CoRegisterClassObject(Filter2ClassFactory.clsid, (IUnknown *)&Filter2ClassFactory.IClassFactory_iface, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie2); ok(hr == S_OK, "CoRegisterClassObject failed with %08x\n", hr); - if (FAILED(hr)) goto out; hr = CoRegisterClassObject(Filter3ClassFactory.clsid, (IUnknown *)&Filter3ClassFactory.IClassFactory_iface, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie3); ok(hr == S_OK, "CoRegisterClassObject failed with %08x\n", hr); - if (FAILED(hr)) goto out;
rgf2.dwVersion = 2; rgf2.dwMerit = MERIT_UNLIKELY; @@ -2233,12 +2182,9 @@ static void test_render_filter_priority(void) ok(hr == S_OK, "IFilterMapper2_UnregisterFilter failed with %x\n", hr); }
- out: - - if (ptestfilter) IBaseFilter_Release(&ptestfilter->IBaseFilter_iface); - if (ptestfilter2) IBaseFilter_Release(&ptestfilter2->IBaseFilter_iface); - if (pgraph2) IFilterGraph2_Release(pgraph2); - if (pMapper2) IFilterMapper2_Release(pMapper2); + IBaseFilter_Release(&ptestfilter->IBaseFilter_iface); + IFilterGraph2_Release(pgraph2); + IFilterMapper2_Release(pMapper2);
hr = CoRevokeClassObject(cookie1); ok(hr == S_OK, "CoRevokeClassObject failed with %08x\n", hr);
Zebediah Figura z.figura12@gmail.com writes:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
v3: Fix test failures; sorry about the spam.
dlls/quartz/filtergraph.c | 2 +- dlls/quartz/tests/filtergraph.c | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-)
This breaks the tests here:
../../../tools/runtest -q -P wine -T ../../.. -M qcap.dll -p qcap_test.exe.so smartteefilter && touch smartteefilter.ok smartteefilter.c:1570: Test failed: connecting Capture pin without first connecting Input pin returned 0x80040217 smartteefilter.c:1572: Test failed: connecting Preview pin without first connecting Input pin returned 0x80040217 Makefile:226: recipe for target 'smartteefilter.ok' failed make: *** [smartteefilter.ok] Error 2
On 01/03/18 12:25, Alexandre Julliard wrote:
Zebediah Figura z.figura12@gmail.com writes:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
v3: Fix test failures; sorry about the spam.
dlls/quartz/filtergraph.c | 2 +- dlls/quartz/tests/filtergraph.c | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-)
This breaks the tests here:
../../../tools/runtest -q -P wine -T ../../.. -M qcap.dll -p qcap_test.exe.so smartteefilter && touch smartteefilter.ok smartteefilter.c:1570: Test failed: connecting Capture pin without first connecting Input pin returned 0x80040217 smartteefilter.c:1572: Test failed: connecting Preview pin without first connecting Input pin returned 0x80040217 Makefile:226: recipe for target 'smartteefilter.ok' failed make: *** [smartteefilter.ok] Error 2
Ugh, thanks. In that case I'll just send the test without the Connect() fix.