Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 37304d6..82f895f 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -76,6 +76,46 @@ static IFilterGraph2 *create_graph(void) return ret; }
+#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IFilterGraph2 *graph = create_graph(); + + check_interface(graph, &IID_IBasicAudio, TRUE); + check_interface(graph, &IID_IBasicVideo2, TRUE); + check_interface(graph, &IID_IFilterGraph2, TRUE); + check_interface(graph, &IID_IFilterMapper, TRUE); + check_interface(graph, &IID_IFilterMapper3, TRUE); + check_interface(graph, &IID_IGraphConfig, TRUE); + check_interface(graph, &IID_IGraphVersion, TRUE); + check_interface(graph, &IID_IMediaControl, TRUE); + check_interface(graph, &IID_IMediaEvent, TRUE); + check_interface(graph, &IID_IMediaFilter, TRUE); + check_interface(graph, &IID_IMediaEventSink, TRUE); + check_interface(graph, &IID_IMediaPosition, TRUE); + check_interface(graph, &IID_IMediaSeeking, TRUE); + check_interface(graph, &IID_IObjectWithSite, TRUE); + check_interface(graph, &IID_IVideoWindow, TRUE); + + check_interface(graph, &IID_IBaseFilter, FALSE); + + IFilterGraph2_Release(graph); +} + static void test_basic_video(IFilterGraph2 *graph) { IBasicVideo* pbv; @@ -1827,6 +1867,7 @@ START_TEST(filtergraph) { CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ test_interfaces(); test_render_run(avifile); test_render_run(mpegfile); test_enum_filters();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 52 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 82f895f..7425e29 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -1166,6 +1166,7 @@ struct testfilter LONG ref; IFilterGraph *graph; WCHAR *name; + IReferenceClock *clock;
IEnumPins IEnumPins_iface; struct testpin *pins; @@ -1314,8 +1315,15 @@ static HRESULT WINAPI testfilter_GetState(IBaseFilter *iface, DWORD timeout, FIL
static HRESULT WINAPI testfilter_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock) { - if (winetest_debug > 1) trace("%p->SetSyncSource(%p)\n", iface, clock); - return E_NOTIMPL; + struct testfilter *filter = impl_from_IBaseFilter(iface); + if (winetest_debug > 1) trace("%p->SetSyncSource(%p)\n", filter, clock); + + if (filter->clock) + IReferenceClock_Release(filter->clock); + if (clock) + IReferenceClock_AddRef(clock); + filter->clock = clock; + return S_OK; }
static HRESULT WINAPI testfilter_GetSyncSource(IBaseFilter *iface, IReferenceClock **clock) @@ -1863,6 +1871,45 @@ static void test_control_delegation(void) IFilterGraph2_Release(graph); }
+static void test_add_remove_filter(void) +{ + static const WCHAR defaultid[] = {'0','0','0','1',0}; + static const WCHAR testid[] = {'t','e','s','t','i','d',0}; + struct testfilter filter; + + IFilterGraph2 *graph = create_graph(); + HRESULT hr; + + testfilter_init(&filter, NULL, 0); + + hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, testid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(filter.graph == (IFilterGraph *)graph, "Got graph %p.\n", filter.graph); + ok(!lstrcmpW(filter.name, testid), "Got name %s.\n", wine_dbgstr_w(filter.name)); + + hr = IFilterGraph2_RemoveFilter(graph, &filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!filter.graph, "Got graph %p.\n", filter.graph); +todo_wine + ok(!filter.name, "Got name %s.\n", wine_dbgstr_w(filter.name)); + ok(!filter.clock, "Got clock %p,\n", filter.clock); + ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref); + + hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(filter.graph == (IFilterGraph *)graph, "Got graph %p.\n", filter.graph); + ok(!lstrcmpW(filter.name, defaultid), "Got name %s.\n", wine_dbgstr_w(filter.name)); + + /* test releasing the filter graph while filters are still connected */ + hr = IFilterGraph2_Release(graph); + ok(!hr, "Got outstanding refcount %d.\n", hr); + ok(!filter.graph, "Got graph %p.\n", filter.graph); +todo_wine + ok(!filter.name, "Got name %s.\n", wine_dbgstr_w(filter.name)); + ok(!filter.clock, "Got clock %p.\n", filter.clock); + ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref); +} + START_TEST(filtergraph) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -1875,6 +1922,7 @@ START_TEST(filtergraph) test_graph_builder_render(); test_aggregate_filter_graph(); test_control_delegation(); + test_add_remove_filter();
CoUninitialize(); test_render_with_multithread();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filtergraph.c | 2 +- dlls/quartz/tests/filtergraph.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index a0d6257..1fa6476 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -710,7 +710,7 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte IEnumPins_Release(penumpins); }
- hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, entry->name); + hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, NULL); if (SUCCEEDED(hr)) { IBaseFilter_SetSyncSource(pFilter, NULL); diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 7425e29..4d49772 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -1890,7 +1890,6 @@ static void test_add_remove_filter(void) hr = IFilterGraph2_RemoveFilter(graph, &filter.IBaseFilter_iface); ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!filter.graph, "Got graph %p.\n", filter.graph); -todo_wine ok(!filter.name, "Got name %s.\n", wine_dbgstr_w(filter.name)); ok(!filter.clock, "Got clock %p,\n", filter.clock); ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref); @@ -1904,7 +1903,6 @@ todo_wine hr = IFilterGraph2_Release(graph); ok(!hr, "Got outstanding refcount %d.\n", hr); ok(!filter.graph, "Got graph %p.\n", filter.graph); -todo_wine ok(!filter.name, "Got name %s.\n", wine_dbgstr_w(filter.name)); ok(!filter.clock, "Got clock %p.\n", filter.clock); ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 4d49772..2374e2f 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -1878,15 +1878,25 @@ static void test_add_remove_filter(void) struct testfilter filter;
IFilterGraph2 *graph = create_graph(); + IBaseFilter *ret_filter; HRESULT hr;
testfilter_init(&filter, NULL, 0);
+ hr = IFilterGraph2_FindFilterByName(graph, testid, &ret_filter); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + ok(!ret_filter, "Got filter %p.\n", ret_filter); + hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, testid); ok(hr == S_OK, "Got hr %#x.\n", hr); ok(filter.graph == (IFilterGraph *)graph, "Got graph %p.\n", filter.graph); ok(!lstrcmpW(filter.name, testid), "Got name %s.\n", wine_dbgstr_w(filter.name));
+ hr = IFilterGraph2_FindFilterByName(graph, testid, &ret_filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(ret_filter == &filter.IBaseFilter_iface, "Got filter %p.\n", ret_filter); + IBaseFilter_Release(ret_filter); + hr = IFilterGraph2_RemoveFilter(graph, &filter.IBaseFilter_iface); ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!filter.graph, "Got graph %p.\n", filter.graph); @@ -1894,11 +1904,20 @@ static void test_add_remove_filter(void) ok(!filter.clock, "Got clock %p,\n", filter.clock); ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref);
+ hr = IFilterGraph2_FindFilterByName(graph, testid, &ret_filter); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + ok(!ret_filter, "Got filter %p.\n", ret_filter); + hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); ok(filter.graph == (IFilterGraph *)graph, "Got graph %p.\n", filter.graph); ok(!lstrcmpW(filter.name, defaultid), "Got name %s.\n", wine_dbgstr_w(filter.name));
+ hr = IFilterGraph2_FindFilterByName(graph, defaultid, &ret_filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(ret_filter == &filter.IBaseFilter_iface, "Got filter %p.\n", ret_filter); + IBaseFilter_Release(ret_filter); + /* test releasing the filter graph while filters are still connected */ hr = IFilterGraph2_Release(graph); ok(!hr, "Got outstanding refcount %d.\n", hr);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/filtergraph.c | 64 ----------------------------------------- 1 file changed, 64 deletions(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 2374e2f..5035f80 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -760,69 +760,6 @@ static void test_render_with_multithread(void) CoUninitialize(); }
-static void test_graph_builder(void) -{ - HRESULT hr; - IGraphBuilder *pgraph; - IBaseFilter *pF = NULL; - IBaseFilter *pF2 = NULL; - IPin *pIn = NULL; - IEnumPins *pEnum = NULL; - PIN_DIRECTION dir; - static const WCHAR testFilterW[] = {'t','e','s','t','F','i','l','t','e','r',0}; - static const WCHAR fooBarW[] = {'f','o','o','B','a','r',0}; - - pgraph = (IGraphBuilder *)create_graph(); - - /* create video filter */ - hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, - &IID_IBaseFilter, (LPVOID*)&pF); - ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr); - ok(pF != NULL, "pF is NULL\n"); - - hr = IGraphBuilder_AddFilter(pgraph, NULL, testFilterW); - ok(hr == E_POINTER, "IGraphBuilder_AddFilter returned %x\n", hr); - - /* add the two filters to the graph */ - hr = IGraphBuilder_AddFilter(pgraph, pF, testFilterW); - ok(hr == S_OK, "failed to add pF to the graph: %x\n", hr); - - /* find the pins */ - hr = IBaseFilter_EnumPins(pF, &pEnum); - ok(hr == S_OK, "IBaseFilter_EnumPins failed for pF: %x\n", hr); - ok(pEnum != NULL, "pEnum is NULL\n"); - hr = IEnumPins_Next(pEnum, 1, &pIn, NULL); - ok(hr == S_OK, "IEnumPins_Next failed for pF: %x\n", hr); - ok(pIn != NULL, "pIn is NULL\n"); - hr = IPin_QueryDirection(pIn, &dir); - ok(hr == S_OK, "IPin_QueryDirection failed: %x\n", hr); - ok(dir == PINDIR_INPUT, "pin has wrong direction\n"); - - hr = IGraphBuilder_FindFilterByName(pgraph, fooBarW, &pF2); - ok(hr == VFW_E_NOT_FOUND, "IGraphBuilder_FindFilterByName returned %x\n", hr); - ok(pF2 == NULL, "IGraphBuilder_FindFilterByName returned %p\n", pF2); - hr = IGraphBuilder_FindFilterByName(pgraph, testFilterW, &pF2); - ok(hr == S_OK, "IGraphBuilder_FindFilterByName returned %x\n", hr); - ok(pF2 != NULL, "IGraphBuilder_FindFilterByName returned NULL\n"); - hr = IGraphBuilder_FindFilterByName(pgraph, testFilterW, NULL); - ok(hr == E_POINTER, "IGraphBuilder_FindFilterByName returned %x\n", hr); - - hr = IGraphBuilder_Connect(pgraph, NULL, pIn); - ok(hr == E_POINTER, "IGraphBuilder_Connect returned %x\n", hr); - - hr = IGraphBuilder_Connect(pgraph, pIn, NULL); - ok(hr == E_POINTER, "IGraphBuilder_Connect returned %x\n", hr); - - hr = IGraphBuilder_Connect(pgraph, pIn, pIn); - ok(hr == VFW_E_CANNOT_CONNECT, "IGraphBuilder_Connect returned %x\n", hr); - - if (pIn) IPin_Release(pIn); - if (pEnum) IEnumPins_Release(pEnum); - if (pF) IBaseFilter_Release(pF); - if (pF2) IBaseFilter_Release(pF2); - IGraphBuilder_Release(pgraph); -} - struct testpin { IPin IPin_iface; @@ -1935,7 +1872,6 @@ START_TEST(filtergraph) test_render_run(avifile); test_render_run(mpegfile); test_enum_filters(); - test_graph_builder(); test_graph_builder_render(); test_aggregate_filter_graph(); test_control_delegation();