From 40ac828ca5888b6a14ae9c37124d47bc296e2e57 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 22 Jul 2015 00:45:50 +0000 Subject: [PATCH] [WINDOWSCODECS_WINETEST] Sync with Wine Staging 1.7.47. CORE-9924 svn path=/trunk/; revision=68544 --- rostests/winetests/windowscodecs/bitmap.c | 4 +- rostests/winetests/windowscodecs/gifformat.c | 88 ++++++++++++++- rostests/winetests/windowscodecs/info.c | 3 +- rostests/winetests/windowscodecs/metadata.c | 76 ++++++++++++- rostests/winetests/windowscodecs/pngformat.c | 4 +- rostests/winetests/windowscodecs/tiffformat.c | 105 +++++++++++++++++- 6 files changed, 268 insertions(+), 12 deletions(-) diff --git a/rostests/winetests/windowscodecs/bitmap.c b/rostests/winetests/windowscodecs/bitmap.c index d323f8f5b51..32fcde3c7d1 100644 --- a/rostests/winetests/windowscodecs/bitmap.c +++ b/rostests/winetests/windowscodecs/bitmap.c @@ -661,7 +661,7 @@ static void test_CreateBitmapFromHICON(void) ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA), "unexpected pixel format %s\n", wine_dbgstr_guid(&format)); - IWICBitmap_GetSize(bitmap, &width, &height); + hr = IWICBitmap_GetSize(bitmap, &width, &height); ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr); ok(width == 16, "expected 16, got %u\n", width); ok(height == 16, "expected 16, got %u\n", height); @@ -689,7 +689,7 @@ static void test_CreateBitmapFromHICON(void) ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA), "unexpected pixel format %s\n", wine_dbgstr_guid(&format)); - IWICBitmap_GetSize(bitmap, &width, &height); + hr = IWICBitmap_GetSize(bitmap, &width, &height); ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr); ok(width == 16, "expected 16, got %u\n", width); ok(height == 16, "expected 16, got %u\n", height); diff --git a/rostests/winetests/windowscodecs/gifformat.c b/rostests/winetests/windowscodecs/gifformat.c index a66cfd0554a..61111ba00a9 100644 --- a/rostests/winetests/windowscodecs/gifformat.c +++ b/rostests/winetests/windowscodecs/gifformat.c @@ -31,6 +31,8 @@ #include #include +HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT, IWICImagingFactory**); + static const char gif_global_palette[] = { /* LSD */'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0xa1,0x02,0x00, /* palette */0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c, @@ -61,6 +63,27 @@ static const char gif_local_palette[] = { 0x02,0x02,0x44,0x01,0x00,0x3b }; +/* Generated with ImageMagick: + * convert -delay 100 -size 2x2 xc:red \ + * -dispose none -page +0+0 -size 2x1 xc:white \ + * test.gif + */ +static const char gif_frame_sizes[] = { + 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x02, 0x00, + 0x02, 0x00, 0xf1, 0x00, 0x00, 0xff, 0x00, 0x00, + 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, + 0x00, 0x21, 0xf9, 0x04, 0x00, 0x64, 0x00, 0x00, + 0x00, 0x21, 0xff, 0x0b, 0x4e, 0x45, 0x54, 0x53, + 0x43, 0x41, 0x50, 0x45, 0x32, 0x2e, 0x30, 0x03, + 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x03, + 0x44, 0x34, 0x05, 0x00, 0x21, 0xf9, 0x04, 0x04, + 0x64, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x01, 0x00, 0x80, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x0a, + 0x00, 0x3b +}; + static IWICImagingFactory *factory; static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size) @@ -71,6 +94,7 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size IWICBitmapDecoder *decoder = NULL; IStream *stream; GUID format; + LONG refcount; hmem = GlobalAlloc(0, image_size); data = GlobalLock(hmem); @@ -88,7 +112,8 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size ok(IsEqualGUID(&format, &GUID_ContainerFormatGif), "wrong container format %s\n", wine_dbgstr_guid(&format)); - IStream_Release(stream); + refcount = IStream_Release(stream); + ok(refcount > 0, "expected stream refcount > 0\n"); return decoder; } @@ -334,6 +359,55 @@ static void test_local_gif_palette(void) IWICBitmapDecoder_Release(decoder); } +static void test_gif_frame_sizes(void) +{ + static const BYTE frame0[] = {0, 1, 0xfe, 0xfe, 2, 3, 0xfe, 0xfe}; + static const BYTE frame1[] = {0, 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; + + IWICBitmapDecoder *decoder; + IWICBitmapFrameDecode *frame; + UINT width, height; + BYTE buf[8]; + HRESULT hr; + + decoder = create_decoder(gif_frame_sizes, sizeof(gif_frame_sizes)); + ok(decoder != 0, "Failed to load GIF image data\n"); + + hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); + ok(hr == S_OK, "GetFrame error %#x\n", hr); + + hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height); + ok(hr == S_OK, "GetSize error %x\n", hr); + ok(width == 2, "width = %d\n", width); + ok(height == 2, "height = %d\n", height); + + memset(buf, 0xfe, sizeof(buf)); + hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 4, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %x\n", hr); + ok(!memcmp(buf, frame0, sizeof(buf)), "buf = %x %x %x %x %x %x %x %x\n", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); + + IWICBitmapFrameDecode_Release(frame); + + hr = IWICBitmapDecoder_GetFrame(decoder, 1, &frame); + ok(hr == S_OK, "GetFrame error %#x\n", hr); + + hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height); + ok(hr == S_OK, "GetSize error %x\n", hr); + ok(width == 2, "width = %d\n", width); + ok(height == 1, "height = %d\n", height); + + memset(buf, 0xfe, sizeof(buf)); + hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 4, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %x\n", hr); + ok(!memcmp(buf, frame1, sizeof(buf)), "buf = %x %x %x %x %x %x %x %x\n", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); + + IWICBitmapFrameDecode_Release(frame); + + IWICBitmapDecoder_Release(decoder); +} + START_TEST(gifformat) { HRESULT hr; @@ -347,7 +421,19 @@ START_TEST(gifformat) test_global_gif_palette(); test_global_gif_palette_2frames(); test_local_gif_palette(); + test_gif_frame_sizes(); IWICImagingFactory_Release(factory); CoUninitialize(); + + /* run the same tests with no COM initialization */ + hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory); + ok(hr == S_OK, "WICCreateImagingFactory_Proxy error %#x\n", hr); + + test_global_gif_palette(); + test_global_gif_palette_2frames(); + test_local_gif_palette(); + test_gif_frame_sizes(); + + IWICImagingFactory_Release(factory); } diff --git a/rostests/winetests/windowscodecs/info.c b/rostests/winetests/windowscodecs/info.c index d5bfcc251bf..e1a3a5980b0 100644 --- a/rostests/winetests/windowscodecs/info.c +++ b/rostests/winetests/windowscodecs/info.c @@ -85,6 +85,7 @@ static void test_decoder_info(void) int i; hr = get_component_info(&CLSID_WICBmpDecoder, &info); + ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr); hr = IWICComponentInfo_QueryInterface(info, &IID_IWICBitmapDecoderInfo, (void**)&decoder_info); ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr); @@ -227,7 +228,7 @@ static void test_pixelformat_info(void) memset(value, 0xaa, 256 * sizeof(WCHAR)); hr = IWICComponentInfo_GetAuthor(info, len-1, value, NULL); ok(hr == E_INVALIDARG, "GetAuthor failed, hr=%x\n", hr); - ok(value[0] = 0xaaaa, "string modified\n"); + ok(value[0] == 0xaaaa, "string modified\n"); len = 0xdeadbeef; memset(value, 0xaa, 256 * sizeof(WCHAR)); diff --git a/rostests/winetests/windowscodecs/metadata.c b/rostests/winetests/windowscodecs/metadata.c index 7ae29430ff9..12d2ec09f18 100644 --- a/rostests/winetests/windowscodecs/metadata.c +++ b/rostests/winetests/windowscodecs/metadata.c @@ -142,6 +142,13 @@ static const char metadata_tEXt[] = { 0x3f,0x64,0x19,0xf3 /* chunk CRC */ }; +static const char metadata_gAMA[] = { + 0,0,0,4, /* chunk length */ + 'g','A','M','A', /* chunk type */ + 0,0,130,53, /* gamma */ + 0xff,0xff,0xff,0xff /* chunk CRC */ +}; + static const char pngimage[285] = { 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52, 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x08,0x02,0x00,0x00,0x00,0x90,0x77,0x53, @@ -410,6 +417,51 @@ static void test_metadata_tEXt(void) IWICMetadataReader_Release(reader); } +static void test_metadata_gAMA(void) +{ + HRESULT hr; + IWICMetadataReader *reader; + PROPVARIANT schema, id, value; + ULONG count; + GUID format; + static const WCHAR ImageGamma[] = {'I','m','a','g','e','G','a','m','m','a',0}; + + PropVariantInit(&schema); + PropVariantInit(&id); + PropVariantInit(&value); + + hr = CoCreateInstance(&CLSID_WICPngGamaMetadataReader, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICMetadataReader, (void**)&reader); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /*winxp*/, "CoCreateInstance failed, hr=%x\n", hr); + if (FAILED(hr)) return; + + load_stream((IUnknown*)reader, metadata_gAMA, sizeof(metadata_gAMA), WICPersistOptionsDefault); + + hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%x\n", hr); + ok(IsEqualGUID(&format, &GUID_MetadataFormatChunkgAMA), "unexpected format %s\n", wine_dbgstr_guid(&format)); + + hr = IWICMetadataReader_GetCount(reader, &count); + ok(hr == S_OK, "GetCount failed, hr=%x\n", hr); + ok(count == 1, "unexpected count %i\n", count); + + hr = IWICMetadataReader_GetValueByIndex(reader, 0, &schema, &id, &value); + ok(hr == S_OK, "GetValue failed, hr=%x\n", hr); + + ok(schema.vt == VT_EMPTY, "unexpected vt: %i\n", schema.vt); + PropVariantClear(&schema); + + ok(id.vt == VT_LPWSTR, "unexpected vt: %i\n", id.vt); + ok(!lstrcmpW(U(id).pwszVal, ImageGamma), "unexpected value: %s\n", wine_dbgstr_w(U(id).pwszVal)); + PropVariantClear(&id); + + ok(value.vt == VT_UI4, "unexpected vt: %i\n", value.vt); + ok(U(value).ulVal == 33333, "unexpected value: %u\n", U(value).ulVal); + PropVariantClear(&value); + + IWICMetadataReader_Release(reader); +} + static inline USHORT ushort_bswap(USHORT s) { return (s >> 8) | (s << 8); @@ -951,11 +1003,11 @@ static void test_metadata_png(void) ok(IsEqualGUID(&containerformat, &GUID_ContainerFormatPng), "unexpected container format\n"); hr = IWICMetadataBlockReader_GetCount(blockreader, NULL); - todo_wine ok(hr == E_INVALIDARG, "GetCount failed, hr=%x\n", hr); + ok(hr == E_INVALIDARG, "GetCount failed, hr=%x\n", hr); hr = IWICMetadataBlockReader_GetCount(blockreader, &count); - todo_wine ok(hr == S_OK, "GetCount failed, hr=%x\n", hr); - todo_wine ok(count == 1, "unexpected count %d\n", count); + ok(hr == S_OK, "GetCount failed, hr=%x\n", hr); + ok(count == 1, "unexpected count %d\n", count); if (0) { @@ -965,18 +1017,19 @@ static void test_metadata_png(void) } hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 0, &reader); - todo_wine ok(hr == S_OK, "GetReaderByIndex failed, hr=%x\n", hr); + ok(hr == S_OK, "GetReaderByIndex failed, hr=%x\n", hr); if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &containerformat); - ok(IsEqualGUID(&containerformat, &GUID_MetadataFormatChunktIME) || + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); + todo_wine ok(IsEqualGUID(&containerformat, &GUID_MetadataFormatChunktIME) || broken(IsEqualGUID(&containerformat, &GUID_MetadataFormatUnknown)) /* Windows XP */, "unexpected container format\n"); hr = IWICMetadataReader_GetCount(reader, &count); ok(hr == S_OK, "GetCount error %#x\n", hr); - ok(count == 6 || broken(count == 1) /* XP */, "expected 6, got %u\n", count); + todo_wine ok(count == 6 || broken(count == 1) /* XP */, "expected 6, got %u\n", count); if (count == 6) compare_metadata(reader, td, count); @@ -1114,6 +1167,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatLSD), /* Logical Screen Descriptor */ "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1162,6 +1216,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatIMD), /* Image Descriptor */ "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1215,6 +1270,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatLSD), /* Logical Screen Descriptor */ "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1233,6 +1289,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatAPE), /* Application Extension */ "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1251,6 +1308,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatGifComment), /* Comment Extension */ "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1269,6 +1327,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatUnknown), "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1317,6 +1376,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatIMD), /* Image Descriptor */ "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1335,6 +1395,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatGifComment), /* Comment Extension */ "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1354,6 +1415,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatUnknown), "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1372,6 +1434,7 @@ static void test_metadata_gif(void) if (SUCCEEDED(hr)) { hr = IWICMetadataReader_GetMetadataFormat(reader, &format); + ok(hr == S_OK, "GetMetadataFormat failed, hr=%#x\n", hr); ok(IsEqualGUID(&format, &GUID_MetadataFormatGCE), /* Graphic Control Extension */ "wrong metadata format %s\n", wine_dbgstr_guid(&format)); @@ -1799,6 +1862,7 @@ START_TEST(metadata) test_metadata_unknown(); test_metadata_tEXt(); + test_metadata_gAMA(); test_metadata_IFD(); test_metadata_Exif(); test_create_reader(); diff --git a/rostests/winetests/windowscodecs/pngformat.c b/rostests/winetests/windowscodecs/pngformat.c index 7b1ccd5902a..97c87d4c6e0 100644 --- a/rostests/winetests/windowscodecs/pngformat.c +++ b/rostests/winetests/windowscodecs/pngformat.c @@ -289,6 +289,7 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size IWICBitmapDecoder *decoder = NULL; IStream *stream; GUID format; + LONG refcount; hmem = GlobalAlloc(0, image_size); data = GlobalLock(hmem); @@ -306,7 +307,8 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size ok(IsEqualGUID(&format, &GUID_ContainerFormatPng), "wrong container format %s\n", wine_dbgstr_guid(&format)); - IStream_Release(stream); + refcount = IStream_Release(stream); + ok(refcount > 0, "expected stream refcount > 0\n"); return decoder; } diff --git a/rostests/winetests/windowscodecs/tiffformat.c b/rostests/winetests/windowscodecs/tiffformat.c index fa4371d3104..57c8435aedb 100644 --- a/rostests/winetests/windowscodecs/tiffformat.c +++ b/rostests/winetests/windowscodecs/tiffformat.c @@ -98,7 +98,49 @@ static const struct tiff_1bpp_data { 900, 3 }, { 0x11, 0x22, 0x33, 0 } }; -#include + +static const struct tiff_8bpp_alpha +{ + USHORT byte_order; + USHORT version; + ULONG dir_offset; + USHORT number_of_entries; + struct IFD_entry entry[15]; + ULONG next_IFD; + struct IFD_rational res; + BYTE pixel_data[8]; +} tiff_8bpp_alpha = +{ +#ifdef WORDS_BIGENDIAN + 'M' | 'M' << 8, +#else + 'I' | 'I' << 8, +#endif + 42, + FIELD_OFFSET(struct tiff_8bpp_alpha, number_of_entries), + 15, + { + { 0xff, IFD_SHORT, 1, 0 }, /* SUBFILETYPE */ + { 0x100, IFD_LONG, 1, 2 }, /* IMAGEWIDTH */ + { 0x101, IFD_LONG, 1, 2 }, /* IMAGELENGTH */ + { 0x102, IFD_SHORT, 2, MAKELONG(8, 8) }, /* BITSPERSAMPLE */ + { 0x103, IFD_SHORT, 1, 1 }, /* COMPRESSION: XP doesn't accept IFD_LONG here */ + { 0x106, IFD_SHORT, 1, 1 }, /* PHOTOMETRIC */ + { 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_8bpp_alpha, pixel_data) }, /* STRIPOFFSETS */ + { 0x115, IFD_SHORT, 1, 2 }, /* SAMPLESPERPIXEL */ + { 0x116, IFD_LONG, 1, 2 }, /* ROWSPERSTRIP */ + { 0x117, IFD_LONG, 1, 8 }, /* STRIPBYTECOUNT */ + { 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_8bpp_alpha, res) }, + { 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_8bpp_alpha, res) }, + { 0x11c, IFD_SHORT, 1, 1 }, /* PLANARCONFIGURATION */ + { 0x128, IFD_SHORT, 1, 2 }, /* RESOLUTIONUNIT */ + { 0x152, IFD_SHORT, 1, 1 } /* EXTRASAMPLES: 1 - Associated alpha with pre-multiplied color */ + }, + 0, + { 96, 1 }, + { 0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88 } +}; +#include "poppack.h" static IWICImagingFactory *factory; @@ -270,6 +312,66 @@ todo_wine IStream_Release(stream); } +static void test_tiff_8bpp_alpha(void) +{ + HRESULT hr; + IWICBitmapDecoder *decoder; + IWICBitmapFrameDecode *frame; + UINT frame_count, width, height, i; + double dpi_x, dpi_y; + IWICPalette *palette; + GUID format; + WICRect rc; + BYTE data[16]; + static const BYTE expected_data[16] = { 0x11,0x11,0x11,0x22,0x33,0x33,0x33,0x44, + 0x55,0x55,0x55,0x66,0x77,0x77,0x77,0x88 }; + + decoder = create_decoder(&tiff_8bpp_alpha, sizeof(tiff_8bpp_alpha)); + ok(decoder != 0, "Failed to load TIFF image data\n"); + + hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count); + ok(hr == S_OK, "GetFrameCount error %#x\n", hr); + ok(frame_count == 1, "expected 1, got %u\n", frame_count); + + hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); + ok(hr == S_OK, "GetFrame error %#x\n", hr); + + hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height); + ok(hr == S_OK, "GetSize error %#x\n", hr); + ok(width == 2, "expected 2, got %u\n", width); + ok(height == 2, "expected 2, got %u\n", height); + + hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y); + ok(hr == S_OK, "GetResolution error %#x\n", hr); + ok(dpi_x == 96.0, "expected 96.0, got %f\n", dpi_x); + ok(dpi_y == 96.0, "expected 96.0, got %f\n", dpi_y); + + hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format); + ok(hr == S_OK, "GetPixelFormat error %#x\n", hr); + ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppPBGRA), + "got wrong format %s\n", wine_dbgstr_guid(&format)); + + hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(hr == S_OK, "CreatePalette error %#x\n", hr); + hr = IWICBitmapFrameDecode_CopyPalette(frame, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, + "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#x\n", hr); + IWICPalette_Release(palette); + + rc.X = 0; + rc.Y = 0; + rc.Width = 2; + rc.Height = 2; + hr = IWICBitmapFrameDecode_CopyPixels(frame, &rc, 8, sizeof(data), data); + ok(hr == S_OK, "CopyPixels error %#x\n", hr); + + for (i = 0; i < sizeof(data); i++) + ok(data[i] == expected_data[i], "%u: expected %02x, got %02x\n", i, expected_data[i], data[i]); + + IWICBitmapFrameDecode_Release(frame); + IWICBitmapDecoder_Release(decoder); +} + START_TEST(tiffformat) { HRESULT hr; @@ -283,6 +385,7 @@ START_TEST(tiffformat) test_tiff_palette(); test_QueryCapability(); + test_tiff_8bpp_alpha(); IWICImagingFactory_Release(factory); CoUninitialize(); -- 2.17.1