Author: akhaldi
Date: Thu May 23 16:40:21 2013
New Revision: 59072
URL:
http://svn.reactos.org/svn/reactos?rev=59072&view=rev
Log:
[WINDOWSCODECS_WINETEST]
* Sync with Wine 1.5.26.
Added:
trunk/rostests/winetests/windowscodecs/propertybag.c (with props)
Modified:
trunk/rostests/winetests/windowscodecs/CMakeLists.txt
trunk/rostests/winetests/windowscodecs/bitmap.c
trunk/rostests/winetests/windowscodecs/bmpformat.c
trunk/rostests/winetests/windowscodecs/converter.c
trunk/rostests/winetests/windowscodecs/gifformat.c
trunk/rostests/winetests/windowscodecs/icoformat.c
trunk/rostests/winetests/windowscodecs/info.c
trunk/rostests/winetests/windowscodecs/metadata.c
trunk/rostests/winetests/windowscodecs/palette.c
trunk/rostests/winetests/windowscodecs/pngformat.c
trunk/rostests/winetests/windowscodecs/stream.c
trunk/rostests/winetests/windowscodecs/testlist.c
trunk/rostests/winetests/windowscodecs/tiffformat.c
Modified: trunk/rostests/winetests/windowscodecs/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/C…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/CMakeLists.txt [iso-8859-1] Thu May 23 16:40:21
2013
@@ -11,6 +11,7 @@
metadata.c
palette.c
pngformat.c
+ propertybag.c
stream.c
testlist.c
tiffformat.c)
@@ -18,5 +19,5 @@
add_executable(windowscodecs_winetest ${SOURCE})
target_link_libraries(windowscodecs_winetest wine)
set_module_type(windowscodecs_winetest win32cui)
-add_importlibs(windowscodecs_winetest windowscodecs ole32 msvcrt kernel32 ntdll)
-add_cd_file(TARGET version_winetest DESTINATION reactos/bin FOR all)
+add_importlibs(windowscodecs_winetest windowscodecs oleaut32 ole32 user32 gdi32 msvcrt
kernel32 ntdll)
+add_cd_file(TARGET windowscodecs_winetest DESTINATION reactos/bin FOR all)
Modified: trunk/rostests/winetests/windowscodecs/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/b…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/bitmap.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/bitmap.c [iso-8859-1] Thu May 23 16:40:21 2013
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Vincent Povirk for CodeWeavers
+ * Copyright 2012 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -16,17 +17,82 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <stdarg.h>
-#include <math.h>
+//#include <stdarg.h>
+#include <stdio.h>
+#include <assert.h>
+//#include <math.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
#define COBJMACROS
-#include "windef.h"
-#include "objbase.h"
-#include "wincodec.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <wingdi.h>
+#include <objbase.h>
+#include <wincodec.h>
+#include <wine/test.h>
static IWICImagingFactory *factory;
+
+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 HBITMAP create_dib(int width, int height, int bpp, LOGPALETTE *pal, const void
*data)
+{
+ char bmibuf[sizeof(BITMAPINFO) + sizeof(RGBQUAD) * 255];
+ BITMAPINFO *bmi = (BITMAPINFO *)bmibuf;
+ void *bits;
+ HBITMAP hdib;
+ BITMAP bm;
+
+ memset(bmibuf, 0, sizeof(bmibuf));
+ bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
+ bmi->bmiHeader.biWidth = width;
+ bmi->bmiHeader.biHeight = -height;
+ bmi->bmiHeader.biBitCount = bpp;
+ bmi->bmiHeader.biPlanes = 1;
+ bmi->bmiHeader.biCompression = BI_RGB;
+ if (pal)
+ {
+ WORD i;
+
+ assert(pal->palNumEntries <= 256);
+ for (i = 0; i < pal->palNumEntries; i++)
+ {
+ bmi->bmiColors[i].rgbRed = pal->palPalEntry[i].peRed;
+ bmi->bmiColors[i].rgbGreen = pal->palPalEntry[i].peGreen;
+ bmi->bmiColors[i].rgbBlue = pal->palPalEntry[i].peBlue;
+ bmi->bmiColors[i].rgbReserved = 0;
+ }
+
+ bmi->bmiHeader.biClrUsed = pal->palNumEntries;
+ bmi->bmiHeader.biClrImportant = pal->palNumEntries;
+ }
+ hdib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, &bits, NULL, 0);
+ ok(hdib != 0, "CreateDIBSection(%dx%d,%d bpp) failed\n", width, height,
bpp);
+
+ GetObject(hdib, sizeof(bm), &bm);
+ ok(bm.bmWidth == width, "expected %d, got %d\n", width, bm.bmWidth);
+ ok(bm.bmHeight == height, "expected %d, got %d\n", height, bm.bmHeight);
+ ok(bm.bmPlanes == 1, "expected 1, got %d\n", bm.bmPlanes);
+ ok(bm.bmBitsPixel == bpp, "expected %d, got %d\n", bpp, bm.bmBitsPixel);
+
+ if (data) memcpy(bits, data, bm.bmWidthBytes * bm.bmHeight);
+
+ return hdib;
+}
static void test_createbitmap(void)
{
@@ -418,6 +484,297 @@
IWICBitmap_Release(bitmap2);
}
+static void test_CreateBitmapFromMemory(void)
+{
+ BYTE orig_data3x3[27] = {
+ 128,128,255, 128,128,128, 128,255,128,
+ 128,128,128, 128,128,128, 255,255,255,
+ 255,128,128, 255,255,255, 255,255,255 };
+ BYTE data3x3[27];
+ BYTE data3x2[27] = {
+ 128,128,255, 128,128,128, 128,255,128,
+ 0,0,0, 0,128,128, 255,255,255,
+ 255,128,128, 255,0,0, 0,0,0 };
+ BYTE data[27];
+ HRESULT hr;
+ IWICBitmap *bitmap;
+ UINT width, height, i;
+
+ memcpy(data3x3, orig_data3x3, sizeof(data3x3));
+
+ hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 3,
&GUID_WICPixelFormat24bppBGR,
+ 0, 0, NULL, &bitmap);
+ ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 3,
&GUID_WICPixelFormat24bppBGR,
+ 0, sizeof(data3x3), data3x3,
&bitmap);
+ ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 3,
&GUID_WICPixelFormat24bppBGR,
+ 6, sizeof(data3x3), data3x3,
&bitmap);
+ ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 3,
&GUID_WICPixelFormat24bppBGR,
+ 12, sizeof(data3x3), data3x3,
&bitmap);
+ ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "expected
WINCODEC_ERR_INSUFFICIENTBUFFER, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 3,
&GUID_WICPixelFormat24bppBGR,
+ 9, sizeof(data3x3) - 1, data3x3,
&bitmap);
+ ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "expected
WINCODEC_ERR_INSUFFICIENTBUFFER, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 3,
&GUID_WICPixelFormat24bppBGR,
+ 9, sizeof(data3x3), data3x3,
&bitmap);
+ ok(hr == S_OK, "IWICImagingFactory_CreateBitmapFromMemory error %#x\n",
hr);
+
+ hr = IWICBitmap_GetSize(bitmap, &width, &height);
+ ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr);
+ ok(width == 3, "expected 3, got %u\n", width);
+ ok(height == 3, "expected 3, got %u\n", height);
+
+ data3x3[2] = 192;
+
+ memset(data, 0, sizeof(data));
+ hr = IWICBitmap_CopyPixels(bitmap, NULL, 9, sizeof(data), data);
+ ok(hr == S_OK, "IWICBitmap_CopyPixels error %#x\n", hr);
+ for (i = 0; i < sizeof(data); i++)
+ ok(data[i] == orig_data3x3[i], "%u: expected %u, got %u\n", i, data[i],
data3x3[i]);
+
+ IWICBitmap_Release(bitmap);
+
+ hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 2,
&GUID_WICPixelFormat24bppBGR,
+ 13, sizeof(orig_data3x3),
orig_data3x3, &bitmap);
+ ok(hr == S_OK, "IWICImagingFactory_CreateBitmapFromMemory error %#x\n",
hr);
+
+ hr = IWICBitmap_GetSize(bitmap, &width, &height);
+ ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr);
+ ok(width == 3, "expected 3, got %u\n", width);
+ ok(height == 2, "expected 2, got %u\n", height);
+
+ memset(data, 0, sizeof(data));
+ hr = IWICBitmap_CopyPixels(bitmap, NULL, 13, sizeof(data), data);
+ ok(hr == S_OK, "IWICBitmap_CopyPixels error %#x\n", hr);
+ for (i = 0; i < sizeof(data); i++)
+ ok(data[i] == data3x2[i], "%u: expected %u, got %u\n", i, data3x2[i],
data[i]);
+
+ IWICBitmap_Release(bitmap);
+}
+
+static void test_CreateBitmapFromHICON(void)
+{
+ static const char bits[4096];
+ HICON icon;
+ ICONINFO info;
+ HRESULT hr;
+ IWICBitmap *bitmap;
+ UINT width, height;
+ WICPixelFormatGUID format;
+
+ /* 1 bpp mask */
+ info.fIcon = 1;
+ info.xHotspot = 0;
+ info.yHotspot = 0;
+ info.hbmColor = 0;
+ info.hbmMask = CreateBitmap(16, 32, 1, 1, bits);
+ ok(info.hbmMask != 0, "CreateBitmap failed\n");
+ icon = CreateIconIndirect(&info);
+ ok(icon != 0, "CreateIconIndirect failed\n");
+ DeleteObject(info.hbmMask);
+
+ hr = IWICImagingFactory_CreateBitmapFromHICON(factory, 0, NULL);
+ ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromHICON(factory, 0, &bitmap);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_CURSOR_HANDLE), "expected
ERROR_INVALID_CURSOR_HANDLE, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromHICON(factory, icon, NULL);
+ ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromHICON(factory, icon, &bitmap);
+ ok(hr == S_OK, "CreateBitmapFromHICON error %#x\n", hr);
+ DestroyIcon(icon);
+ if (hr != S_OK) return;
+
+ IWICBitmap_GetPixelFormat(bitmap, &format);
+ ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
+ "unexpected pixel format %s\n", debugstr_guid(&format));
+
+ 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);
+
+ IWICBitmap_Release(bitmap);
+
+ /* 24 bpp color, 1 bpp mask */
+ info.fIcon = 1;
+ info.xHotspot = 0;
+ info.yHotspot = 0;
+ info.hbmColor = CreateBitmap(16, 16, 1, 24, bits);
+ ok(info.hbmColor != 0, "CreateBitmap failed\n");
+ info.hbmMask = CreateBitmap(16, 16, 1, 1, bits);
+ ok(info.hbmMask != 0, "CreateBitmap failed\n");
+ icon = CreateIconIndirect(&info);
+ ok(icon != 0, "CreateIconIndirect failed\n");
+ DeleteObject(info.hbmColor);
+ DeleteObject(info.hbmMask);
+
+ hr = IWICImagingFactory_CreateBitmapFromHICON(factory, icon, &bitmap);
+ ok(hr == S_OK, "CreateBitmapFromHICON error %#x\n", hr);
+ DestroyIcon(icon);
+
+ IWICBitmap_GetPixelFormat(bitmap, &format);
+ ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
+ "unexpected pixel format %s\n", debugstr_guid(&format));
+
+ 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);
+
+ IWICBitmap_Release(bitmap);
+}
+
+static void test_CreateBitmapFromHBITMAP(void)
+{
+ /* 8 bpp data must be aligned to a DWORD boundary for a DIB */
+ static const BYTE data_8bpp_pal_dib[12] = { 0,1,2,0, 1,2,0,0, 2,1,0,0 };
+ static const BYTE data_8bpp_rgb_dib[12] = { 0xf0,0x0f,0xff,0, 0x0f,0xff,0xf0,0,
0xf0,0x0f,0xff,0 };
+ static const BYTE data_8bpp_pal_wic[12] = { 0xd,0xe,0x10,0, 0xe,0x10,0xd,0,
0x10,0xe,0xd,0 };
+ static const PALETTEENTRY pal_data[3] = { {0xff,0,0,0}, {0,0xff,0,0}, {0,0,0xff,0}
};
+ char pal_buf[sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * 255];
+ LOGPALETTE *pal = (LOGPALETTE *)pal_buf;
+ HBITMAP hbmp;
+ HPALETTE hpal;
+ BYTE data[12];
+ HRESULT hr;
+ IWICBitmap *bitmap;
+ UINT width, height, i, count;
+ WICPixelFormatGUID format;
+ IWICPalette *palette;
+ WICBitmapPaletteType type;
+
+ /* 8 bpp without palette */
+ hbmp = create_dib(3, 3, 8, NULL, data_8bpp_rgb_dib);
+ ok(hbmp != 0, "failed to create bitmap\n");
+
+ hr = IWICImagingFactory_CreateBitmapFromHBITMAP(factory, 0, 0, WICBitmapCacheOnLoad,
&bitmap);
+todo_wine
+ ok(hr == WINCODEC_ERR_WIN32ERROR || hr == 0x88980003 /*XP*/, "expected
WINCODEC_ERR_WIN32ERROR, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromHBITMAP(factory, hbmp, 0,
WICBitmapCacheOnLoad, NULL);
+todo_wine
+ ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
+
+ hr = IWICImagingFactory_CreateBitmapFromHBITMAP(factory, hbmp, 0,
WICBitmapCacheOnLoad, &bitmap);
+todo_wine
+ ok(hr == S_OK, "CreateBitmapFromHBITMAP error %#x\n", hr);
+ if (hr != S_OK) return;
+
+ IWICBitmap_GetPixelFormat(bitmap, &format);
+ ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
+ "unexpected pixel format %s\n", debugstr_guid(&format));
+
+ hr = IWICBitmap_GetSize(bitmap, &width, &height);
+ ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr);
+ ok(width == 3, "expected 3, got %u\n", width);
+ ok(height == 3, "expected 3, got %u\n", height);
+
+ memset(data, 0, sizeof(data));
+ hr = IWICBitmap_CopyPixels(bitmap, NULL, 4, sizeof(data), data);
+ ok(hr == S_OK, "IWICBitmap_CopyPixels error %#x\n", hr);
+ for (i = 0; i < sizeof(data); i++)
+ ok(data[i] == data_8bpp_rgb_dib[i], "%u: expected %#x, got %#x\n", i,
data_8bpp_rgb_dib[i], data[i]);
+
+ IWICBitmap_Release(bitmap);
+ DeleteObject(hbmp);
+
+ /* 8 bpp with a 3 entries palette */
+ memset(pal_buf, 0, sizeof(pal_buf));
+ pal->palVersion = 0x300;
+ pal->palNumEntries = 3;
+ memcpy(pal->palPalEntry, pal_data, sizeof(pal_data));
+ hpal = CreatePalette(pal);
+ ok(hpal != 0, "CreatePalette failed\n");
+
+ hbmp = create_dib(3, 3, 8, pal, data_8bpp_pal_dib);
+ hr = IWICImagingFactory_CreateBitmapFromHBITMAP(factory, hbmp, hpal,
WICBitmapCacheOnLoad, &bitmap);
+ ok(hr == S_OK, "CreateBitmapFromHBITMAP error %#x\n", hr);
+
+ IWICBitmap_GetPixelFormat(bitmap, &format);
+ ok(IsEqualGUID(&format, &GUID_WICPixelFormat4bppIndexed),
+ "unexpected pixel format %s\n", debugstr_guid(&format));
+
+ hr = IWICBitmap_GetSize(bitmap, &width, &height);
+ ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr);
+ ok(width == 3, "expected 3, got %u\n", width);
+ ok(height == 3, "expected 3, got %u\n", height);
+
+ hr = IWICImagingFactory_CreatePalette(factory, &palette);
+ ok(hr == S_OK, "CreatePalette error %#x\n", hr);
+ hr = IWICBitmap_CopyPalette(bitmap, palette);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+
+ hr = IWICPalette_GetType(palette, &type);
+ ok(hr == S_OK, "%u: GetType error %#x\n", i, hr);
+ ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got
%#x\n", type);
+
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 16, "expected 16, got %u\n", count);
+
+ IWICPalette_Release(palette);
+
+ IWICBitmap_Release(bitmap);
+ DeleteObject(hbmp);
+ DeleteObject(hpal);
+
+ /* 8 bpp with a 256 entries palette */
+ memset(pal_buf, 0, sizeof(pal_buf));
+ pal->palVersion = 0x300;
+ pal->palNumEntries = 256;
+ memcpy(pal->palPalEntry, pal_data, sizeof(pal_data));
+ hpal = CreatePalette(pal);
+ ok(hpal != 0, "CreatePalette failed\n");
+
+ hbmp = create_dib(3, 3, 8, pal, data_8bpp_pal_dib);
+ hr = IWICImagingFactory_CreateBitmapFromHBITMAP(factory, hbmp, hpal,
WICBitmapCacheOnLoad, &bitmap);
+ ok(hr == S_OK, "CreateBitmapFromHBITMAP error %#x\n", hr);
+
+ IWICBitmap_GetPixelFormat(bitmap, &format);
+ ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
+ "unexpected pixel format %s\n", debugstr_guid(&format));
+
+ hr = IWICBitmap_GetSize(bitmap, &width, &height);
+ ok(hr == S_OK, "IWICBitmap_GetSize error %#x\n", hr);
+ ok(width == 3, "expected 3, got %u\n", width);
+ ok(height == 3, "expected 3, got %u\n", height);
+
+ hr = IWICImagingFactory_CreatePalette(factory, &palette);
+ ok(hr == S_OK, "CreatePalette error %#x\n", hr);
+ hr = IWICBitmap_CopyPalette(bitmap, palette);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+
+ hr = IWICPalette_GetType(palette, &type);
+ ok(hr == S_OK, "%u: GetType error %#x\n", i, hr);
+ ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got
%#x\n", type);
+
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 256, "expected 256, got %u\n", count);
+
+ IWICPalette_Release(palette);
+
+ memset(data, 0, sizeof(data));
+ hr = IWICBitmap_CopyPixels(bitmap, NULL, 4, sizeof(data), data);
+ ok(hr == S_OK, "IWICBitmap_CopyPixels error %#x\n", hr);
+ for (i = 0; i < sizeof(data); i++)
+ ok(data[i] == data_8bpp_pal_wic[i], "%u: expected %#x, got %#x\n", i,
data_8bpp_pal_wic[i], data[i]);
+
+ IWICBitmap_Release(bitmap);
+ DeleteObject(hbmp);
+ DeleteObject(hpal);
+}
+
START_TEST(bitmap)
{
HRESULT hr;
@@ -430,6 +787,9 @@
test_createbitmap();
test_createbitmapfromsource();
+ test_CreateBitmapFromMemory();
+ test_CreateBitmapFromHICON();
+ test_CreateBitmapFromHBITMAP();
IWICImagingFactory_Release(factory);
Modified: trunk/rostests/winetests/windowscodecs/bmpformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/b…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/bmpformat.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/bmpformat.c [iso-8859-1] Thu May 23 16:40:21
2013
@@ -19,27 +19,38 @@
#include <stdarg.h>
#include <math.h>
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
#define COBJMACROS
-#include "windef.h"
-#include "initguid.h"
-#include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <initguid.h>
+#include <ole2.h>
+//#include "wincodec.h"
+#include <wincodecsdk.h>
+#include <wine/test.h>
static const char testbmp_24bpp[] = {
/* BITMAPFILEHEADER */
66,77, /* "BM" */
- 50,0,0,0, /* file size */
+ 78,0,0,0, /* file size */
0,0,0,0, /* reserved */
- 26,0,0,0, /* offset to bits */
- /* BITMAPCOREHEADER */
- 12,0,0,0, /* header size */
- 2,0, /* width */
- 3,0, /* height */
+ 54,0,0,0, /* offset to bits */
+ /* BITMAPINFOHEADER */
+ 40,0,0,0, /* header size */
+ 2,0,0,0, /* width */
+ 3,0,0,0, /* height */
1,0, /* planes */
24,0, /* bit count */
+ 0,0,0,0, /* compression */
+ 0,0,0,0, /* image size */
+ 0x74,0x12,0,0, /* X pels per meter => 120 dpi */
+ 0,0,0,0, /* Y pels per meter */
+ 0,0,0,0, /* colors used */
+ 0,0,0,0, /* colors important */
/* bits */
0,0,0, 0,255,0, 0,0,
255,0,0, 255,255,0, 0,0,
@@ -86,7 +97,14 @@
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_Initialize(decoder, bmpstream,
WICDecodeMetadataCacheOnLoad);
- ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
+ ok(hr == S_OK || broken(hr == WINCODEC_ERR_BADIMAGE) /* XP */,
"Initialize failed, hr=%x\n", hr);
+ if (FAILED(hr))
+ {
+ win_skip("BMP decoder failed to initialize\n");
+ GlobalFree(hbmpdata);
+ IWICBitmapDecoder_Release(decoder);
+ return;
+ }
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
Modified: trunk/rostests/winetests/windowscodecs/converter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/c…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/converter.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/converter.c [iso-8859-1] Thu May 23 16:40:21
2013
@@ -19,13 +19,18 @@
#include <stdarg.h>
#include <math.h>
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
#define COBJMACROS
#define CONST_VTABLE
-#include "windef.h"
-#include "objbase.h"
-#include "wincodec.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <ole2.h>
+#include <wincodec.h>
+#include <wine/test.h>
typedef struct bitmap_data {
const WICPixelFormatGUID *format;
@@ -277,6 +282,12 @@
static const struct bitmap_data testdata_24bppBGR = {
&GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR, 4, 2, 96.0, 96.0};
+static const BYTE bits_24bppRGB[] = {
+ 0,0,255, 0,255,0, 255,0,0, 0,0,0,
+ 255,255,0, 255,0,255, 0,255,255, 255,255,255};
+static const struct bitmap_data testdata_24bppRGB = {
+ &GUID_WICPixelFormat24bppRGB, 24, bits_24bppRGB, 4, 2, 96.0, 96.0};
+
static const BYTE bits_32bppBGR[] = {
255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80};
@@ -499,6 +510,16 @@
test_conversion(&testdata_32bppBGRA, &testdata_32bppBGR, "BGRA ->
BGR", 0);
test_conversion(&testdata_32bppBGR, &testdata_32bppBGRA, "BGR ->
BGRA", 0);
test_conversion(&testdata_32bppBGRA, &testdata_32bppBGRA, "BGRA ->
BGRA", 0);
+
+ test_conversion(&testdata_24bppBGR, &testdata_24bppBGR, "24bppBGR ->
24bppBGR", 0);
+ test_conversion(&testdata_24bppBGR, &testdata_24bppRGB, "24bppBGR ->
24bppRGB", 0);
+
+ test_conversion(&testdata_24bppRGB, &testdata_24bppRGB, "24bppRGB ->
24bppRGB", 0);
+ test_conversion(&testdata_24bppRGB, &testdata_24bppBGR, "24bppRGB ->
24bppBGR", 0);
+
+ test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR ->
24bppRGB", 0);
+ test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB ->
32bppBGR", 0);
+
test_invalid_conversion();
test_default_converter();
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] Thu May 23 16:40:21
2013
@@ -19,11 +19,17 @@
#include <stdarg.h>
#include <stdio.h>
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
#define COBJMACROS
-#include "windef.h"
-#include "wincodec.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <ole2.h>
+#include <wincodec.h>
+#include <wine/test.h>
static const char gif_global_palette[] = {
/* LSD
*/'G','I','F','8','7','a',0x01,0x00,0x01,0x00,0xa1,0x02,0x00,
Modified: trunk/rostests/winetests/windowscodecs/icoformat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/i…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/icoformat.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/icoformat.c [iso-8859-1] Thu May 23 16:40:21
2013
@@ -17,14 +17,19 @@
*/
#include <stdarg.h>
-#include <math.h>
+//#include <math.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
#define COBJMACROS
-#include "windef.h"
-#include "objbase.h"
-#include "wincodec.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <objbase.h>
+#include <wincodec.h>
+#include <wine/test.h>
static unsigned char testico_bad_icondirentry_size[] = {
/* ICONDIR */
@@ -133,17 +138,24 @@
if (SUCCEEDED(hr))
{
- UINT width = 0, height = 0;
- IWICBitmapSource *thumbnail = NULL;
+ UINT width, height;
+ IWICBitmapSource *thumbnail;
+ width = height = 0;
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width,
&height);
ok(hr == S_OK, "GetFrameSize failed, hr=%x\n", hr);
ok(width == 16 && height == 16, "framesize=%ux%u\n",
width, height);
hr = IWICBitmapFrameDecode_GetThumbnail(framedecode, &thumbnail);
- todo_wine ok(hr == S_OK, "GetThumbnail failed, hr=%x\n", hr);
-
- if (thumbnail) IWICBitmapSource_Release(thumbnail);
+ ok(hr == S_OK, "GetThumbnail failed, hr=%x\n", hr);
+ if (hr == S_OK)
+ {
+ width = height = 0;
+ hr = IWICBitmapSource_GetSize(thumbnail, &width, &height);
+ ok(hr == S_OK, "GetFrameSize failed, hr=%x\n", hr);
+ ok(width == 16 && height == 16,
"framesize=%ux%u\n", width, height);
+ IWICBitmapSource_Release(thumbnail);
+ }
IWICBitmapFrameDecode_Release(framedecode);
}
Modified: trunk/rostests/winetests/windowscodecs/info.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/i…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/info.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/info.c [iso-8859-1] Thu May 23 16:40:21 2013
@@ -17,18 +17,23 @@
*/
#include <stdio.h>
-#include <stdarg.h>
-#include <math.h>
+//#include <stdarg.h>
+//#include <math.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
#define COBJMACROS
-#include "windef.h"
-#include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
-#include "wine/test.h"
-
-#include "initguid.h"
+#include <windef.h>
+#include <winbase.h>
+#include <objbase.h>
+//#include "wincodec.h"
+#include <wincodecsdk.h>
+#include <wine/test.h>
+
+#include <initguid.h>
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static const char *debugstr_guid(GUID *guid)
Modified: trunk/rostests/winetests/windowscodecs/metadata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/m…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/metadata.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/metadata.c [iso-8859-1] Thu May 23 16:40:21
2013
@@ -18,17 +18,22 @@
*/
#include <stdio.h>
-#include <stdarg.h>
-#include <math.h>
+//#include <stdarg.h>
+//#include <math.h>
#include <assert.h>
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
#define COBJMACROS
-#include "windef.h"
-#include "objbase.h"
-#include "wincodec.h"
-#include "wincodecsdk.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <ole2.h>
+//#include "wincodec.h"
+#include <wincodecsdk.h>
+#include <wine/test.h>
#define expect_blob(propvar, data, length) do { \
ok((propvar).vt == VT_BLOB, "unexpected vt: %i\n", (propvar).vt); \
Modified: trunk/rostests/winetests/windowscodecs/palette.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/p…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/palette.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/palette.c [iso-8859-1] Thu May 23 16:40:21
2013
@@ -20,12 +20,17 @@
#include <stdarg.h>
#include <assert.h>
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
#define COBJMACROS
-#include "windef.h"
-#include "objbase.h"
-#include "wincodec.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <objbase.h>
+#include <wincodec.h>
+#include <wine/test.h>
static void test_custom_palette(void)
{
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] Thu May 23 16:40:21
2013
@@ -17,14 +17,20 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <stdarg.h>
+//#include <stdarg.h>
#include <stdio.h>
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
#define COBJMACROS
-#include "windef.h"
-#include "wincodec.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <ole2.h>
+#include <wincodec.h>
+#include <wine/test.h>
/* 1x1 pixel PNG image */
static const char png_no_color_profile[] = {
@@ -317,6 +323,27 @@
return decoder;
}
+static WCHAR *save_profile( BYTE *buffer, UINT size )
+{
+ static const WCHAR tstW[] = {'t','s','t',0};
+ WCHAR path[MAX_PATH], filename[MAX_PATH], *ret;
+ HANDLE handle;
+ DWORD count;
+
+ GetTempPathW(MAX_PATH, path);
+ GetTempFileNameW(path, tstW, 0, filename);
+
+ handle = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+ if (handle == INVALID_HANDLE_VALUE) return NULL;
+
+ WriteFile(handle, buffer, size, &count, NULL);
+ CloseHandle( handle );
+
+ ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(filename) + 1) * sizeof(WCHAR));
+ lstrcpyW(ret, filename);
+ return ret;
+}
+
static void test_color_contexts(void)
{
HRESULT hr;
@@ -325,7 +352,9 @@
IWICColorContext *context;
WICColorContextType type;
UINT count, colorspace, size;
+ WCHAR *tmpfile;
BYTE *buffer;
+ BOOL ret;
decoder = create_decoder(png_no_color_profile, sizeof(png_no_color_profile));
ok(decoder != 0, "Failed to load PNG image data\n");
@@ -453,6 +482,8 @@
buffer = HeapAlloc(GetProcessHeap(), 0, size);
hr = IWICColorContext_GetProfileBytes(context, size, buffer, &size);
ok(hr == S_OK, "GetProfileBytes error %#x\n", hr);
+
+ tmpfile = save_profile( buffer, size );
HeapFree(GetProcessHeap(), 0, buffer);
type = 0xdeadbeef;
@@ -468,7 +499,94 @@
hr = IWICColorContext_InitializeFromExifColorSpace(context, 1);
ok(hr == WINCODEC_ERR_WRONGSTATE, "InitializeFromExifColorSpace error
%#x\n", hr);
+ if (tmpfile)
+ {
+ hr = IWICColorContext_InitializeFromFilename(context, NULL);
+ ok(hr == E_INVALIDARG, "InitializeFromFilename error %#x\n", hr);
+
+ hr = IWICColorContext_InitializeFromFilename(context, tmpfile);
+ ok(hr == S_OK, "InitializeFromFilename error %#x\n", hr);
+
+ ret = DeleteFileW(tmpfile);
+ ok(ret, "DeleteFileW failed %u\n", GetLastError());
+
+ type = 0xdeadbeef;
+ hr = IWICColorContext_GetType(context, &type);
+ ok(hr == S_OK, "GetType error %#x\n", hr);
+ ok(type == WICColorContextProfile, "unexpected type %u\n", type);
+
+ colorspace = 0xdeadbeef;
+ hr = IWICColorContext_GetExifColorSpace(context, &colorspace);
+ ok(hr == S_OK, "GetExifColorSpace error %#x\n", hr);
+ ok(colorspace == 0xffffffff, "unexpected color space %u\n",
colorspace);
+
+ hr = IWICColorContext_InitializeFromExifColorSpace(context, 1);
+ ok(hr == WINCODEC_ERR_WRONGSTATE, "InitializeFromExifColorSpace error
%#x\n", hr);
+
+ size = 0;
+ hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size);
+ ok(hr == S_OK, "GetProfileBytes error %#x\n", hr);
+ ok(size, "unexpected size %u\n", size);
+
+ buffer = HeapAlloc(GetProcessHeap(), 0, size);
+ hr = IWICColorContext_GetProfileBytes(context, size, buffer, &size);
+ ok(hr == S_OK, "GetProfileBytes error %#x\n", hr);
+
+ HeapFree(GetProcessHeap(), 0, buffer);
+ HeapFree(GetProcessHeap(), 0, tmpfile);
+ }
IWICColorContext_Release(context);
+ IWICBitmapFrameDecode_Release(frame);
+ IWICBitmapDecoder_Release(decoder);
+}
+
+/* 1 bpp 1x1 pixel PNG image with PLTE and tRNS chunks */
+static const char png_PLTE_tRNS[] = {
+ 0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,
+
0x00,0x00,0x00,0x0d,'I','H','D','R',0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x01,0x03,0x00,0x00,0x00,0x25,0xdb,0x56,0xca,
+
0x00,0x00,0x00,0x06,'P','L','T','E',0x01,0x02,0x03,0x04,0x05,0x06,0x95,0x53,0x6f,0x48,
+
0x00,0x00,0x00,0x02,'t','R','N','S',0xff,0x00,0xe5,0xb7,0x30,0x4a,
+
0x00,0x00,0x00,0x0a,'I','D','A','T',0x18,0xd3,0x63,0x68,0x00,0x00,0x00,0x82,0x00,0x81,0xa7,0x01,0xba,0x10,
+
0x00,0x00,0x00,0x00,'I','E','N','D',0xae,0x42,0x60,0x82
+};
+
+static void test_png_palette(void)
+{
+ HRESULT hr;
+ IWICBitmapDecoder *decoder;
+ IWICBitmapFrameDecode *frame;
+ IWICPalette *palette;
+ GUID format;
+ UINT count, ret;
+ WICColor color[256];
+
+ decoder = create_decoder(png_PLTE_tRNS, sizeof(png_PLTE_tRNS));
+ ok(decoder != 0, "Failed to load PNG image data\n");
+
+ 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_WICPixelFormat1bppIndexed),
+ "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);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 2, "expected 2, got %u\n", count);
+
+ hr = IWICPalette_GetColors(palette, 256, color, &ret);
+ ok(hr == S_OK, "GetColors error %#x\n", hr);
+ ok(ret == count, "expected %u, got %u\n", count, ret);
+ ok(color[0] == 0xff010203, "expected 0xff010203, got %#x\n", color[0]);
+ ok(color[1] == 0x00040506, "expected 0x00040506, got %#x\n", color[1]);
+
+ IWICPalette_Release(palette);
IWICBitmapFrameDecode_Release(frame);
IWICBitmapDecoder_Release(decoder);
}
@@ -484,6 +602,7 @@
if (FAILED(hr)) return;
test_color_contexts();
+ test_png_palette();
IWICImagingFactory_Release(factory);
CoUninitialize();
Added: trunk/rostests/winetests/windowscodecs/propertybag.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/p…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/propertybag.c (added)
+++ trunk/rostests/winetests/windowscodecs/propertybag.c [iso-8859-1] Thu May 23 16:40:21
2013
@@ -0,0 +1,295 @@
+/*
+ * Copyright 2013 Ludger Sprenker
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+//#include <math.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#define COBJMACROS
+#define CONST_VTABLE
+
+#include <windef.h>
+#include <winbase.h>
+#include <ole2.h>
+//#include "wincodec.h"
+#include <wincodecsdk.h>
+#include <wine/test.h>
+
+static const WCHAR wszTestProperty1[] =
{'P','r','o','p','e','r','t','y','1',0};
+static const WCHAR wszTestProperty2[] =
{'P','r','o','p','e','r','t','y','2',0};
+static const WCHAR wszTestInvalidProperty[] =
{'I','n','v','a','l','i','d',0};
+
+static void test_propertybag_getpropertyinfo(IPropertyBag2 *property, ULONG
expected_count)
+{
+ HRESULT hr;
+ PROPBAG2 pb[2];
+ ULONG out_count;
+
+ /* iProperty: Out of bounce */
+ hr = IPropertyBag2_GetPropertyInfo(property, expected_count, 1, pb, &out_count);
+ ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE,
+ "GetPropertyInfo handled iProperty out of bounce wrong, hr=%x\n", hr);
+
+ /* cProperty: Out of bounce */
+ hr = IPropertyBag2_GetPropertyInfo(property, 0, expected_count+1, pb,
&out_count);
+ ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE,
+ "GetPropertyInfo handled cProperty out of bounce wrong, hr=%x\n", hr);
+
+ /* GetPropertyInfo can be called for zero items on Windows 8 but not on Windows 7
(wine behaves like Win8) */
+ if (expected_count == 0)
+ return;
+
+ hr = IPropertyBag2_GetPropertyInfo(property, 0, expected_count, pb, &out_count);
+ ok(hr == S_OK, "GetPropertyInfo failed, hr=%x\n", hr);
+ if (FAILED(hr))
+ return;
+
+ ok(expected_count == out_count,
+ "GetPropertyInfo returned unexpected property count, %i != %i)\n",
+ expected_count, out_count);
+
+ if(expected_count != 2)
+ return;
+
+ ok(pb[0].vt == VT_UI1, "Invalid variant type, pb[0].vt=%x\n", pb[0].vt);
+ ok(pb[0].dwType == PROPBAG2_TYPE_DATA, "Invalid variant type,
pb[0].dwType=%x\n", pb[0].dwType);
+ ok(lstrcmpW(pb[0].pstrName, wszTestProperty1) == 0, "Invalid property name,
pb[0].pstrName=%s\n", wine_dbgstr_w(pb[0].pstrName));
+
+ ok(pb[1].vt == VT_R4, "Invalid variant type, pb[1].vt=%x\n", pb[1].vt);
+ ok(pb[1].dwType == PROPBAG2_TYPE_DATA, "Invalid variant type,
pb[1].dwType=%x\n", pb[1].dwType);
+ ok(lstrcmpW(pb[1].pstrName, wszTestProperty2) == 0, "Invalid property name,
pb[1].pstrName=%s\n", wine_dbgstr_w(pb[1].pstrName));
+}
+
+static void test_propertybag_countproperties(IPropertyBag2 *property, ULONG
expected_count)
+{
+ ULONG count = (ULONG)-1;
+ HRESULT hr;
+
+ hr = IPropertyBag2_CountProperties(property, NULL);
+ ok(hr == E_INVALIDARG, "CountProperties returned unexpected result,
hr=%x\n", hr);
+
+ hr = IPropertyBag2_CountProperties(property, &count);
+ ok(hr == S_OK, "CountProperties failed, hr=%x\n", hr);
+
+ if (FAILED(hr))
+ return;
+
+ ok(count == expected_count, "CountProperties returned invalid value,
count=%i\n", count);
+}
+
+static void test_propertybag_read(IPropertyBag2 *property)
+{
+ HRESULT hr;
+ PROPBAG2 options[3] = {{0}};
+ VARIANT values[3];
+ HRESULT itm_hr[3] = {S_OK, S_OK, S_OK};
+
+ /* 1. One unknown property */
+ options[0].pstrName = (LPOLESTR)wszTestInvalidProperty;
+ hr = IPropertyBag2_Read(property, 1, options, NULL, values, itm_hr);
+ ok(hr == E_FAIL,
+ "Read for an unknown property did not fail with expected code, hr=%x\n",
hr);
+
+ /* 2. One known property */
+ options[0].pstrName = (LPOLESTR)wszTestProperty1;
+ itm_hr[0] = E_FAIL;
+ hr = IPropertyBag2_Read(property, 1, options, NULL, values, itm_hr);
+ ok(hr == S_OK, "Read failed, hr=%x\n", hr);
+ if (SUCCEEDED(hr))
+ {
+ ok(itm_hr[0] == S_OK,
+ "Read failed, itm_hr[0]=%x\n", itm_hr[0]);
+ ok(V_VT(&values[0]) == VT_UI1,
+ "Read failed, V_VT(&values[0])=%x\n", V_VT(&values[0]));
+ ok(V_UNION(&values[0], bVal) == 12,
+ "Read failed, &values[0]=%i\n", V_UNION(&values[0], bVal));
+
+ VariantClear(&values[0]);
+ }
+
+ /* 3. Two known properties */
+ options[0].pstrName = (LPOLESTR)wszTestProperty1;
+ options[1].pstrName = (LPOLESTR)wszTestProperty2;
+ itm_hr[0] = E_FAIL;
+ itm_hr[1] = E_FAIL;
+ hr = IPropertyBag2_Read(property, 2, options, NULL, values, itm_hr);
+ ok(hr == S_OK, "Read failed, hr=%x\n", hr);
+ if (SUCCEEDED(hr))
+ {
+ ok(itm_hr[0] == S_OK, "Read failed, itm_hr[0]=%x\n", itm_hr[0]);
+ ok(V_VT(&values[0]) == VT_UI1, "Read failed,
V_VT(&values[0])=%x\n", V_VT(&values[0]));
+ ok(V_UNION(&values[0], bVal) == 12, "Read failed,
&values[0]=%i\n", V_UNION(&values[0], bVal));
+
+ ok(itm_hr[1] == S_OK, "Read failed, itm_hr[1]=%x\n", itm_hr[1]);
+ ok(V_VT(&values[1]) == VT_R4, "Read failed,
V_VT(&values[1])=%x\n", V_VT(&values[1]));
+ ok(V_UNION(&values[1], fltVal) == (float)3.14, "Read failed,
&values[1]=%f\n", V_UNION(&values[1], fltVal));
+
+ VariantClear(&values[0]);
+ VariantClear(&values[1]);
+ }
+
+
+ /* 4. One unknown property between two valid */
+
+ /* Exotic initializations so we can detect what is unchanged */
+ itm_hr[0] = -1; itm_hr[1] = -1; itm_hr[2] = -1;
+ V_VT(&values[0]) = VT_NULL;
+ V_VT(&values[1]) = VT_NULL;
+ V_VT(&values[2]) = VT_NULL;
+ V_UNION(&values[0], bVal) = 254;
+ V_UNION(&values[1], bVal) = 254;
+ V_UNION(&values[2], bVal) = 254;
+
+ options[0].pstrName = (LPOLESTR)wszTestProperty1;
+ options[1].pstrName = (LPOLESTR)wszTestInvalidProperty;
+ options[2].pstrName = (LPOLESTR)wszTestProperty2;
+
+ hr = IPropertyBag2_Read(property, 3, options, NULL, values, itm_hr);
+ ok(hr == E_FAIL, "Read failed, hr=%x\n", hr);
+ if (hr == E_FAIL)
+ {
+ ok(itm_hr[0] == S_OK, "Read error code has unexpected value,
itm_hr[0]=%x\n", itm_hr[0]);
+ ok(itm_hr[1] == -1, "Read error code has unexpected value,
itm_hr[1]=%x\n", itm_hr[1]);
+ ok(itm_hr[2] == -1, "Read error code has unexpected value,
itm_hr[2]=%x\n", itm_hr[2]);
+
+ ok(V_VT(&values[0]) == VT_UI1, "Read variant has unexpected type,
V_VT(&values[0])=%x\n", V_VT(&values[0]));
+ ok(V_VT(&values[1]) == VT_NULL, "Read variant has unexpected type,
V_VT(&values[1])=%x\n", V_VT(&values[1]));
+ ok(V_VT(&values[2]) == VT_NULL, "Read variant has unexpected type,
V_VT(&values[2])=%x\n", V_VT(&values[2]));
+
+ ok(V_UNION(&values[0], bVal) == 12, "Read variant has unexpected value,
V_UNION(&values[0])=%i\n", V_UNION(&values[0], bVal));
+ ok(V_UNION(&values[1], bVal) == 254, "Read variant has unexpected value,
V_UNION(&values[1])=%i\n", V_UNION(&values[1], bVal));
+ ok(V_UNION(&values[2], bVal) == 254, "Read variant has unexpected value,
V_UNION(&values[2])=%i\n", V_UNION(&values[2], bVal));
+ }
+}
+
+static void test_propertybag_write(IPropertyBag2 *property)
+{
+ HRESULT hr;
+ PROPBAG2 options[2] = {{0}};
+ VARIANT values[2];
+
+ VariantInit(&values[0]);
+ VariantInit(&values[1]);
+
+ /* 1. One unknown property */
+ options[0].pstrName = (LPOLESTR)wszTestInvalidProperty;
+ hr = IPropertyBag2_Write(property, 1, options, values);
+ ok(hr == E_FAIL, "Write for an unknown property did not fail with expected code,
hr=%x\n", hr);
+
+ /* 2. One property without correct type */
+ options[0].pstrName = (LPOLESTR)wszTestProperty1;
+ V_VT(&values[0]) = VT_UI1;
+ V_UNION(&values[0], bVal) = 1;
+ hr = IPropertyBag2_Write(property, 1, options, values);
+ ok(hr == S_OK, "Write for one property failed, hr=%x\n", hr);
+
+ /* 3. One property with mismatching type */
+ options[0].pstrName = (LPOLESTR)wszTestProperty1;
+ V_VT(&values[0]) = VT_I1;
+ V_UNION(&values[0], bVal) = 2;
+ hr = IPropertyBag2_Write(property, 1, options, values);
+ ok(hr == WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE,
+ "Write with mismatching type did not fail with expected code hr=%x\n",
hr);
+
+ /* 4. Reset one property to empty */
+ options[0].pstrName = (LPOLESTR)wszTestProperty1;
+ VariantClear(&values[0]);
+ hr = IPropertyBag2_Write(property, 1, options, values);
+ ok(hr == WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE,
+ "Write to reset to empty value does not fail with expected code,
hr=%x\n", hr);
+
+ /* 5. Set two properties */
+ options[0].pstrName = (LPOLESTR)wszTestProperty1;
+ V_VT(&values[0]) = VT_UI1;
+ V_UNION(&values[0], bVal) = 12;
+ options[1].pstrName = (LPOLESTR)wszTestProperty2;
+ V_VT(&values[1]) = VT_R4;
+ V_UNION(&values[1], fltVal) = (float)3.14;
+ hr = IPropertyBag2_Write(property, 2, options, values);
+ ok(hr == S_OK, "Write for two properties failed, hr=%x\n", hr);
+}
+
+static void test_empty_propertybag(void)
+{
+ HRESULT hr;
+ IWICComponentFactory *factory;
+ IPropertyBag2 *property;
+
+ hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IWICComponentFactory, (void**)&factory);
+ ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
+
+ hr = IWICComponentFactory_CreateEncoderPropertyBag(factory, NULL, 0, &property);
+
+ ok(hr == S_OK, "Creating EncoderPropertyBag failed, hr=%x\n", hr);
+ if (FAILED(hr)) return;
+
+ test_propertybag_countproperties(property, 0);
+
+ test_propertybag_getpropertyinfo(property, 0);
+
+ IPropertyBag2_Release(property);
+
+ IWICComponentFactory_Release(factory);
+}
+
+static void test_filled_propertybag(void)
+{
+ HRESULT hr;
+ IWICComponentFactory *factory;
+ IPropertyBag2 *property;
+ PROPBAG2 opts[2]= {
+ {PROPBAG2_TYPE_DATA, VT_UI1, 0, 0, (LPOLESTR)wszTestProperty1, {0}},
+ {PROPBAG2_TYPE_DATA, VT_R4, 0, 0, (LPOLESTR)wszTestProperty2, {0}}
+ };
+
+ hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IWICComponentFactory, (void**)&factory);
+ ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
+
+ hr = IWICComponentFactory_CreateEncoderPropertyBag(factory, opts, 2, &property);
+
+ ok(hr == S_OK, "Creating EncoderPropertyBag failed, hr=%x\n", hr);
+ if (FAILED(hr)) return;
+
+ test_propertybag_countproperties(property, 2);
+
+ test_propertybag_getpropertyinfo(property, 2);
+
+ test_propertybag_write(property);
+
+ test_propertybag_read(property);
+
+ IPropertyBag2_Release(property);
+
+ IWICComponentFactory_Release(factory);
+}
+
+START_TEST(propertybag)
+{
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+
+ test_empty_propertybag();
+
+ test_filled_propertybag();
+
+ CoUninitialize();
+}
Propchange: trunk/rostests/winetests/windowscodecs/propertybag.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/winetests/windowscodecs/stream.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/s…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/stream.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/stream.c [iso-8859-1] Thu May 23 16:40:21 2013
@@ -16,10 +16,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "wine/test.h"
+#include <wine/test.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
#define COBJMACROS
-#include "wincodec.h"
+#include <ole2.h>
+#include <wincodec.h>
static void test_StreamOnMemory(void)
{
Modified: trunk/rostests/winetests/windowscodecs/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/t…
==============================================================================
--- trunk/rostests/winetests/windowscodecs/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/windowscodecs/testlist.c [iso-8859-1] Thu May 23 16:40:21
2013
@@ -1,7 +1,4 @@
/* Automatically generated file; DO NOT EDIT!! */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
#define STANDALONE
#include "wine/test.h"
@@ -15,6 +12,7 @@
extern void func_metadata(void);
extern void func_palette(void);
extern void func_pngformat(void);
+extern void func_propertybag(void);
extern void func_stream(void);
extern void func_tiffformat(void);
@@ -29,6 +27,7 @@
{ "metadata", func_metadata },
{ "palette", func_palette },
{ "pngformat", func_pngformat },
+ { "propertybag", func_propertybag },
{ "stream", func_stream },
{ "tiffformat", func_tiffformat },
{ 0, 0 }
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] Thu May 23 16:40:21
2013
@@ -16,14 +16,20 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <stdarg.h>
+//#include <stdarg.h>
#include <stdio.h>
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
#define COBJMACROS
-#include "windef.h"
-#include "wincodec.h"
-#include "wine/test.h"
+#include <windef.h>
+#include <winbase.h>
+#include <ole2.h>
+#include <wincodec.h>
+#include <wine/test.h>
#define IFD_BYTE 1
#define IFD_ASCII 2
@@ -38,7 +44,7 @@
#define IFD_FLOAT 11
#define IFD_DOUBLE 12
-#include "pshpack2.h"
+#include <pshpack2.h>
struct IFD_entry
{
SHORT id;
@@ -92,7 +98,7 @@
{ 900, 3 },
{ 0x11, 0x22, 0x33, 0 }
};
-#include "poppack.h"
+#include <poppack.h>
static IWICImagingFactory *factory;