Rebase against 8b1737c0fdf1d3d905bea281d9241f1f48f333e9.

This commit is contained in:
Sebastian Lackner
2017-04-10 07:36:39 +02:00
parent 25bd49ecb6
commit e4ac3ea735
12 changed files with 122 additions and 328 deletions

View File

@@ -1,40 +1,36 @@
From ea8d7d6e5661a0cf96ca5a224a60474535ff8157 Mon Sep 17 00:00:00 2001
From df6bff3ca093f772ae40bc98ae32fcd3c19aa963 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 4 Oct 2016 18:20:31 +0800
Subject: windowscodecs/tests: Make create_decoder() return an error code in
PNG tests.
---
dlls/windowscodecs/tests/pngformat.c | 51 ++++++++++++++++++------------------
1 file changed, 26 insertions(+), 25 deletions(-)
dlls/windowscodecs/tests/pngformat.c | 63 ++++++++++++++++++------------------
1 file changed, 32 insertions(+), 31 deletions(-)
diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c
index 296866f..95393c9 100644
index 58f698d987..5d11c65f1d 100644
--- a/dlls/windowscodecs/tests/pngformat.c
+++ b/dlls/windowscodecs/tests/pngformat.c
@@ -275,16 +275,17 @@ static const char png_color_profile[] = {
@@ -276,37 +276,38 @@ static const char png_color_profile[] = {
static IWICImagingFactory *factory;
-static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size)
+static HRESULT create_decoder(const void *image_data, UINT image_size, IWICBitmapDecoder **decoder)
{
HGLOBAL hmem;
BYTE *data;
HRESULT hr;
- IWICBitmapDecoder *decoder = NULL;
IStream *stream;
GUID format;
LONG refcount;
ULARGE_INTEGER pos;
LARGE_INTEGER zero;
+ *decoder = NULL;
+
hmem = GlobalAlloc(0, image_size);
data = GlobalLock(hmem);
memcpy(data, image_data, image_size);
@@ -293,19 +294,19 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
hr = CreateStreamOnHGlobal(hmem, TRUE, &stream);
ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
stream = SHCreateMemStream (image_data, image_size);
ok(stream != NULL, "SHCreateMemStream error\n");
- hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
- ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
@@ -44,6 +40,14 @@ index 296866f..95393c9 100644
- ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
- ok(IsEqualGUID(&format, &GUID_ContainerFormatPng),
- "wrong container format %s\n", wine_dbgstr_guid(&format));
-
- zero.QuadPart = 0;
- IStream_Seek (stream, zero, STREAM_SEEK_CUR, &pos);
- ok(pos.QuadPart < image_size, "seek beyond the end of stream: %x%08x >= %x\n",
- (UINT)(pos.QuadPart >> 32), (UINT)pos.QuadPart, image_size);
-
- refcount = IStream_Release(stream);
- ok(refcount > 0, "expected stream refcount > 0\n");
+ hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, decoder);
+ if (hr == S_OK)
+ {
@@ -51,9 +55,12 @@ index 296866f..95393c9 100644
+ ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
+ ok(IsEqualGUID(&format, &GUID_ContainerFormatPng),
+ "wrong container format %s\n", wine_dbgstr_guid(&format));
- refcount = IStream_Release(stream);
- ok(refcount > 0, "expected stream refcount > 0\n");
+
+ zero.QuadPart = 0;
+ IStream_Seek (stream, zero, STREAM_SEEK_CUR, &pos);
+ ok(pos.QuadPart < image_size, "seek beyond the end of stream: %x%08x >= %x\n",
+ (UINT)(pos.QuadPart >> 32), (UINT)pos.QuadPart, image_size);
+
+ refcount = IStream_Release(stream);
+ ok(refcount > 0, "expected stream refcount > 0\n");
+ }
@@ -63,7 +70,7 @@ index 296866f..95393c9 100644
}
static WCHAR *save_profile( BYTE *buffer, UINT size )
@@ -341,9 +342,9 @@ static void test_color_contexts(void)
@@ -342,9 +343,9 @@ static void test_color_contexts(void)
BYTE *buffer;
BOOL ret;
@@ -76,7 +83,7 @@ index 296866f..95393c9 100644
/* global color context */
hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, NULL);
@@ -369,9 +370,9 @@ static void test_color_contexts(void)
@@ -370,9 +371,9 @@ static void test_color_contexts(void)
IWICBitmapFrameDecode_Release(frame);
IWICBitmapDecoder_Release(decoder);
@@ -89,7 +96,7 @@ index 296866f..95393c9 100644
/* global color context */
count = 0xdeadbeef;
@@ -547,9 +548,9 @@ static void test_png_palette(void)
@@ -548,9 +549,9 @@ static void test_png_palette(void)
UINT count, ret;
WICColor color[256];
@@ -102,7 +109,7 @@ index 296866f..95393c9 100644
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
@@ -617,9 +618,9 @@ static void test_color_formats(void)
@@ -618,9 +619,9 @@ static void test_color_formats(void)
buf[24] = td[i].bit_depth;
buf[25] = td[i].color_type;
@@ -116,5 +123,5 @@ index 296866f..95393c9 100644
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
--
2.9.0
2.11.0