Nikolay Sivov : wincodecs/tests: Move gif decoder test to appropriate file.

Alexandre Julliard julliard at winehq.org
Mon Mar 12 17:40:24 CDT 2018


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Mar 12 17:57:50 2018 +0300

wincodecs/tests: Move gif decoder test to appropriate file.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/windowscodecs/tests/bmpformat.c | 75 ------------------------------------
 dlls/windowscodecs/tests/gifformat.c | 75 ++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c
index 48985b9..8bac7a3 100644
--- a/dlls/windowscodecs/tests/bmpformat.c
+++ b/dlls/windowscodecs/tests/bmpformat.c
@@ -1058,80 +1058,6 @@ static void test_createfromstream(void)
     IWICImagingFactory_Release(factory);
 }
 
-/* 1x1 pixel gif, missing trailer */
-static unsigned char gifimage_notrailer[] = {
-0x47,0x49,0x46,0x38,0x37,0x61,0x01,0x00,0x01,0x00,0x80,0x00,0x71,0xff,0xff,0xff,
-0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,
-0x01,0x00
-};
-
-static void test_gif_notrailer(void)
-{
-    IWICBitmapDecoder *decoder;
-    IWICImagingFactory *factory;
-    HRESULT hr;
-    IWICStream *gifstream;
-    IWICBitmapFrameDecode *framedecode;
-    double dpiX = 0.0, dpiY = 0.0;
-    UINT framecount;
-
-    hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
-        &IID_IWICImagingFactory, (void**)&factory);
-    ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
-    if (FAILED(hr)) return;
-
-    hr = IWICImagingFactory_CreateStream(factory, &gifstream);
-    ok(hr == S_OK, "CreateStream failed, hr=%x\n", hr);
-    if (SUCCEEDED(hr))
-    {
-        hr = IWICStream_InitializeFromMemory(gifstream, gifimage_notrailer,
-            sizeof(gifimage_notrailer));
-        ok(hr == S_OK, "InitializeFromMemory failed, hr=%x\n", hr);
-
-        if (SUCCEEDED(hr))
-        {
-            hr = CoCreateInstance(&CLSID_WICGifDecoder, NULL, CLSCTX_INPROC_SERVER,
-                &IID_IWICBitmapDecoder, (void**)&decoder);
-            ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
-        }
-
-        if (SUCCEEDED(hr))
-        {
-            hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)gifstream,
-                WICDecodeMetadataCacheOnDemand);
-            ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
-
-            if (SUCCEEDED(hr))
-            {
-                hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
-                ok(hr == S_OK, "GetFrame failed, hr=%x\n", hr);
-                if (SUCCEEDED(hr))
-                {
-                    hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
-                    ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
-                    ok(dpiX == 48.0, "expected dpiX=48.0, got %f\n", dpiX);
-                    ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY);
-
-                    IWICBitmapFrameDecode_Release(framedecode);
-                }
-            }
-
-            if (SUCCEEDED(hr))
-            {
-                hr = IWICBitmapDecoder_GetFrameCount(decoder, &framecount);
-                ok(hr == S_OK, "GetFrameCount failed, hr=%x\n", hr);
-                ok(framecount == 1, "framecount=%u\n", framecount);
-            }
-
-            IWICBitmapDecoder_Release(decoder);
-        }
-
-        IWICStream_Release(gifstream);
-    }
-
-    IWICImagingFactory_Release(factory);
-}
-
 static void test_create_decoder(void)
 {
     IWICBitmapDecoder *decoder;
@@ -1170,7 +1096,6 @@ START_TEST(bmpformat)
     test_decode_rle4();
     test_componentinfo();
     test_createfromstream();
-    test_gif_notrailer();
     test_create_decoder();
 
     CoUninitialize();
diff --git a/dlls/windowscodecs/tests/gifformat.c b/dlls/windowscodecs/tests/gifformat.c
index 53b4e47..05affad 100644
--- a/dlls/windowscodecs/tests/gifformat.c
+++ b/dlls/windowscodecs/tests/gifformat.c
@@ -490,6 +490,80 @@ static void test_truncated_gif(void)
     IStream_Release(stream);
 }
 
+/* 1x1 pixel gif, missing trailer */
+static unsigned char gifimage_notrailer[] = {
+0x47,0x49,0x46,0x38,0x37,0x61,0x01,0x00,0x01,0x00,0x80,0x00,0x71,0xff,0xff,0xff,
+0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,
+0x01,0x00
+};
+
+static void test_gif_notrailer(void)
+{
+    IWICBitmapDecoder *decoder;
+    IWICImagingFactory *factory;
+    HRESULT hr;
+    IWICStream *gifstream;
+    IWICBitmapFrameDecode *framedecode;
+    double dpiX = 0.0, dpiY = 0.0;
+    UINT framecount;
+
+    hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
+        &IID_IWICImagingFactory, (void**)&factory);
+    ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
+    if (FAILED(hr)) return;
+
+    hr = IWICImagingFactory_CreateStream(factory, &gifstream);
+    ok(hr == S_OK, "CreateStream failed, hr=%x\n", hr);
+    if (SUCCEEDED(hr))
+    {
+        hr = IWICStream_InitializeFromMemory(gifstream, gifimage_notrailer,
+            sizeof(gifimage_notrailer));
+        ok(hr == S_OK, "InitializeFromMemory failed, hr=%x\n", hr);
+
+        if (SUCCEEDED(hr))
+        {
+            hr = CoCreateInstance(&CLSID_WICGifDecoder, NULL, CLSCTX_INPROC_SERVER,
+                &IID_IWICBitmapDecoder, (void**)&decoder);
+            ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
+        }
+
+        if (SUCCEEDED(hr))
+        {
+            hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)gifstream,
+                WICDecodeMetadataCacheOnDemand);
+            ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
+
+            if (SUCCEEDED(hr))
+            {
+                hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
+                ok(hr == S_OK, "GetFrame failed, hr=%x\n", hr);
+                if (SUCCEEDED(hr))
+                {
+                    hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
+                    ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
+                    ok(dpiX == 48.0, "expected dpiX=48.0, got %f\n", dpiX);
+                    ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY);
+
+                    IWICBitmapFrameDecode_Release(framedecode);
+                }
+            }
+
+            if (SUCCEEDED(hr))
+            {
+                hr = IWICBitmapDecoder_GetFrameCount(decoder, &framecount);
+                ok(hr == S_OK, "GetFrameCount failed, hr=%x\n", hr);
+                ok(framecount == 1, "framecount=%u\n", framecount);
+            }
+
+            IWICBitmapDecoder_Release(decoder);
+        }
+
+        IWICStream_Release(gifstream);
+    }
+
+    IWICImagingFactory_Release(factory);
+}
+
 START_TEST(gifformat)
 {
     HRESULT hr;
@@ -504,6 +578,7 @@ START_TEST(gifformat)
     test_global_gif_palette_2frames();
     test_local_gif_palette();
     test_gif_frame_sizes();
+    test_gif_notrailer();
 
     IWICImagingFactory_Release(factory);
     CoUninitialize();




More information about the wine-cvs mailing list