[QUARTZ_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 2 Jul 2016 15:56:56 +0000 (15:56 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 2 Jul 2016 15:56:56 +0000 (15:56 +0000)
svn path=/trunk/; revision=71765

rostests/winetests/quartz/avisplitter.c
rostests/winetests/quartz/filtermapper.c

index 2fa7f91..78ca8b8 100644 (file)
@@ -169,6 +169,137 @@ static void test_basefilter(void)
     IBaseFilter_Release(base);
 }
 
+static void test_filesourcefilter(void)
+{
+    static const WCHAR prefix[] = {'w','i','n',0};
+    static const struct
+    {
+        const char *label;
+        const char *data;
+        DWORD size;
+        const GUID *subtype;
+    }
+    tests[] =
+    {
+        {
+            "AVI",
+            "\x52\x49\x46\x46xxxx\x41\x56\x49\x20",
+            12,
+            &MEDIASUBTYPE_Avi,
+        },
+        {
+            "MPEG1 System",
+            "\x00\x00\x01\xBA\x21\x00\x01\x00\x01\x80\x00\x01\x00\x00\x01\xBB",
+            16,
+            &MEDIASUBTYPE_MPEG1System,
+        },
+        {
+            "MPEG1 Video",
+            "\x00\x00\x01\xB3",
+            4,
+            &MEDIASUBTYPE_MPEG1Video,
+        },
+        {
+            "MPEG1 Audio",
+            "\xFF\xE0",
+            2,
+            &MEDIASUBTYPE_MPEG1Audio,
+        },
+        {
+            "MPEG2 Program",
+            "\x00\x00\x01\xBA\x40",
+            5,
+            &MEDIASUBTYPE_MPEG2_PROGRAM,
+        },
+        {
+            "WAVE",
+            "\x52\x49\x46\x46xxxx\x57\x41\x56\x45",
+            12,
+            &MEDIASUBTYPE_WAVE,
+        },
+        {
+            "unknown format",
+            "Hello World",
+            11,
+            NULL, /* FIXME: should be &MEDIASUBTYPE_NULL */
+        },
+    };
+    WCHAR path[MAX_PATH], temp[MAX_PATH];
+    IFileSourceFilter *filesource;
+    DWORD ret, written;
+    IBaseFilter *base;
+    AM_MEDIA_TYPE mt;
+    OLECHAR *olepath;
+    BOOL success;
+    HANDLE file;
+    HRESULT hr;
+    int i;
+
+    ret = GetTempPathW(MAX_PATH, temp);
+    ok(ret, "GetTempPathW failed with error %u\n", GetLastError());
+    ret = GetTempFileNameW(temp, prefix, 0, path);
+    ok(ret, "GetTempFileNameW failed with error %u\n", GetLastError());
+
+    for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+    {
+        trace("Running test for %s\n", tests[i].label);
+
+        file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+                           CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+        ok(file != INVALID_HANDLE_VALUE, "CreateFileW failed with error %u\n", GetLastError());
+        success = WriteFile(file, tests[i].data, tests[i].size, &written, NULL);
+        ok(success, "WriteFile failed with error %u\n", GetLastError());
+        ok(written == tests[i].size, "could not write test data\n");
+        CloseHandle(file);
+
+        hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
+                              &IID_IBaseFilter, (void **)&base);
+        ok(hr == S_OK, "CoCreateInstance failed with %08x\n", hr);
+        hr = IBaseFilter_QueryInterface(base, &IID_IFileSourceFilter, (void **)&filesource);
+        ok(hr == S_OK, "IBaseFilter_QueryInterface failed with %08x\n", hr);
+
+        olepath = (void *)0xdeadbeef;
+        hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL);
+        ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
+        ok(olepath == NULL, "expected NULL, got %p\n", olepath);
+
+        hr = IFileSourceFilter_Load(filesource, NULL, NULL);
+        ok(hr == E_POINTER, "expected E_POINTER, got %08x\n", hr);
+
+        hr = IFileSourceFilter_Load(filesource, path, NULL);
+        ok(hr == S_OK, "IFileSourceFilter_Load failed with %08x\n", hr);
+
+        hr = IFileSourceFilter_GetCurFile(filesource, NULL, &mt);
+        ok(hr == E_POINTER, "expected E_POINTER, got %08x\n", hr);
+
+        olepath = NULL;
+        hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL);
+        ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
+        CoTaskMemFree(olepath);
+
+        olepath = NULL;
+        memset(&mt, 0x11, sizeof(mt));
+        hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &mt);
+        ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
+        ok(!lstrcmpW(olepath, path),
+           "expected %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(olepath));
+        if (tests[i].subtype)
+        {
+            ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Stream),
+               "expected MEDIATYPE_Stream, got %s\n", wine_dbgstr_guid(&mt.majortype));
+            ok(IsEqualGUID(&mt.subtype, tests[i].subtype),
+               "expected %s, got %s\n", wine_dbgstr_guid(tests[i].subtype), wine_dbgstr_guid(&mt.subtype));
+        }
+        CoTaskMemFree(olepath);
+
+        IFileSourceFilter_Release(filesource);
+        IBaseFilter_Release(base);
+
+        success = DeleteFileW(path);
+        ok(success, "DeleteFileW failed with error %u\n", GetLastError());
+    }
+}
+
 static const WCHAR wfile[] = {'t','e','s','t','.','a','v','i',0};
 static const char afile[] = "test.avi";
 
