Author: akhaldi
Date: Mon Nov 23 09:52:05 2015
New Revision: 70066
URL:
http://svn.reactos.org/svn/reactos?rev=70066&view=rev
Log:
[WINDOWSCODECS_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
Modified:
trunk/rostests/winetests/windowscodecs/gifformat.c
trunk/rostests/winetests/windowscodecs/pngformat.c
trunk/rostests/winetests/windowscodecs/tiffformat.c
Modified: trunk/rostests/winetests/windowscodecs/gifformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/g…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/gifformat.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/gifformat.c [iso-8859-1] Mon Nov 23 09:52:05
2015
@@ -86,15 +86,12 @@
static IWICImagingFactory *factory;
-static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size)
+static IStream *create_stream(const void *image_data, UINT image_size)
{
HGLOBAL hmem;
BYTE *data;
HRESULT hr;
- IWICBitmapDecoder *decoder = NULL;
IStream *stream;
- GUID format;
- LONG refcount;
hmem = GlobalAlloc(0, image_size);
data = GlobalLock(hmem);
@@ -103,6 +100,20 @@
hr = CreateStreamOnHGlobal(hmem, TRUE, &stream);
ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
+
+ return stream;
+}
+
+static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size)
+{
+ HRESULT hr;
+ IWICBitmapDecoder *decoder;
+ IStream *stream;
+ GUID format;
+ LONG refcount;
+
+ stream = create_stream(image_data, image_size);
+ if (!stream) return NULL;
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0,
&decoder);
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
@@ -408,6 +419,83 @@
IWICBitmapDecoder_Release(decoder);
}
+static const char gif_with_trailer_1[] = {
+/* LSD
*/'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x80,0x00,0x00,
+/* palette */0xff,0xff,0xff,0xff,0xff,0xff,
+/* IMD */0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
+/* image data */0x02,0x02,0x44,0x01,0x00,0x3b
+};
+static const char gif_with_trailer_2[] = {
+/* LSD
*/'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x00,0x00,0x00,
+/* IMD */0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
+/* image data */0x02,0x02,0x44,0x3b
+};
+static const char gif_without_trailer_1[] = {
+/* LSD
*/'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x80,0x00,0x00,
+/* palette */0xff,0xff,0xff,0xff,0xff,0xff,
+/* IMD */0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
+/* image data */0x02,0x02,0x44,0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef
+};
+
+static const char gif_without_trailer_2[] = {
+/* LSD
*/'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0x00,0x00,0x00,
+/* IMD */0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
+/* image data */0x02,0x02,0x44,0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef
+};
+
+static void test_truncated_gif(void)
+{
+ HRESULT hr;
+ IStream *stream;
+ IWICBitmapDecoder *decoder;
+ GUID format;
+
+ stream = create_stream(gif_with_trailer_1, sizeof(gif_with_trailer_1));
+ if (!stream) return;
+
+ hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0,
&decoder);
+ ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
+ hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
+ ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
+ ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
+ "wrong container format %s\n", wine_dbgstr_guid(&format));
+ IWICBitmapDecoder_Release(decoder);
+ IStream_Release(stream);
+
+ stream = create_stream(gif_with_trailer_2, sizeof(gif_with_trailer_2));
+ if (!stream) return;
+ hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0,
&decoder);
+ ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
+ hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
+ ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
+ ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
+ "wrong container format %s\n", wine_dbgstr_guid(&format));
+ IWICBitmapDecoder_Release(decoder);
+ IStream_Release(stream);
+
+ stream = create_stream(gif_without_trailer_1, sizeof(gif_without_trailer_1));
+ if (!stream) return;
+ hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0,
&decoder);
+ ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
+ hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
+ ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
+ ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
+ "wrong container format %s\n", wine_dbgstr_guid(&format));
+ IWICBitmapDecoder_Release(decoder);
+ IStream_Release(stream);
+
+ stream = create_stream(gif_without_trailer_2, sizeof(gif_without_trailer_2));
+ if (!stream) return;
+ hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0,
&decoder);
+ ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
+ hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
+ ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
+ ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
+ "wrong container format %s\n", wine_dbgstr_guid(&format));
+ IWICBitmapDecoder_Release(decoder);
+ IStream_Release(stream);
+}
+
START_TEST(gifformat)
{
HRESULT hr;
@@ -434,6 +522,7 @@
test_global_gif_palette_2frames();
test_local_gif_palette();
test_gif_frame_sizes();
+ test_truncated_gif();
IWICImagingFactory_Release(factory);
}
Modified: trunk/rostests/winetests/windowscodecs/pngformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/p…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/pngformat.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/pngformat.c [iso-8859-1] Mon Nov 23 09:52:05
2015
@@ -301,6 +301,7 @@
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0,
&decoder);
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
+ if (FAILED(hr)) return NULL;
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
@@ -348,6 +349,7 @@
decoder = create_decoder(png_no_color_profile, sizeof(png_no_color_profile));
ok(decoder != 0, "Failed to load PNG image data\n");
+ if (!decoder) return;
/* global color context */
hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, NULL);
@@ -375,6 +377,7 @@
decoder = create_decoder(png_color_profile, sizeof(png_color_profile));
ok(decoder != 0, "Failed to load PNG image data\n");
+ if (!decoder) return;
/* global color context */
count = 0xdeadbeef;
@@ -552,6 +555,7 @@
decoder = create_decoder(png_PLTE_tRNS, sizeof(png_PLTE_tRNS));
ok(decoder != 0, "Failed to load PNG image data\n");
+ if (!decoder) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
Modified: trunk/rostests/winetests/windowscodecs/tiffformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/t…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/tiffformat.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/tiffformat.c [iso-8859-1] Mon Nov 23 09:52:05
2015
@@ -176,6 +176,7 @@
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0,
&decoder);
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
+ if (FAILED(hr)) return NULL;
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guid);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
@@ -196,6 +197,7 @@
decoder = create_decoder(&tiff_1bpp_data, sizeof(tiff_1bpp_data));
ok(decoder != 0, "Failed to load TIFF image data\n");
+ if (!decoder) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
@@ -237,6 +239,7 @@
hr = IWICImagingFactory_CreateDecoder(factory, &GUID_ContainerFormatTiff, NULL,
&decoder);
ok(hr == S_OK, "CreateDecoder error %#x\n", hr);
+ if (FAILED(hr)) return;
frame_count = 0xdeadbeef;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
@@ -328,6 +331,7 @@
decoder = create_decoder(&tiff_8bpp_alpha, sizeof(tiff_8bpp_alpha));
ok(decoder != 0, "Failed to load TIFF image data\n");
+ if (!decoder) return;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);