Zebediah Figura : quartz/tests: Simply test_render_with_multithread().

Alexandre Julliard julliard at winehq.org
Fri Mar 2 12:16:44 CST 2018


Module: wine
Branch: master
Commit: 55d1323546910fc198bb2476d02e4658fb4d33ba
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=55d1323546910fc198bb2476d02e4658fb4d33ba

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Mar  1 13:19:21 2018 -0600

quartz/tests: Simply test_render_with_multithread().

Use CoCreateInstance directly, and try to run the graph on a real file.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 4a7735b..8b3f7d5 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -588,78 +588,35 @@ todo_wine
 
 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;
-    }
-
-    pDllGetClassObject = (void*)GetProcAddress(hmod, "DllGetClassObject");
-    if (!pDllGetClassObject)
-    {
-         skip("Fail to get DllGetClassObject.\n");
-         return;
-    }
-
-    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);
+    graph = create_graph();
 
-    thread = CreateThread(NULL, 0, call_RenderFile_multithread, filter_graph, 0, NULL);
+    thread = CreateThread(NULL, 0, call_RenderFile_multithread, 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)




More information about the wine-cvs mailing list