windowscodecs: Test pixel format of the loaded TIFF image.

This commit is contained in:
Dmitry Timoshkov 2012-07-13 11:47:07 +09:00 committed by Alexandre Julliard
parent b82023b7c2
commit 6d1a13a7d6
1 changed files with 19 additions and 0 deletions

View File

@ -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);