@@ -462,6 +593,7 @@ START_TEST(avisplitter)
 
     test_query_interface();
     test_basefilter();
+    test_filesourcefilter();
     test_threads();
 
     release_avisplitter();
index 63b31bb..3d701a6 100644 (file)
@@ -593,7 +593,7 @@ static void test_aggregate_filter_mapper(void)
     ok(pmapper != &unk_outer.IUnknown_iface, "pmapper = %p, expected not %p\n", pmapper, &unk_outer.IUnknown_iface);
 
     hr = IUnknown_QueryInterface(pmapper, &IID_IUnknown, (void **)&punk);
-    ok(hr == S_OK, "CoCreateInstance returned %x\n", hr);
+    ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr);
     ok(punk != &unk_outer.IUnknown_iface, "punk = %p, expected not %p\n", punk, &unk_outer.IUnknown_iface);
     IUnknown_Release(punk);
 
@@ -603,7 +603,7 @@ static void test_aggregate_filter_mapper(void)
     unk_outer.Release_called = 0;
 
     hr = IUnknown_QueryInterface(pmapper, &IID_IFilterMapper, (void **)&punk);
-    ok(hr == S_OK, "CoCreateInstance returned %x\n", hr);
+    ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr);
     ok(punk != &unk_outer.IUnknown_iface, "punk = %p, expected not %p\n", punk, &unk_outer.IUnknown_iface);
     IUnknown_Release(punk);
 
@@ -613,7 +613,7 @@ static void test_aggregate_filter_mapper(void)
     unk_outer.Release_called = 0;
 
     hr = IUnknown_QueryInterface(pmapper, &IID_IFilterMapper2, (void **)&punk);
-    ok(hr == S_OK, "CoCreateInstance returned %x\n", hr);
+    ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr);
     ok(punk != &unk_outer.IUnknown_iface, "punk = %p, expected not %p\n", punk, &unk_outer.IUnknown_iface);
     IUnknown_Release(punk);
 
@@ -623,7 +623,7 @@ static void test_aggregate_filter_mapper(void)
     unk_outer.Release_called = 0;
 
     hr = IUnknown_QueryInterface(pmapper, &IID_IFilterMapper3, (void **)&punk);
-    ok(hr == S_OK, "CoCreateInstance returned %x\n", hr);
+    ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr);
     ok(punk != &unk_outer.IUnknown_iface, "punk = %p, expected not %p\n", punk, &unk_outer.IUnknown_iface);
     IUnknown_Release(punk);