Dmitry Timoshkov : windowscodecs: Test pixel format of the loaded TIFF image.

Alexandre Julliard julliard at winehq.org
Fri Jul 13 14:11:18 CDT 2012


Module: wine
Branch: master
Commit: 6d1a13a7d655e4cfec54fe49a038517d2686d7da
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6d1a13a7d655e4cfec54fe49a038517d2686d7da

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Jul 13 11:47:07 2012 +0900

windowscodecs: Test pixel format of the loaded TIFF image.

---

 dlls/windowscodecs/tests/tiffformat.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c
index fb57b91..0874053 100644
--- a/dlls/windowscodecs/tests/tiffformat.c
+++ b/dlls/windowscodecs/tests/tiffformat.c
@@ -17,6 +17,7 @@
  */
 
 #include <stdarg.h>
+#include <stdio.h>
 
 #define COBJMACROS
 
@@ -93,6 +94,18 @@ static const struct tiff_1bpp_data
 };
 #include "poppack.h"
 
+static const char *debugstr_guid(const GUID *guid)
+{
+    static char buf[50];
+
+    if (!guid) return "(null)";
+    sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+            guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
+            guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
+            guid->Data4[5], guid->Data4[6], guid->Data4[7]);
+    return buf;
+}
+
 static IWICBitmapDecoder *create_decoder(IWICImagingFactory *factory,
                                          const void *image_data, UINT image_size)
 {
@@ -130,6 +143,7 @@ static void test_tiff_palette(void)
     IWICBitmapDecoder *decoder;
     IWICBitmapFrameDecode *frame;
     IWICPalette *palette;
+    GUID format;
 
     hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
                           &IID_IWICImagingFactory, (void **)&factory);
@@ -141,6 +155,11 @@ static void test_tiff_palette(void)
     hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
     ok(hr == S_OK, "GetFrame error %#x\n", hr);
 
+    hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
+    ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
+    ok(IsEqualGUID(&format, &GUID_WICPixelFormatBlackWhite),
+       "got wrong format %s\n", debugstr_guid(&format));
+
     hr = IWICImagingFactory_CreatePalette(factory, &palette);
     ok(hr == S_OK, "CreatePalette error %#x\n", hr);
     hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);




More information about the wine-cvs mailing list