[WINDOWSCODECS_WINETEST] Sync with Wine Staging 3.9. CORE-14656
[reactos.git] / modules / rostests / winetests / windowscodecs / info.c
index 4a9c9c6..d00e9d8 100644 (file)
@@ -139,7 +139,6 @@ static void test_decoder_info(void)
             decoder_info2 = NULL;
             hr = IWICBitmapDecoder_GetDecoderInfo(decoder, &decoder_info2);
             ok(hr == S_OK, "Failed to get decoder info, hr %#x.\n", hr);
-        todo_wine
             ok(decoder_info == decoder_info2, "Unexpected decoder info instance.\n");
 
             hr = IWICBitmapDecoderInfo_QueryInterface(decoder_info, &IID_IWICBitmapDecoder, (void **)&decoder2);
@@ -470,17 +469,38 @@ static void test_pixelformat_info(void)
     IWICComponentInfo_Release(info);
 }
 
+static DWORD WINAPI cache_across_threads_test(void *arg)
+{
+    IWICComponentInfo *info;
+    HRESULT hr;
+
+    CoInitialize(NULL);
+
+    hr = get_component_info(&CLSID_WICUnknownMetadataReader, &info);
+    ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
+    ok(info == arg, "unexpected info pointer %p\n", info);
+    IWICComponentInfo_Release(info);
+
+    CoUninitialize();
+    return 0;
+}
+
 static void test_reader_info(void)
 {
     IWICImagingFactory *factory;
-    IWICComponentInfo *info;
+    IWICComponentInfo *info, *info2;
     IWICMetadataReaderInfo *reader_info;
     HRESULT hr;
     CLSID clsid;
     GUID container_formats[10];
-    UINT count, size;
+    UINT count, size, tid;
+    HANDLE thread;
     WICMetadataPattern *patterns;
 
+    hr = get_component_info(&CLSID_WICUnknownMetadataReader, &info2);
+    ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
+    IWICComponentInfo_Release(info2);
+
     hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
         &IID_IWICImagingFactory, (void**)&factory);
     ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
@@ -488,6 +508,11 @@ static void test_reader_info(void)
 
     hr = IWICImagingFactory_CreateComponentInfo(factory, &CLSID_WICUnknownMetadataReader, &info);
     ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
+    ok(info == info2, "info != info2\n");
+
+    thread = CreateThread(NULL, 0, cache_across_threads_test, info, 0, &tid);
+    WaitForSingleObject(thread, INFINITE);
+    CloseHandle(thread);
 
     hr = IWICComponentInfo_QueryInterface(info, &IID_IWICMetadataReaderInfo, (void**)&reader_info);
     ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);