mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
[WINDOWSCODECS_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
svn path=/trunk/; revision=71755
This commit is contained in:
@@ -829,13 +829,8 @@ todo_wine
|
||||
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++)
|
||||
{
|
||||
if (data[i] != data_8bpp_pal_wic[i])
|
||||
todo_wine
|
||||
todo_wine_if (data[i] != data_8bpp_pal_wic[i])
|
||||
ok(data[i] == data_8bpp_pal_wic[i], "%u: expected %#x, got %#x\n", i, data_8bpp_pal_wic[i], data[i]);
|
||||
else
|
||||
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);
|
||||
|
||||
@@ -48,6 +48,11 @@ typedef struct BitmapTestSrc {
|
||||
const bitmap_data *data;
|
||||
} BitmapTestSrc;
|
||||
|
||||
static BOOL near_equal(float a, float b)
|
||||
{
|
||||
return fabsf(a - b) < 0.001;
|
||||
}
|
||||
|
||||
static inline BitmapTestSrc *impl_from_IWICBitmapSource(IWICBitmapSource *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, BitmapTestSrc, IWICBitmapSource_iface);
|
||||
@@ -201,6 +206,14 @@ static void DeleteTestBitmap(BitmapTestSrc *This)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
/* 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.886000f,0.413000f,0.701000f,1.000000f};
|
||||
static const BYTE bits_8bppGray_xp[] = {
|
||||
29,150,76,0,
|
||||
226,105,179,255};
|
||||
|
||||
static void compare_bitmap_data(const struct bitmap_data *expect, IWICBitmapSource *source, const char *name)
|
||||
{
|
||||
BYTE *converted_bits;
|
||||
@@ -250,6 +263,33 @@ static void compare_bitmap_data(const struct bitmap_data *expect, IWICBitmapSour
|
||||
}
|
||||
ok(equal, "unexpected pixel data (%s)\n", name);
|
||||
}
|
||||
else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat32bppGrayFloat))
|
||||
{
|
||||
BOOL equal=TRUE;
|
||||
UINT i;
|
||||
const float *a=(const float*)expect->bits, *b=(const float*)converted_bits;
|
||||
for (i=0; i<(buffersize/4); i++)
|
||||
if (!near_equal(a[i], b[i]) && !near_equal(bits_32bppGrayFloat_xp[i], b[i]))
|
||||
{
|
||||
equal = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
ok(equal, "unexpected pixel data (%s)\n", name);
|
||||
}
|
||||
else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat8bppGray))
|
||||
{
|
||||
UINT i;
|
||||
BOOL equal=TRUE;
|
||||
const BYTE *a=(const BYTE*)expect->bits, *b=(const BYTE*)converted_bits;
|
||||
for (i=0; i<buffersize; i++)
|
||||
if (a[i] != b[i] && bits_8bppGray_xp[i] != b[i])
|
||||
{
|
||||
equal = FALSE;
|
||||
break;
|
||||
}
|
||||
ok(equal, "unexpected pixel data (%s)\n", name);
|
||||
}
|
||||
else
|
||||
ok(memcmp(expect->bits, converted_bits, buffersize) == 0, "unexpected pixel data (%s)\n", name);
|
||||
|
||||
@@ -270,6 +310,33 @@ static void compare_bitmap_data(const struct bitmap_data *expect, IWICBitmapSour
|
||||
}
|
||||
ok(equal, "unexpected pixel data with rc=NULL (%s)\n", name);
|
||||
}
|
||||
else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat32bppGrayFloat))
|
||||
{
|
||||
BOOL equal=TRUE;
|
||||
UINT i;
|
||||
const float *a=(const float*)expect->bits, *b=(const float*)converted_bits;
|
||||
for (i=0; i<(buffersize/4); i++)
|
||||
if (!near_equal(a[i], b[i]) && !near_equal(bits_32bppGrayFloat_xp[i], b[i]))
|
||||
{
|
||||
equal = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
ok(equal, "unexpected pixel data (%s)\n", name);
|
||||
}
|
||||
else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat8bppGray))
|
||||
{
|
||||
UINT i;
|
||||
BOOL equal=TRUE;
|
||||
const BYTE *a=(const BYTE*)expect->bits, *b=(const BYTE*)converted_bits;
|
||||
for (i=0; i<buffersize; i++)
|
||||
if (a[i] != b[i] && bits_8bppGray_xp[i] != b[i])
|
||||
{
|
||||
equal = FALSE;
|
||||
break;
|
||||
}
|
||||
ok(equal, "unexpected pixel data (%s)\n", name);
|
||||
}
|
||||
else
|
||||
ok(memcmp(expect->bits, converted_bits, buffersize) == 0, "unexpected pixel data with rc=NULL (%s)\n", name);
|
||||
|
||||
@@ -300,6 +367,24 @@ static const BYTE bits_32bppBGRA[] = {
|
||||
static const struct bitmap_data testdata_32bppBGRA = {
|
||||
&GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 4, 2, 96.0, 96.0};
|
||||
|
||||
static const float bits_32bppGrayFloat[] = {
|
||||
0.072200f,0.715200f,0.212600f,0.000000f,
|
||||
0.927800f,0.284800f,0.787400f,1.000000f};
|
||||
static const struct bitmap_data testdata_32bppGrayFloat = {
|
||||
&GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat, 4, 2, 96.0, 96.0};
|
||||
|
||||
static const BYTE bits_8bppGray[] = {
|
||||
76,220,127,0,
|
||||
247,145,230,255};
|
||||
static const struct bitmap_data testdata_8bppGray = {
|
||||
&GUID_WICPixelFormat8bppGray, 8, bits_8bppGray, 4, 2, 96.0, 96.0};
|
||||
|
||||
static const BYTE bits_24bppBGR_gray[] = {
|
||||
76,76,76, 220,220,220, 127,127,127, 0,0,0,
|
||||
247,247,247, 145,145,145, 230,230,230, 255,255,255};
|
||||
static const struct bitmap_data testdata_24bppBGR_gray = {
|
||||
&GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR_gray, 4, 2, 96.0, 96.0};
|
||||
|
||||
static void test_conversion(const struct bitmap_data *src, const struct bitmap_data *dst, const char *name, BOOL todo)
|
||||
{
|
||||
BitmapTestSrc *src_obj;
|
||||
@@ -309,9 +394,7 @@ static void test_conversion(const struct bitmap_data *src, const struct bitmap_d
|
||||
CreateTestBitmap(src, &src_obj);
|
||||
|
||||
hr = WICConvertBitmapSource(dst->format, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
|
||||
if (todo)
|
||||
todo_wine ok(SUCCEEDED(hr), "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr);
|
||||
else
|
||||
todo_wine_if (todo)
|
||||
ok(SUCCEEDED(hr), "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
@@ -500,7 +583,7 @@ static void test_encoder_properties(const CLSID* clsid_encoder, IPropertyBag2 *o
|
||||
if (FAILED(hr))
|
||||
return;
|
||||
|
||||
ok(cProperties == cProperties2, "Missmatch of property count (IPropertyBag2::CountProperties=%i, IPropertyBag2::GetPropertyInfo=%i)\n",
|
||||
ok(cProperties == cProperties2, "Mismatch of property count (IPropertyBag2::CountProperties=%i, IPropertyBag2::GetPropertyInfo=%i)\n",
|
||||
(int)cProperties, (int)cProperties2);
|
||||
}
|
||||
|
||||
@@ -741,6 +824,14 @@ START_TEST(converter)
|
||||
test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE);
|
||||
test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE);
|
||||
|
||||
test_conversion(&testdata_24bppRGB, &testdata_32bppGrayFloat, "24bppRGB -> 32bppGrayFloat", FALSE);
|
||||
test_conversion(&testdata_32bppBGR, &testdata_32bppGrayFloat, "32bppBGR -> 32bppGrayFloat", FALSE);
|
||||
|
||||
test_conversion(&testdata_24bppBGR, &testdata_8bppGray, "24bppBGR -> 8bppGray", FALSE);
|
||||
test_conversion(&testdata_32bppBGR, &testdata_8bppGray, "32bppBGR -> 8bppGray", FALSE);
|
||||
test_conversion(&testdata_32bppGrayFloat, &testdata_24bppBGR_gray, "32bppGrayFloat -> 24bppBGR gray", FALSE);
|
||||
test_conversion(&testdata_32bppGrayFloat, &testdata_8bppGray, "32bppGrayFloat -> 8bppGray", FALSE);
|
||||
|
||||
test_invalid_conversion();
|
||||
test_default_converter();
|
||||
|
||||
|
||||
@@ -969,6 +969,8 @@ static void test_metadata_png(void)
|
||||
IWICBitmapFrameDecode *frame;
|
||||
IWICMetadataBlockReader *blockreader;
|
||||
IWICMetadataReader *reader;
|
||||
IWICMetadataQueryReader *queryreader;
|
||||
IWICComponentFactory *factory;
|
||||
GUID containerformat;
|
||||
HRESULT hr;
|
||||
UINT count=0xdeadbeef;
|
||||
@@ -1039,9 +1041,34 @@ static void test_metadata_png(void)
|
||||
hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 1, &reader);
|
||||
todo_wine ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "GetReaderByIndex failed, hr=%x\n", hr);
|
||||
|
||||
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IWICComponentFactory, (void**)&factory);
|
||||
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
|
||||
|
||||
hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, NULL, &queryreader);
|
||||
ok(hr == E_INVALIDARG, "CreateQueryReaderFromBlockReader should have failed: %08x\n", hr);
|
||||
|
||||
hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, blockreader, NULL);
|
||||
ok(hr == E_INVALIDARG, "CreateQueryReaderFromBlockReader should have failed: %08x\n", hr);
|
||||
|
||||
hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, blockreader, &queryreader);
|
||||
ok(hr == S_OK, "CreateQueryReaderFromBlockReader failed: %08x\n", hr);
|
||||
|
||||
IWICMetadataQueryReader_Release(queryreader);
|
||||
|
||||
IWICComponentFactory_Release(factory);
|
||||
|
||||
IWICMetadataBlockReader_Release(blockreader);
|
||||
}
|
||||
|
||||
hr = IWICBitmapFrameDecode_GetMetadataQueryReader(frame, &queryreader);
|
||||
ok(hr == S_OK, "GetMetadataQueryReader failed: %08x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
IWICMetadataQueryReader_Release(queryreader);
|
||||
}
|
||||
|
||||
IWICBitmapFrameDecode_Release(frame);
|
||||
|
||||
IWICBitmapDecoder_Release(decoder);
|
||||
@@ -1131,6 +1158,7 @@ static void test_metadata_gif(void)
|
||||
IWICBitmapFrameDecode *frame;
|
||||
IWICMetadataBlockReader *blockreader;
|
||||
IWICMetadataReader *reader;
|
||||
IWICMetadataQueryReader *queryreader;
|
||||
GUID format;
|
||||
HRESULT hr;
|
||||
UINT count;
|
||||
@@ -1453,6 +1481,16 @@ static void test_metadata_gif(void)
|
||||
IWICMetadataBlockReader_Release(blockreader);
|
||||
}
|
||||
|
||||
hr = IWICBitmapFrameDecode_GetMetadataQueryReader(frame, &queryreader);
|
||||
ok(hr == S_OK ||
|
||||
broken(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION) /* before Vista */,
|
||||
"GetMetadataQueryReader failed: %08x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
IWICMetadataQueryReader_Release(queryreader);
|
||||
}
|
||||
|
||||
IWICBitmapFrameDecode_Release(frame);
|
||||
IWICBitmapDecoder_Release(decoder);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user