From: Amine Khaldi Date: Sat, 7 Dec 2019 12:05:00 +0000 (+0100) Subject: [WINDOWSCODECS_WINETEST] Sync with Wine Staging 4.18. CORE-16441 X-Git-Tag: 0.4.14-RC~1003 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=cc48f9d4d6539e628a257d01329f2e80808718db;ds=sidebyside [WINDOWSCODECS_WINETEST] Sync with Wine Staging 4.18. CORE-16441 --- diff --git a/modules/rostests/winetests/windowscodecs/CMakeLists.txt b/modules/rostests/winetests/windowscodecs/CMakeLists.txt index 09cca9909aa..6bae33b8912 100644 --- a/modules/rostests/winetests/windowscodecs/CMakeLists.txt +++ b/modules/rostests/winetests/windowscodecs/CMakeLists.txt @@ -3,11 +3,6 @@ add_definitions( -DUSE_WINE_TODOS -DWINETEST_USE_DBGSTR_LONGLONG) -# to be removed after synching with newer Wine -if(GCC AND GCC_VERSION VERSION_GREATER 7) - add_compile_flags("-Wno-stringop-overflow") -endif() - list(APPEND SOURCE bitmap.c bmpformat.c diff --git a/modules/rostests/winetests/windowscodecs/bitmap.c b/modules/rostests/winetests/windowscodecs/bitmap.c index d4b597900db..6cb0c5665c2 100644 --- a/modules/rostests/winetests/windowscodecs/bitmap.c +++ b/modules/rostests/winetests/windowscodecs/bitmap.c @@ -30,6 +30,71 @@ #include "wincodec.h" #include "wine/test.h" +#include "initguid.h" +DEFINE_GUID(IID_IMILUnknown,0x0ccd7824,0xdc16,0x4d09,0xbc,0xa8,0x6b,0x09,0xc4,0xef,0x55,0x35); +DEFINE_GUID(IID_IMILBitmap,0xb1784d3f,0x8115,0x4763,0x13,0xaa,0x32,0xed,0xdb,0x68,0x29,0x4a); +DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); +DEFINE_GUID(IID_IMILBitmapLock,0xa67b2b53,0x8fa1,0x4155,0x8f,0x64,0x0c,0x24,0x7a,0x8f,0x84,0xcd); +DEFINE_GUID(IID_IMILBitmapScaler,0xa767b0f0,0x1c8c,0x4aef,0x56,0x8f,0xad,0xf9,0x6d,0xcf,0xd5,0xcb); +DEFINE_GUID(IID_IMILFormatConverter,0x7e2a746f,0x25c5,0x4851,0xb3,0xaf,0x44,0x3b,0x79,0x63,0x9e,0xc0); +DEFINE_GUID(IID_IMILPalette,0xca8e206f,0xf22c,0x4af7,0x6f,0xba,0x7b,0xed,0x5e,0xb1,0xc9,0x2f); + +#undef INTERFACE +#define INTERFACE IMILBitmapSource +DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) +{ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWICBitmapSource methods ***/ + STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE; + STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE; + STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE; + STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE; + STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IMILBitmap +DECLARE_INTERFACE_(IMILBitmap,IMILBitmapSource) +{ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWICBitmapSource methods ***/ + STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE; + STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE; + STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE; + STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE; + STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE; + /*** IMILBitmap methods ***/ + STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE; + STDMETHOD_(HRESULT,Lock)(THIS_ const WICRect *,DWORD,IWICBitmapLock **) PURE; + STDMETHOD_(HRESULT,Unlock)(THIS_ IWICBitmapLock *) PURE; + STDMETHOD_(HRESULT,SetPalette)(THIS_ IWICPalette *) PURE; + STDMETHOD_(HRESULT,SetResolution)(THIS_ double,double) PURE; + STDMETHOD_(HRESULT,AddDirtyRect)(THIS_ const WICRect *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IMILBitmapScaler +DECLARE_INTERFACE_(IMILBitmapScaler,IMILBitmapSource) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWICBitmapSource methods ***/ + STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE; + STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE; + STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE; + STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE; + STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE; + /*** IMILBitmapScaler methods ***/ + STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE; + STDMETHOD_(HRESULT,Initialize)(THIS_ IMILBitmapSource *,UINT,UINT,WICBitmapInterpolationMode); +}; + static IWICImagingFactory *factory; static HRESULT WINAPI bitmapsource_QueryInterface(IWICBitmapSource *iface, REFIID iid, void **ppv) @@ -1088,6 +1153,7 @@ static void test_bitmap_scaler(void) double res_x, res_y; IWICBitmap *bitmap; UINT width, height; + BYTE buf[16]; HRESULT hr; hr = IWICImagingFactory_CreateBitmap(factory, 4, 2, &GUID_WICPixelFormat24bppBGR, WICBitmapCacheOnLoad, &bitmap); @@ -1165,6 +1231,9 @@ static void test_bitmap_scaler(void) hr = IWICBitmapScaler_GetSize(scaler, &width, &height); ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr); + hr = IWICBitmapScaler_CopyPixels(scaler, NULL, 1, sizeof(buf), buf); + ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr); + hr = IWICBitmapScaler_Initialize(scaler, (IWICBitmapSource *)bitmap, 0, 2, WICBitmapInterpolationModeNearestNeighbor); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); @@ -1245,6 +1314,158 @@ static void test_bitmap_scaler(void) IWICBitmap_Release(bitmap); } +static LONG obj_refcount(void *obj) +{ + IUnknown_AddRef((IUnknown *)obj); + return IUnknown_Release((IUnknown *)obj); +} + +static void test_IMILBitmap(void) +{ + HRESULT hr; + IWICBitmap *bitmap; + IWICBitmapScaler *scaler; + IMILBitmap *mil_bitmap; + IMILBitmapSource *mil_source; + IMILBitmapScaler *mil_scaler; + IUnknown *wic_unknown, *mil_unknown; + WICPixelFormatGUID format; + int MIL_format; + UINT width, height; + double dpix, dpiy; + BYTE buf[256]; + + /* Bitmap */ + hr = IWICImagingFactory_CreateBitmap(factory, 1, 1, &GUID_WICPixelFormat24bppBGR, + WICBitmapCacheOnDemand, &bitmap); + ok(hr == S_OK, "CreateBitmap error %#x\n", hr); + + ok(obj_refcount(bitmap) == 1, "ref count %d\n", obj_refcount(bitmap)); + + hr = IWICBitmap_GetPixelFormat(bitmap, &format); + ok(hr == S_OK, "GetPixelFormat error %#x\n", hr); + ok(IsEqualGUID(&format, &GUID_WICPixelFormat24bppBGR), "wrong format %s\n", wine_dbgstr_guid(&format)); + + hr = IWICBitmap_GetResolution(bitmap, &dpix, &dpiy); + ok(hr == S_OK, "GetResolution error %#x\n", hr); + ok(dpix == 0.0, "got %f, expected 0.0\n", dpix); + ok(dpiy == 0.0, "got %f, expected 0.0\n", dpiy); + + hr = IWICBitmap_SetResolution(bitmap, 12.0, 34.0); + ok(hr == S_OK, "SetResolution error %#x\n", hr); + + hr = IWICBitmap_GetResolution(bitmap, &dpix, &dpiy); + ok(hr == S_OK, "GetResolution error %#x\n", hr); + ok(dpix == 12.0, "got %f, expected 12.0\n", dpix); + ok(dpiy == 34.0, "got %f, expected 34.0\n", dpiy); + + hr = IWICBitmap_GetSize(bitmap, &width, &height); + ok(hr == S_OK, "GetSize error %#x\n", hr); + ok(width == 1, "got %u, expected 1\n", width); + ok(height == 1, "got %u, expected 1\n", height); + + hr = IWICBitmap_QueryInterface(bitmap, &IID_IMILBitmap, (void **)&mil_bitmap); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + ok(obj_refcount(bitmap) == 2, "ref count %d\n", obj_refcount(bitmap)); + ok(obj_refcount(mil_bitmap) == 2, "ref count %d\n", obj_refcount(mil_bitmap)); + + hr = IWICBitmap_QueryInterface(bitmap, &IID_IUnknown, (void **)&wic_unknown); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + hr = mil_bitmap->lpVtbl->QueryInterface(mil_bitmap, &IID_IUnknown, (void **)&mil_unknown); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + ok((void *)wic_unknown->lpVtbl == (void *)mil_unknown->lpVtbl, "wrong lpVtbl ptrs %p != %p\n", wic_unknown->lpVtbl, mil_unknown->lpVtbl); + + IUnknown_Release(wic_unknown); + IUnknown_Release(mil_unknown); + + hr = IWICBitmap_QueryInterface(bitmap, &IID_IMILBitmapSource, (void **)&mil_source); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + ok((void *)mil_source->lpVtbl == (void *)mil_bitmap->lpVtbl, "IMILBitmap->lpVtbl should be equal to IMILBitmapSource->lpVtbl\n"); + + ok(obj_refcount(bitmap) == 3, "ref count %d\n", obj_refcount(bitmap)); + ok(obj_refcount(mil_bitmap) == 3, "ref count %d\n", obj_refcount(mil_bitmap)); + ok(obj_refcount(mil_source) == 3, "ref count %d\n", obj_refcount(mil_source)); + + hr = mil_source->lpVtbl->GetPixelFormat(mil_source, &MIL_format); + ok(hr == S_OK, "GetPixelFormat error %#x\n", hr); + ok(MIL_format == 0x0c, "wrong format %d\n", MIL_format); + + hr = mil_source->lpVtbl->GetResolution(mil_source, &dpix, &dpiy); + ok(hr == S_OK, "GetResolution error %#x\n", hr); + ok(dpix == 12.0, "got %f, expected 12.0\n", dpix); + ok(dpiy == 34.0, "got %f, expected 34.0\n", dpiy); + + hr = mil_source->lpVtbl->GetSize(mil_source, &width, &height); + ok(hr == S_OK, "GetSize error %#x\n", hr); + ok(width == 1, "got %u, expected 1\n", width); + ok(height == 1, "got %u, expected 1\n", height); + + /* Scaler */ + hr = IWICImagingFactory_CreateBitmapScaler(factory, &scaler); + ok(hr == S_OK, "CreateBitmapScaler error %#x\n", hr); + + ok(obj_refcount(scaler) == 1, "ref count %d\n", obj_refcount(scaler)); + + hr = IWICBitmapScaler_QueryInterface(scaler, &IID_IMILBitmapScaler, (void **)&mil_scaler); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + ok(obj_refcount(scaler) == 2, "ref count %d\n", obj_refcount(scaler)); + ok(obj_refcount(mil_scaler) == 2, "ref count %d\n", obj_refcount(mil_scaler)); + + hr = IWICBitmapScaler_QueryInterface(scaler, &IID_IUnknown, (void **)&wic_unknown); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + + hr = mil_scaler->lpVtbl->QueryInterface(mil_scaler, &IID_IUnknown, (void **)&mil_unknown); + ok(hr == S_OK, "QueryInterface error %#x\n", hr); + ok((void *)wic_unknown->lpVtbl == (void *)mil_unknown->lpVtbl, "wrong lpVtbl ptrs %p != %p\n", wic_unknown->lpVtbl, mil_unknown->lpVtbl); + + IUnknown_Release(wic_unknown); + IUnknown_Release(mil_unknown); + + hr = mil_scaler->lpVtbl->GetPixelFormat(mil_scaler, &MIL_format); + ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetPixelFormat error %#x\n", hr); + + hr = mil_scaler->lpVtbl->GetResolution(mil_scaler, &dpix, &dpiy); + ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetResolution error %#x\n", hr); + + hr = mil_scaler->lpVtbl->GetSize(mil_scaler, &width, &height); + ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetSize error %#x\n", hr); + + memset(buf, 0xde, sizeof(buf)); + hr = mil_scaler->lpVtbl->CopyPixels(mil_scaler, NULL, 3, sizeof(buf), buf); + ok(hr == WINCODEC_ERR_NOTINITIALIZED, "CopyPixels error %#x\n", hr); + + hr = mil_scaler->lpVtbl->Initialize(mil_scaler, mil_source, 1, 1, 1); + ok(hr == S_OK, "Initialize error %#x\n", hr); + + hr = mil_scaler->lpVtbl->GetPixelFormat(mil_scaler, &MIL_format); + ok(hr == S_OK, "GetPixelFormat error %#x\n", hr); + ok(MIL_format == 0x0c, "wrong format %d\n", MIL_format); + + hr = mil_scaler->lpVtbl->GetResolution(mil_scaler, &dpix, &dpiy); + ok(hr == S_OK, "GetResolution error %#x\n", hr); + ok(dpix == 12.0, "got %f, expected 12.0\n", dpix); + ok(dpiy == 34.0, "got %f, expected 34.0\n", dpiy); + + hr = mil_scaler->lpVtbl->GetSize(mil_scaler, &width, &height); + ok(hr == S_OK, "GetSize error %#x\n", hr); + ok(width == 1, "got %u, expected 1\n", width); + ok(height == 1, "got %u, expected 1\n", height); + + memset(buf, 0xde, sizeof(buf)); + hr = mil_scaler->lpVtbl->CopyPixels(mil_scaler, NULL, 3, sizeof(buf), buf); + ok(hr == S_OK, "CopyPixels error %#x\n", hr); + ok(buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0xde,"wrong data: %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]); + + mil_scaler->lpVtbl->Release(mil_scaler); + IWICBitmapScaler_Release(scaler); + mil_source->lpVtbl->Release(mil_source); + mil_bitmap->lpVtbl->Release(mil_bitmap); + IWICBitmap_Release(bitmap); +} + START_TEST(bitmap) { HRESULT hr; @@ -1255,6 +1476,7 @@ START_TEST(bitmap) &IID_IWICImagingFactory, (void**)&factory); ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + test_IMILBitmap(); test_createbitmap(); test_createbitmapfromsource(); test_CreateBitmapFromMemory(); diff --git a/modules/rostests/winetests/windowscodecs/converter.c b/modules/rostests/winetests/windowscodecs/converter.c index 8682f870619..348d5a8cb21 100644 --- a/modules/rostests/winetests/windowscodecs/converter.c +++ b/modules/rostests/winetests/windowscodecs/converter.c @@ -397,8 +397,8 @@ static const struct bitmap_data testdata_2bppIndexed = { /* some encoders (like BMP) require data to be 4-bytes aligned */ static const BYTE bits_4bpp[] = { - 0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23, - 0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67}; + 0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43,0x34,0x43, + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44}; static const struct bitmap_data testdata_4bppIndexed = { &GUID_WICPixelFormat4bppIndexed, 4, bits_4bpp, 32, 2, 96.0, 96.0}; @@ -416,8 +416,8 @@ static const struct bitmap_data testdata_8bppIndexed_4colors = { &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp_4colors, 32, 2, 96.0, 96.0}; static const BYTE bits_8bpp[] = { - 0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3, - 4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7}; + 0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; static const struct bitmap_data testdata_8bppIndexed = { &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp, 32, 2, 96.0, 96.0}; @@ -491,6 +491,18 @@ static const struct bitmap_data testdata_32bppPBGRA = { static const struct bitmap_data testdata_32bppPRGBA = { &GUID_WICPixelFormat32bppPRGBA, 32, bits_32bppPBGRA, 32, 2, 96.0, 96.0}; +static const BYTE bits_64bppRGBA[] = { + 128,255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,128, 255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255, + 128,255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,128, 255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255, + 128,255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,128, 255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255, + 128,255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255,128, 255,128,0,128,0,128,255,128, 0,128,255,128,0,128,255,128, 0,128,0,128,255,128,255,128, 0,128,0,128,0,128,255, + 128,0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,128, 0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255, + 128,0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,128, 0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255, + 128,0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,128, 0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255, + 128,0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255,128, 0,128,255,128,255,128,255,128, 255,128,0,128,255,128,255,128, 255,128,255,128,0,128,255,128, 255,128,255,128,255,128,255}; +static const struct bitmap_data testdata_64bppRGBA = { + &GUID_WICPixelFormat64bppRGBA, 64, bits_64bppRGBA, 32, 2, 96.0, 96.0}; + /* XP and 2003 use linear color conversion, later versions use sRGB gamma */ static const float bits_32bppGrayFloat_xp[] = { 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f, @@ -863,7 +875,7 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format) ok(hr == S_OK, "GetCount error %#x\n", hr); ok(count != 0, "wrong count %u\n", count); - for (i = 0; i < sizeof(tag)/sizeof(tag[0]); i++) + for (i = 0; i < ARRAY_SIZE(tag); i++) { PropVariantInit(&id); PropVariantInit(&value); @@ -880,6 +892,8 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format) } else tag[i].value[0] = -1; + + PropVariantClear(&value); } IWICMetadataReader_Release(reader); @@ -1319,7 +1333,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls hr = IWICBitmapEncoderInfo_GetCLSID(info, &clsid); ok(hr == S_OK, "wrong error %#x\n", hr); - ok(!IsEqualGUID(&clsid_encoder, &clsid), "wrong CLSID %s (%s)\n", + ok(!IsEqualGUID(clsid_encoder, &clsid), "wrong CLSID %s (%s)\n", wine_dbgstr_guid(clsid_encoder), wine_dbgstr_guid(&clsid)); IWICBitmapEncoderInfo_Release(info); @@ -1408,8 +1422,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls ok(SUCCEEDED(hr), "WriteSource(%dx%d) failed, hr=%x (%s)\n", rc->Width, rc->Height, hr, name); else ok(hr == S_OK || - (hr == E_NOTIMPL && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2) || - (hr == E_NOTIMPL && IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2) || + (FAILED(hr) && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2) /* XP */ || + (FAILED(hr) && IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2) /* XP */ || broken(hr == E_INVALIDARG && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && IsEqualGUID(srcs[i]->format, &GUID_WICPixelFormatBlackWhite)) /* XP */, "WriteSource(NULL) failed, hr=%x (%s)\n", hr, name); } @@ -1688,7 +1702,7 @@ static void test_converter_8bppIndexed(void) ok(hr == S_OK, "GetColorCount error %#x\n", hr); ok(count == 0, "expected 0, got %u\n", count); - /* NULL palette + Custom type*/ + /* NULL palette + Custom type */ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, @@ -1701,7 +1715,7 @@ static void test_converter_8bppIndexed(void) ok(hr == S_OK, "CopyPixels error %#x\n", hr); IWICFormatConverter_Release(converter); - /* NULL palette + Custom type*/ + /* NULL palette + Custom type */ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, @@ -1714,7 +1728,7 @@ static void test_converter_8bppIndexed(void) ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr); IWICFormatConverter_Release(converter); - /* empty palette + Custom type*/ + /* empty palette + Custom type */ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, @@ -1736,7 +1750,7 @@ static void test_converter_8bppIndexed(void) ok(count == 0, "expected 0\n"); IWICFormatConverter_Release(converter); - /* NULL palette + Predefined type*/ + /* NULL palette + Predefined type */ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, @@ -1757,7 +1771,7 @@ static void test_converter_8bppIndexed(void) ok(count != 0, "expected != 0\n"); IWICFormatConverter_Release(converter); - /* not empty palette + Predefined type*/ + /* not empty palette + Predefined type */ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, @@ -1778,7 +1792,7 @@ static void test_converter_8bppIndexed(void) ok(count != 0, "expected != 0\n"); IWICFormatConverter_Release(converter); - /* not empty palette + MedianCut type*/ + /* not empty palette + MedianCut type */ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, @@ -1799,7 +1813,7 @@ static void test_converter_8bppIndexed(void) ok(count != 0, "expected != 0\n"); IWICFormatConverter_Release(converter); - /* NULL palette + MedianCut type*/ + /* NULL palette + MedianCut type */ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter); ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr); hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface, @@ -1867,6 +1881,9 @@ START_TEST(converter) test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE); test_conversion(&testdata_32bppBGRA, &testdata_24bppRGB, "32bppBGRA -> 24bppRGB", FALSE); + test_conversion(&testdata_64bppRGBA, &testdata_32bppRGBA, "64bppRGBA -> 32bppRGBA", FALSE); + test_conversion(&testdata_64bppRGBA, &testdata_32bppRGB, "64bppRGBA -> 32bppRGB", FALSE); + test_conversion(&testdata_24bppRGB, &testdata_32bppGrayFloat, "24bppRGB -> 32bppGrayFloat", FALSE); test_conversion(&testdata_32bppBGR, &testdata_32bppGrayFloat, "32bppBGR -> 32bppGrayFloat", FALSE); diff --git a/modules/rostests/winetests/windowscodecs/metadata.c b/modules/rostests/winetests/windowscodecs/metadata.c index 91a5d20f377..58da19cee47 100644 --- a/modules/rostests/winetests/windowscodecs/metadata.c +++ b/modules/rostests/winetests/windowscodecs/metadata.c @@ -3032,6 +3032,7 @@ static void test_queryreader(void) ok(hr == E_INVALIDARG, "got %#x\n", hr); IWICMetadataQueryReader_Release(new_reader); + PropVariantClear(&value); } else if (value.vt == VT_LPSTR) ok(!lstrcmpA(U(value).pszVal, test_data[i].str_value), "%u: expected %s, got %s\n", diff --git a/modules/rostests/winetests/windowscodecs/palette.c b/modules/rostests/winetests/windowscodecs/palette.c index 5bb25fa4279..583fa66c80e 100644 --- a/modules/rostests/winetests/windowscodecs/palette.c +++ b/modules/rostests/winetests/windowscodecs/palette.c @@ -602,7 +602,7 @@ static void test_palette_from_bitmap(void) ok(hr == S_OK, "GetColorCount error %#x\n", hr); ok(count == 2, "expected 2, got %u\n", count); - /* without trasparent color */ + /* without transparent color */ hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 16, FALSE); ok(hr == S_OK, "InitializeFromBitmap error %#x\n", hr); type = -1; @@ -619,7 +619,7 @@ static void test_palette_from_bitmap(void) ok(ret == count, "expected %u, got %u\n", count, ret); ok(color[count - 1] != 0, "expected !0, got %08x\n", color[count - 1]); - /* with trasparent color */ + /* with transparent color */ hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 16, TRUE); ok(hr == S_OK, "InitializeFromBitmap error %#x\n", hr); type = -1; diff --git a/modules/rostests/winetests/windowscodecs/stream.c b/modules/rostests/winetests/windowscodecs/stream.c index 3750c32f3c2..048f1326be0 100644 --- a/modules/rostests/winetests/windowscodecs/stream.c +++ b/modules/rostests/winetests/windowscodecs/stream.c @@ -765,7 +765,7 @@ static void test_StreamOnIStream(void) ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr); hr = IWICStream_InitializeFromMemory(stream, memory, sizeof(memory)); - ok(hr == S_OK, "Failed to initialize stream, hr %#x.", hr); + ok(hr == S_OK, "Failed to initialize stream, hr %#x.\n", hr); hr = IWICImagingFactory_CreateStream(factory, &substream); ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr); diff --git a/modules/rostests/winetests/windowscodecs/tiffformat.c b/modules/rostests/winetests/windowscodecs/tiffformat.c index 289e0611450..8cdc0047a21 100644 --- a/modules/rostests/winetests/windowscodecs/tiffformat.c +++ b/modules/rostests/winetests/windowscodecs/tiffformat.c @@ -750,7 +750,8 @@ static void test_tiff_24bpp(void) static const BYTE expected_data[] = { 0x33,0x22,0x11 }; hr = create_decoder(&tiff_24bpp_data, sizeof(tiff_24bpp_data), &decoder); - ok(hr == S_OK, "got %#x\n", hr); + ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr); + if (hr != S_OK) return; ok(decoder != NULL, "Failed to load TIFF image data\n"); hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);