windowscodecs/tests: Enable compilation with long types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Esme Povirk <esme@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-03-09 08:21:55 +01:00 committed by Alexandre Julliard
parent 2c0c6a9f42
commit ab381924b5
16 changed files with 1614 additions and 1615 deletions

View file

@ -1,4 +1,3 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = windowscodecs.dll
IMPORTS = windowscodecs propsys oleaut32 ole32 user32 gdi32 shlwapi uuid

File diff suppressed because it is too large Load diff

View file

@ -75,7 +75,7 @@ static void test_decode_24bpp(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_24bpp));
@ -87,11 +87,11 @@ static void test_decode_24bpp(void)
GlobalUnlock(hbmpdata);
hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == S_OK || broken(hr == WINCODEC_ERR_BADIMAGE) /* XP */, "Initialize failed, hr=%x\n", hr);
ok(hr == S_OK || broken(hr == WINCODEC_ERR_BADIMAGE) /* XP */, "Initialize failed, hr=%lx\n", hr);
if (FAILED(hr))
{
win_skip("BMP decoder failed to initialize\n");
@ -101,72 +101,72 @@ static void test_decode_24bpp(void)
}
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n");
hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, &queryreader);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %lx\n", hr);
hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, &colorcontext, &count);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %lx\n", hr);
hr = IWICBitmapDecoder_GetThumbnail(decoder, &thumbnail);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "expected WINCODEC_ERR_CODECNOTHUMBNAIL, got %x\n", hr);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "expected WINCODEC_ERR_CODECNOTHUMBNAIL, got %lx\n", hr);
hr = IWICBitmapDecoder_GetPreview(decoder, &thumbnail);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %lx\n", hr);
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %u\n", count);
hr = IWICBitmapDecoder_GetFrame(decoder, 1, &framedecode);
ok(hr == E_INVALIDARG || hr == WINCODEC_ERR_FRAMEMISSING, "GetFrame returned %x\n", hr);
ok(hr == E_INVALIDARG || hr == WINCODEC_ERR_FRAMEMISSING, "GetFrame returned %lx\n", hr);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
IWICImagingFactory *factory;
IWICPalette *palette;
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height);
ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetSize failed, hr=%lx\n", hr);
ok(width == 2, "expected width=2, got %u\n", width);
ok(height == 3, "expected height=2, got %u\n", height);
hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%lx\n", hr);
ok(dpiX == 96.0, "expected dpiX=96.0, got %f\n", dpiX);
ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY);
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
hr = IWICBitmapFrameDecode_GetMetadataQueryReader(framedecode, &queryreader);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %lx\n", hr);
hr = IWICBitmapFrameDecode_GetColorContexts(framedecode, 1, &colorcontext, &count);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %lx\n", hr);
hr = IWICBitmapFrameDecode_GetThumbnail(framedecode, &thumbnail);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "expected WINCODEC_ERR_CODECNOTHUMBNAIL, got %x\n", hr);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "expected WINCODEC_ERR_CODECNOTHUMBNAIL, got %lx\n", hr);
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %lx\n", hr);
IWICPalette_Release(palette);
}
@ -179,39 +179,39 @@ static void test_decode_24bpp(void)
rc.Width = 3;
rc.Height = 3;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 6, sizeof(imagedata), imagedata);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
rc.X = -1;
rc.Y = 0;
rc.Width = 2;
rc.Height = 3;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 6, sizeof(imagedata), imagedata);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
rc.X = 0;
rc.Y = 0;
rc.Width = 2;
rc.Height = 3;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 4, sizeof(imagedata), imagedata);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
rc.X = 0;
rc.Y = 0;
rc.Width = 2;
rc.Height = 3;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 4, 5, imagedata);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
rc.X = 0;
rc.Y = 0;
rc.Width = 2;
rc.Height = 3;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 6, sizeof(imagedata), imagedata);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%lx\n", hr);
ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)), "unexpected image data\n");
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, NULL, 6, sizeof(imagedata), imagedata);
ok(SUCCEEDED(hr), "CopyPixels(rect=NULL) failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPixels(rect=NULL) failed, hr=%lx\n", hr);
ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)), "unexpected image data\n");
IWICBitmapFrameDecode_Release(framedecode);
@ -219,29 +219,29 @@ static void test_decode_24bpp(void)
/* cannot initialize twice */
hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, hr=%lx\n", hr);
/* cannot querycapability after initialize */
hr = IWICBitmapDecoder_QueryCapability(decoder, bmpstream, &capability);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, hr=%lx\n", hr);
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder2);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
ok(hr == S_OK, "QueryCapability failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryCapability failed, hr=%lx\n", hr);
ok(capability == (WICBitmapDecoderCapabilityCanDecodeAllImages),
"unexpected capabilities: %x\n", capability);
"unexpected capabilities: %lx\n", capability);
/* cannot initialize after querycapability */
hr = IWICBitmapDecoder_Initialize(decoder2, bmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, hr=%lx\n", hr);
/* cannot querycapability twice */
hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, hr=%lx\n", hr);
IWICBitmapDecoder_Release(decoder2);
}
@ -295,7 +295,7 @@ static void test_decode_1bpp(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_1bpp));
@ -307,62 +307,62 @@ static void test_decode_1bpp(void)
GlobalUnlock(hbmpdata);
hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
ok(hr == S_OK, "Initialize failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n");
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %u\n", count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
IWICImagingFactory *factory;
IWICPalette *palette;
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height);
ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetSize failed, hr=%lx\n", hr);
ok(width == 2, "expected width=2, got %u\n", width);
ok(height == 2, "expected height=2, got %u\n", height);
hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%lx\n", hr);
ok(dpiX == 96.0, "expected dpiX=96.0, got %f\n", dpiX);
ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY);
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat1bppIndexed), "unexpected pixel format\n");
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette);
ok(SUCCEEDED(hr), "CopyPalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPalette failed, hr=%lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 2, "expected count=2, got %u\n", count);
hr = IWICPalette_GetColors(palette, 2, palettedata, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 2, "expected count=2, got %u\n", count);
ok(!memcmp(palettedata, expected_palettedata, sizeof(palettedata)), "unexpected palette data\n");
@ -377,7 +377,7 @@ static void test_decode_1bpp(void)
rc.Width = 2;
rc.Height = 2;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 1, sizeof(imagedata), imagedata);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%lx\n", hr);
ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)), "unexpected image data\n");
IWICBitmapFrameDecode_Release(framedecode);
@ -385,13 +385,13 @@ static void test_decode_1bpp(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder2);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
ok(hr == S_OK, "QueryCapability failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryCapability failed, hr=%lx\n", hr);
ok(capability == (WICBitmapDecoderCapabilityCanDecodeAllImages),
"unexpected capabilities: %x\n", capability);
"unexpected capabilities: %lx\n", capability);
IWICBitmapDecoder_Release(decoder2);
}
@ -454,7 +454,7 @@ static void test_decode_4bpp(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_4bpp));
@ -466,62 +466,62 @@ static void test_decode_4bpp(void)
GlobalUnlock(hbmpdata);
hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
ok(hr == S_OK, "Initialize failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n");
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %u\n", count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
IWICImagingFactory *factory;
IWICPalette *palette;
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height);
ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetSize failed, hr=%lx\n", hr);
ok(width == 2, "expected width=2, got %u\n", width);
ok(height == 2, "expected height=2, got %u\n", height);
hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%lx\n", hr);
ok(fabs(dpiX - 254.0) < 0.01, "expected dpiX=96.0, got %f\n", dpiX);
ok(fabs(dpiY - 508.0) < 0.01, "expected dpiY=96.0, got %f\n", dpiY);
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat4bppIndexed), "unexpected pixel format\n");
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette);
ok(SUCCEEDED(hr), "CopyPalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPalette failed, hr=%lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 5, "expected count=5, got %u\n", count);
hr = IWICPalette_GetColors(palette, 5, palettedata, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 5, "expected count=5, got %u\n", count);
ok(!memcmp(palettedata, expected_palettedata, sizeof(palettedata)), "unexpected palette data\n");
@ -536,7 +536,7 @@ static void test_decode_4bpp(void)
rc.Width = 2;
rc.Height = 2;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 1, sizeof(imagedata), imagedata);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%lx\n", hr);
ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)), "unexpected image data\n");
IWICBitmapFrameDecode_Release(framedecode);
@ -544,13 +544,13 @@ static void test_decode_4bpp(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder2);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
ok(hr == S_OK, "QueryCapability failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryCapability failed, hr=%lx\n", hr);
ok(capability == (WICBitmapDecoderCapabilityCanDecodeAllImages),
"unexpected capabilities: %x\n", capability);
"unexpected capabilities: %lx\n", capability);
IWICBitmapDecoder_Release(decoder2);
}
@ -634,7 +634,7 @@ static void test_decode_rle8(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_rle8));
@ -646,62 +646,62 @@ static void test_decode_rle8(void)
GlobalUnlock(hbmpdata);
hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
ok(hr == S_OK, "Initialize failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n");
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %u\n", count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
IWICImagingFactory *factory;
IWICPalette *palette;
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height);
ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetSize failed, hr=%lx\n", hr);
ok(width == 8, "expected width=8, got %u\n", width);
ok(height == 8, "expected height=8, got %u\n", height);
hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%lx\n", hr);
ok(fabs(dpiX - 72.0) < 0.01, "expected dpiX=96.0, got %f\n", dpiX);
ok(fabs(dpiY - 72.0) < 0.01, "expected dpiY=96.0, got %f\n", dpiY);
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat32bppBGR), "unexpected pixel format\n");
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette);
ok(SUCCEEDED(hr), "CopyPalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPalette failed, hr=%lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 17, "expected count=17, got %u\n", count);
hr = IWICPalette_GetColors(palette, 17, palettedata, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 17, "expected count=17, got %u\n", count);
ok(!memcmp(palettedata, expected_palettedata, sizeof(palettedata)), "unexpected palette data\n");
@ -716,7 +716,7 @@ static void test_decode_rle8(void)
rc.Width = 8;
rc.Height = 8;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 32, sizeof(imagedata), (BYTE*)imagedata);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%lx\n", hr);
ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)), "unexpected image data\n");
IWICBitmapFrameDecode_Release(framedecode);
@ -724,13 +724,13 @@ static void test_decode_rle8(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder2);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
ok(hr == S_OK, "QueryCapability failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryCapability failed, hr=%lx\n", hr);
ok(capability == (WICBitmapDecoderCapabilityCanDecodeAllImages),
"unexpected capabilities: %x\n", capability);
"unexpected capabilities: %lx\n", capability);
IWICBitmapDecoder_Release(decoder2);
}
@ -801,7 +801,7 @@ static void test_decode_rle4(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_rle4));
@ -813,62 +813,62 @@ static void test_decode_rle4(void)
GlobalUnlock(hbmpdata);
hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
ok(hr == S_OK, "Initialize failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n");
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %u\n", count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
IWICImagingFactory *factory;
IWICPalette *palette;
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height);
ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetSize failed, hr=%lx\n", hr);
ok(width == 8, "expected width=8, got %u\n", width);
ok(height == 8, "expected height=8, got %u\n", height);
hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%lx\n", hr);
ok(fabs(dpiX - 72.0) < 0.01, "expected dpiX=96.0, got %f\n", dpiX);
ok(fabs(dpiY - 72.0) < 0.01, "expected dpiY=96.0, got %f\n", dpiY);
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat32bppBGR), "unexpected pixel format\n");
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette);
ok(SUCCEEDED(hr), "CopyPalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPalette failed, hr=%lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 6, "expected count=6, got %u\n", count);
hr = IWICPalette_GetColors(palette, 6, palettedata, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 6, "expected count=6, got %u\n", count);
ok(!memcmp(palettedata, expected_palettedata, sizeof(palettedata)), "unexpected palette data\n");
@ -883,7 +883,7 @@ static void test_decode_rle4(void)
rc.Width = 8;
rc.Height = 8;
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 32, sizeof(imagedata), (BYTE*)imagedata);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%lx\n", hr);
ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)), "unexpected image data\n");
IWICBitmapFrameDecode_Release(framedecode);
@ -891,13 +891,13 @@ static void test_decode_rle4(void)
hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder2);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
ok(hr == S_OK, "QueryCapability failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryCapability failed, hr=%lx\n", hr);
ok(capability == (WICBitmapDecoderCapabilityCanDecodeAllImages),
"unexpected capabilities: %x\n", capability);
"unexpected capabilities: %lx\n", capability);
IWICBitmapDecoder_Release(decoder2);
}
@ -928,31 +928,31 @@ static void test_componentinfo(void)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICImagingFactory_CreateComponentInfo(factory, &CLSID_WICBmpDecoder, &info);
ok(SUCCEEDED(hr), "CreateComponentInfo failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateComponentInfo failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICComponentInfo_GetComponentType(info, &type);
ok(SUCCEEDED(hr), "GetComponentType failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetComponentType failed, hr=%lx\n", hr);
ok(type == WICDecoder, "got %i, expected WICDecoder\n", type);
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICBitmapDecoderInfo, (void**)&decoderinfo);
ok(SUCCEEDED(hr), "QueryInterface failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "QueryInterface failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
pattern_count = 0;
pattern_size = 0;
hr = IWICBitmapDecoderInfo_GetPatterns(decoderinfo, 0, NULL, &pattern_count, &pattern_size);
ok(SUCCEEDED(hr), "GetPatterns failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPatterns failed, hr=%lx\n", hr);
ok(pattern_count != 0, "pattern count is 0\n");
ok(pattern_size > pattern_count * sizeof(WICBitmapPattern), "size=%i, count=%i\n", pattern_size, pattern_count);
patterns = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pattern_size);
hr = IWICBitmapDecoderInfo_GetPatterns(decoderinfo, pattern_size, patterns, &pattern_count, &pattern_size);
ok(SUCCEEDED(hr), "GetPatterns failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPatterns failed, hr=%lx\n", hr);
ok(pattern_count != 0, "pattern count is 0\n");
ok(pattern_size > pattern_count * sizeof(WICBitmapPattern), "size=%i, count=%i\n", pattern_size, pattern_count);
ok(patterns[0].Length != 0, "pattern length is 0\n");
@ -961,16 +961,16 @@ static void test_componentinfo(void)
pattern_size -= 1;
hr = IWICBitmapDecoderInfo_GetPatterns(decoderinfo, pattern_size, patterns, &pattern_count, &pattern_size);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetPatterns returned %x, expected WINCODEC_ERR_INSUFFICIENTBUFFER\n", hr);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetPatterns returned %lx, expected WINCODEC_ERR_INSUFFICIENTBUFFER\n", hr);
HeapFree(GetProcessHeap(), 0, patterns);
hr = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &decoder);
ok(SUCCEEDED(hr), "CreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n");
IWICBitmapDecoder_Release(decoder);
@ -985,12 +985,12 @@ static void test_componentinfo(void)
GlobalUnlock(hbmpdata);
hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
boolresult = 0;
hr = IWICBitmapDecoderInfo_MatchesPattern(decoderinfo, bmpstream, &boolresult);
ok(SUCCEEDED(hr), "MatchesPattern failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "MatchesPattern failed, hr=%lx\n", hr);
ok(boolresult, "pattern not matched\n");
IStream_Release(bmpstream);
@ -1021,7 +1021,7 @@ static void test_createfromstream(void)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_1bpp));
@ -1033,16 +1033,16 @@ static void test_createfromstream(void)
GlobalUnlock(hbmpdata);
hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICImagingFactory_CreateDecoderFromStream(factory, bmpstream,
NULL, WICDecodeMetadataCacheOnDemand, &decoder);
ok(SUCCEEDED(hr), "CreateDecoderFromStream failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateDecoderFromStream failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n");
IWICBitmapDecoder_Release(decoder);
@ -1065,20 +1065,20 @@ static void test_create_decoder(void)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
hr = IWICImagingFactory_CreateDecoder(factory, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICImagingFactory_CreateDecoder(factory, NULL, NULL, &decoder);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICImagingFactory_CreateDecoder(factory, &GUID_ContainerFormatBmp, NULL, &decoder);
ok(hr == S_OK, "CreateDecoder error %#x\n", hr);
ok(hr == S_OK, "CreateDecoder error %#lx\n", hr);
IWICBitmapDecoder_Release(decoder);
hr = IWICImagingFactory_CreateDecoder(factory, &GUID_ContainerFormatBmp, &GUID_VendorMicrosoft, &decoder);
ok(hr == S_OK, "CreateDecoder error %#x\n", hr);
ok(hr == S_OK, "CreateDecoder error %#lx\n", hr);
IWICBitmapDecoder_Release(decoder);
IWICImagingFactory_Release(factory);
@ -1104,77 +1104,77 @@ static void test_writesource_palette(void)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
/* Encoder with palette set */
hr = IWICImagingFactory_CreateBitmap(factory, 1, 1, &GUID_WICPixelFormat1bppIndexed,
WICBitmapCacheOnDemand, &bitmap);
ok(hr == S_OK, "CreateBitmap error %#x\n", hr);
ok(hr == S_OK, "CreateBitmap error %#lx\n", hr);
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "CreateStream error %#x\n", hr);
ok(hr == S_OK, "CreateStream error %#lx\n", hr);
hr = IWICImagingFactory_CreateEncoder(factory, &GUID_ContainerFormatBmp, &GUID_VendorMicrosoft, &encoder);
ok(hr == S_OK, "CreateDecoder error %#x\n", hr);
ok(hr == S_OK, "CreateDecoder error %#lx\n", hr);
hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
ok(hr == S_OK, "IWICBitmapEncoder_Initialize error %#x\n", hr);
ok(hr == S_OK, "IWICBitmapEncoder_Initialize error %#lx\n", hr);
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame_encode, &encode_options);
ok(hr == S_OK, "CreateNewFrame error %#x\n", hr);
ok(hr == S_OK, "CreateNewFrame error %#lx\n", hr);
hr = IWICBitmapFrameEncode_Initialize(frame_encode, encode_options);
ok(hr == S_OK, "IWICBitmapFrameEncode_Initialize error %#x\n", hr);
ok(hr == S_OK, "IWICBitmapFrameEncode_Initialize error %#lx\n", hr);
IPropertyBag2_Release(encode_options);
hr = IWICBitmapFrameEncode_SetSize(frame_encode, 1, 1);
ok(hr == S_OK, "SetSize error %#x\n", hr);
ok(hr == S_OK, "SetSize error %#lx\n", hr);
pixelformat = GUID_WICPixelFormat1bppIndexed;
hr = IWICBitmapFrameEncode_SetPixelFormat(frame_encode, &pixelformat);
ok(hr == S_OK, "SetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "SetPixelFormat error %#lx\n", hr);
ok(!memcmp(&pixelformat, &GUID_WICPixelFormat1bppIndexed, sizeof(pixelformat)), "pixel format changed\n");
hr = IWICPalette_InitializeCustom(palette, encode_palette, 2);
ok(hr == S_OK, "InitializeCustom error %#x\n", hr);
ok(hr == S_OK, "InitializeCustom error %#lx\n", hr);
hr = IWICBitmapFrameEncode_SetPalette(frame_encode, palette);
ok(hr == S_OK, "SetPalette error %#x\n", hr);
ok(hr == S_OK, "SetPalette error %#lx\n", hr);
hr = IWICPalette_InitializeCustom(palette, source_palette, 2);
ok(hr == S_OK, "InitializeCustom error %#x\n", hr);
ok(hr == S_OK, "InitializeCustom error %#lx\n", hr);
hr = IWICBitmap_SetPalette(bitmap, palette);
ok(hr == S_OK, "SetPalette error %#x\n", hr);
ok(hr == S_OK, "SetPalette error %#lx\n", hr);
hr = IWICBitmapFrameEncode_WriteSource(frame_encode, (IWICBitmapSource*)bitmap, NULL);
ok(hr == S_OK, "WriteSource error %#x\n", hr);
ok(hr == S_OK, "WriteSource error %#lx\n", hr);
hr = IWICBitmapFrameEncode_Commit(frame_encode);
ok(hr == S_OK, "Commit error %#x\n", hr);
ok(hr == S_OK, "Commit error %#lx\n", hr);
IWICBitmapFrameEncode_Release(frame_encode);
hr = IWICBitmapEncoder_Commit(encoder);
ok(hr == S_OK, "Commit error %#x\n", hr);
ok(hr == S_OK, "Commit error %#lx\n", hr);
IWICBitmapEncoder_Release(encoder);
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, WICDecodeMetadataCacheOnLoad, &decoder);
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame_decode);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame_decode, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColors(palette, 2, result_palette, &result_colors);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\n", hr);
ok(result_colors == 2, "Got %i colors\n", result_colors);
ok(result_palette[0] == encode_palette[0], "Unexpected palette entry: %x\n", result_palette[0]);
ok(result_palette[1] == encode_palette[1], "Unexpected palette entry: %x\n", result_palette[0]);
@ -1185,35 +1185,35 @@ static void test_writesource_palette(void)
/* Encoder with no palette set */
hr = IWICImagingFactory_CreateEncoder(factory, &GUID_ContainerFormatBmp, &GUID_VendorMicrosoft, &encoder);
ok(hr == S_OK, "CreateDecoder error %#x\n", hr);
ok(hr == S_OK, "CreateDecoder error %#lx\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "CreateStream error %#x\n", hr);
ok(hr == S_OK, "CreateStream error %#lx\n", hr);
hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
ok(hr == S_OK, "IWICBitmapEncoder_Initialize error %#x\n", hr);
ok(hr == S_OK, "IWICBitmapEncoder_Initialize error %#lx\n", hr);
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame_encode, &encode_options);
ok(hr == S_OK, "CreateNewFrame error %#x\n", hr);
ok(hr == S_OK, "CreateNewFrame error %#lx\n", hr);
hr = IWICBitmapFrameEncode_Initialize(frame_encode, encode_options);
ok(hr == S_OK, "IWICBitmapFrameEncode_Initialize error %#x\n", hr);
ok(hr == S_OK, "IWICBitmapFrameEncode_Initialize error %#lx\n", hr);
IPropertyBag2_Release(encode_options);
hr = IWICBitmapFrameEncode_SetSize(frame_encode, 1, 1);
ok(hr == S_OK, "SetSize error %#x\n", hr);
ok(hr == S_OK, "SetSize error %#lx\n", hr);
pixelformat = GUID_WICPixelFormat1bppIndexed;
hr = IWICBitmapFrameEncode_SetPixelFormat(frame_encode, &pixelformat);
ok(hr == S_OK, "SetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "SetPixelFormat error %#lx\n", hr);
ok(!memcmp(&pixelformat, &GUID_WICPixelFormat1bppIndexed, sizeof(pixelformat)), "pixel format changed\n");
hr = IWICPalette_InitializeCustom(palette, source_palette, 2);
ok(hr == S_OK, "InitializeCustom error %#x\n", hr);
ok(hr == S_OK, "InitializeCustom error %#lx\n", hr);
hr = IWICBitmap_SetPalette(bitmap, palette);
ok(hr == S_OK, "SetPalette error %#x\n", hr);
ok(hr == S_OK, "SetPalette error %#lx\n", hr);
hr = IWICBitmapFrameEncode_WriteSource(frame_encode, (IWICBitmapSource*)bitmap, NULL);
if (hr == WINCODEC_ERR_PALETTEUNAVAILABLE)
@ -1227,29 +1227,29 @@ static void test_writesource_palette(void)
IWICImagingFactory_Release(factory);
return;
}
ok(hr == S_OK, "WriteSource error %#x\n", hr);
ok(hr == S_OK, "WriteSource error %#lx\n", hr);
hr = IWICBitmapFrameEncode_Commit(frame_encode);
ok(hr == S_OK, "Commit error %#x\n", hr);
ok(hr == S_OK, "Commit error %#lx\n", hr);
IWICBitmapFrameEncode_Release(frame_encode);
hr = IWICBitmapEncoder_Commit(encoder);
ok(hr == S_OK, "Commit error %#x\n", hr);
ok(hr == S_OK, "Commit error %#lx\n", hr);
IWICBitmapEncoder_Release(encoder);
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, WICDecodeMetadataCacheOnLoad, &decoder);
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame_decode);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame_decode, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColors(palette, 2, result_palette, &result_colors);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\n", hr);
ok(result_colors == 2, "Got %i colors\n", result_colors);
ok(result_palette[0] == source_palette[0], "Unexpected palette entry: %x\n", result_palette[0]);
ok(result_palette[1] == source_palette[1], "Unexpected palette entry: %x\n", result_palette[0]);

View file

@ -227,7 +227,7 @@ static void CreateTestBitmap(const bitmap_data *data, BitmapTestSrc **This)
static void DeleteTestBitmap(BitmapTestSrc *This)
{
ok(This->IWICBitmapSource_iface.lpVtbl == &BitmapTestSrc_Vtbl, "test bitmap %p deleted with incorrect vtable\n", This);
ok(This->ref == 1, "test bitmap %p deleted with %i references instead of 1\n", This, This->ref);
ok(This->ref == 1, "test bitmap %p deleted with %li references instead of 1\n", This, This->ref);
HeapFree(GetProcessHeap(), 0, This);
}
@ -335,17 +335,17 @@ static void compare_bitmap_data(const struct bitmap_data *src, const struct bitm
HRESULT hr;
hr = IWICBitmapSource_GetSize(source, &width, &height);
ok(SUCCEEDED(hr), "GetSize(%s) failed, hr=%x\n", name, hr);
ok(SUCCEEDED(hr), "GetSize(%s) failed, hr=%lx\n", name, hr);
ok(width == expect->width, "expecting %u, got %u (%s)\n", expect->width, width, name);
ok(height == expect->height, "expecting %u, got %u (%s)\n", expect->height, height, name);
hr = IWICBitmapSource_GetResolution(source, &xres, &yres);
ok(SUCCEEDED(hr), "GetResolution(%s) failed, hr=%x\n", name, hr);
ok(SUCCEEDED(hr), "GetResolution(%s) failed, hr=%lx\n", name, hr);
ok(fabs(xres - expect->xres) < 0.02, "expecting %0.2f, got %0.2f (%s)\n", expect->xres, xres, name);
ok(fabs(yres - expect->yres) < 0.02, "expecting %0.2f, got %0.2f (%s)\n", expect->yres, yres, name);
hr = IWICBitmapSource_GetPixelFormat(source, &dst_pixelformat);
ok(SUCCEEDED(hr), "GetPixelFormat(%s) failed, hr=%x\n", name, hr);
ok(SUCCEEDED(hr), "GetPixelFormat(%s) failed, hr=%lx\n", name, hr);
ok(IsEqualGUID(&dst_pixelformat, expect->format), "got unexpected pixel format %s (%s)\n", wine_dbgstr_guid(&dst_pixelformat), name);
prc.X = 0;
@ -359,7 +359,7 @@ static void compare_bitmap_data(const struct bitmap_data *src, const struct bitm
converted_bits = HeapAlloc(GetProcessHeap(), 0, buffersize);
memset(converted_bits, 0xaa, buffersize);
hr = IWICBitmapSource_CopyPixels(source, &prc, stride, buffersize, converted_bits);
ok(SUCCEEDED(hr), "CopyPixels(%s) failed, hr=%x\n", name, hr);
ok(SUCCEEDED(hr), "CopyPixels(%s) failed, hr=%lx\n", name, hr);
/* The result of conversion of color to indexed formats depends on
* optimized palette generation implementation. We either need to
@ -371,7 +371,7 @@ static void compare_bitmap_data(const struct bitmap_data *src, const struct bitm
/* Test with NULL rectangle - should copy the whole bitmap */
memset(converted_bits, 0xaa, buffersize);
hr = IWICBitmapSource_CopyPixels(source, NULL, stride, buffersize, converted_bits);
ok(SUCCEEDED(hr), "CopyPixels(%s,rc=NULL) failed, hr=%x\n", name, hr);
ok(SUCCEEDED(hr), "CopyPixels(%s,rc=NULL) failed, hr=%lx\n", name, hr);
/* see comment above */
if (!(!is_indexed_format(src->format) && is_indexed_format(expect->format)))
ok(compare_bits(expect, buffersize, converted_bits), "unexpected pixel data (%s)\n", name);
@ -589,7 +589,7 @@ static void test_conversion(const struct bitmap_data *src, const struct bitmap_d
hr = WICConvertBitmapSource(dst->format, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
todo_wine_if (todo)
ok(hr == S_OK ||
broken(hr == E_INVALIDARG || hr == WINCODEC_ERR_COMPONENTNOTFOUND) /* XP */, "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr);
broken(hr == E_INVALIDARG || hr == WINCODEC_ERR_COMPONENTNOTFOUND) /* XP */, "WICConvertBitmapSource(%s) failed, hr=%lx\n", name, hr);
if (hr == S_OK)
{
@ -611,7 +611,7 @@ static void test_invalid_conversion(void)
/* convert to a non-pixel-format GUID */
hr = WICConvertBitmapSource(&GUID_VendorMicrosoft, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "WICConvertBitmapSource returned %x\n", hr);
ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "WICConvertBitmapSource returned %lx\n", hr);
DeleteTestBitmap(src_obj);
}
@ -627,18 +627,18 @@ static void test_default_converter(void)
hr = CoCreateInstance(&CLSID_WICDefaultFormatConverter, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICFormatConverter, (void**)&converter);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICFormatConverter_CanConvert(converter, &GUID_WICPixelFormat32bppBGRA,
&GUID_WICPixelFormat32bppBGR, &can_convert);
ok(SUCCEEDED(hr), "CanConvert returned %x\n", hr);
ok(SUCCEEDED(hr), "CanConvert returned %lx\n", hr);
ok(can_convert, "expected TRUE, got %i\n", can_convert);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat32bppBGR, WICBitmapDitherTypeNone, NULL, 0.0,
WICBitmapPaletteTypeCustom);
ok(SUCCEEDED(hr), "Initialize returned %x\n", hr);
ok(SUCCEEDED(hr), "Initialize returned %lx\n", hr);
if (SUCCEEDED(hr))
compare_bitmap_data(&testdata_32bppBGRA, &testdata_32bppBGR, (IWICBitmapSource*)converter, "default converter");
@ -660,18 +660,18 @@ static void test_converter_4bppGray(void)
hr = CoCreateInstance(&CLSID_WICDefaultFormatConverter, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICFormatConverter, (void**)&converter);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICFormatConverter_CanConvert(converter, &GUID_WICPixelFormat32bppBGRA,
&GUID_WICPixelFormat4bppGray, &can_convert);
ok(SUCCEEDED(hr), "CanConvert returned %x\n", hr);
ok(SUCCEEDED(hr), "CanConvert returned %lx\n", hr);
todo_wine ok(can_convert, "expected TRUE, got %i\n", can_convert);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat4bppGray, WICBitmapDitherTypeNone, NULL, 0.0,
WICBitmapPaletteTypeCustom);
todo_wine ok(SUCCEEDED(hr), "Initialize returned %x\n", hr);
todo_wine ok(SUCCEEDED(hr), "Initialize returned %lx\n", hr);
if (SUCCEEDED(hr))
compare_bitmap_data(&testdata_32bppBGRA, &testdata_4bppGray, (IWICBitmapSource*)converter, "4bppGray converter");
@ -693,18 +693,18 @@ static void test_converter_8bppGray(void)
hr = CoCreateInstance(&CLSID_WICDefaultFormatConverter, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICFormatConverter, (void**)&converter);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICFormatConverter_CanConvert(converter, &GUID_WICPixelFormat32bppBGRA,
&GUID_WICPixelFormat8bppGray, &can_convert);
ok(SUCCEEDED(hr), "CanConvert returned %x\n", hr);
ok(SUCCEEDED(hr), "CanConvert returned %lx\n", hr);
ok(can_convert, "expected TRUE, got %i\n", can_convert);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat8bppGray, WICBitmapDitherTypeNone, NULL, 0.0,
WICBitmapPaletteTypeCustom);
ok(SUCCEEDED(hr), "Initialize returned %x\n", hr);
ok(SUCCEEDED(hr), "Initialize returned %lx\n", hr);
if (SUCCEEDED(hr))
compare_bitmap_data(&testdata_32bppBGRA, &testdata_8bppGray, (IWICBitmapSource*)converter, "8bppGray converter");
@ -803,13 +803,13 @@ static void test_specific_encoder_properties(IPropertyBag2 *options, const prope
{
ok(all_props[idx].vt == data[i].var_type, "Property %s has unexpected vt type, vt=%i\n",
wine_dbgstr_w(data[i].name), all_props[idx].vt);
ok(all_props[idx].dwType == PROPBAG2_TYPE_DATA, "Property %s has unexpected dw type, vt=%i\n",
ok(all_props[idx].dwType == PROPBAG2_TYPE_DATA, "Property %s has unexpected dw type, vt=%li\n",
wine_dbgstr_w(data[i].name), all_props[idx].dwType);
ok(all_props[idx].cfType == 0, "Property %s has unexpected cf type, vt=%i\n",
wine_dbgstr_w(data[i].name), all_props[idx].cfType);
}
ok(SUCCEEDED(hr), "Reading property %s from bag failed, hr=%x\n",
ok(SUCCEEDED(hr), "Reading property %s from bag failed, hr=%lx\n",
wine_dbgstr_w(data[i].name), hr);
if (SUCCEEDED(hr))
@ -855,16 +855,16 @@ static void test_encoder_properties(const CLSID* clsid_encoder, IPropertyBag2 *o
/* CountProperties */
{
hr = IPropertyBag2_CountProperties(options, &cProperties);
ok(SUCCEEDED(hr), "Reading property count, hr=%x\n", hr);
ok(SUCCEEDED(hr), "Reading property count, hr=%lx\n", hr);
}
/* GetPropertyInfo */
{
hr = IPropertyBag2_GetPropertyInfo(options, cProperties, 1, all_props, &cProperties2);
ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - iProperty out of bounce handled wrong, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - iProperty out of bounce handled wrong, hr=%lx\n", hr);
hr = IPropertyBag2_GetPropertyInfo(options, 0, cProperties+1, all_props, &cProperties2);
ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - cProperty out of bounce handled wrong, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - cProperty out of bounce handled wrong, hr=%lx\n", hr);
if (cProperties == 0) /* GetPropertyInfo can be called for zero items on Windows 8 but not on Windows 7 (wine behaves like Win8) */
{
@ -874,7 +874,7 @@ static void test_encoder_properties(const CLSID* clsid_encoder, IPropertyBag2 *o
else
{
hr = IPropertyBag2_GetPropertyInfo(options, 0, min(64, cProperties), all_props, &cProperties2);
ok(SUCCEEDED(hr), "Reading infos from property bag failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "Reading infos from property bag failed, hr=%lx\n", hr);
}
if (FAILED(hr))
@ -911,10 +911,10 @@ static void load_stream(IUnknown *reader, IStream *stream)
#endif
hr = IUnknown_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist);
ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr=%lx\n", hr);
hr = IWICPersistStream_LoadEx(persist, stream, NULL, persist_options);
ok(hr == S_OK, "LoadEx failed, hr=%x\n", hr);
ok(hr == S_OK, "LoadEx failed, hr=%lx\n", hr);
IWICPersistStream_Release(persist);
}
@ -944,23 +944,23 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
memset(&tiff, 0, sizeof(tiff));
hr = IStream_Read(stream, &tiff, sizeof(tiff), NULL);
ok(hr == S_OK, "IStream_Read error %#x\n", hr);
ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
ok(tiff.byte_order == MAKEWORD('I','I') || tiff.byte_order == MAKEWORD('M','M'),
"wrong TIFF byte order mark %02x\n", tiff.byte_order);
ok(tiff.version == 42, "wrong TIFF version %u\n", tiff.version);
pos.QuadPart = tiff.dir_offset;
hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
hr = CoCreateInstance(&CLSID_WICIfdMetadataReader, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICMetadataReader, (void **)&reader);
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
load_stream((IUnknown *)reader, stream);
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(hr == S_OK, "GetCount error %#lx\n", hr);
ok(count != 0, "wrong count %u\n", count);
for (i = 0; i < ARRAY_SIZE(tag); i++)
@ -972,7 +972,7 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
U(id).uiVal = tag[i].id;
hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value);
ok(hr == S_OK || (tag[i].id == 0x140 && hr == WINCODEC_ERR_PROPERTYNOTFOUND),
"GetValue(%04x) error %#x\n", tag[i].id, hr);
"GetValue(%04x) error %#lx\n", tag[i].id, hr);
if (hr == S_OK)
{
ok(value.vt == VT_UI2 || value.vt == VT_UI4 || value.vt == (VT_UI2 | VT_VECTOR), "wrong vt: %d\n", value.vt);
@ -1047,62 +1047,62 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
BITMAPV5HEADER bih;
hr = IStream_Read(stream, &bfh, sizeof(bfh), NULL);
ok(hr == S_OK, "IStream_Read error %#x\n", hr);
ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
ok(bfh.bfType == 0x4d42, "wrong BMP signature %02x\n", bfh.bfType);
ok(bfh.bfReserved1 == 0, "wrong bfReserved1 %02x\n", bfh.bfReserved1);
ok(bfh.bfReserved2 == 0, "wrong bfReserved2 %02x\n", bfh.bfReserved2);
hr = IStream_Read(stream, &bih, sizeof(bih), NULL);
ok(hr == S_OK, "IStream_Read error %#x\n", hr);
ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
{
ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08lx\n", bfh.bfOffBits);
ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
ok(bih.bV5Width == 32, "wrong width %lu\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %lu\n", bih.bV5Height);
ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
ok(bih.bV5BitCount == 1, "wrong BitCount %d\n", bih.bV5BitCount);
ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %ld\n", bih.bV5ClrUsed);
ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %ld\n", bih.bV5ClrImportant);
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
{
ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08lx\n", bfh.bfOffBits);
ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
ok(bih.bV5Width == 32, "wrong width %lu\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %lu\n", bih.bV5Height);
ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
ok(bih.bV5BitCount == 4, "wrong BitCount %d\n", bih.bV5BitCount);
ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %ld\n", bih.bV5ClrUsed);
ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %ld\n", bih.bV5ClrImportant);
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
{
ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08lx\n", bfh.bfOffBits);
ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
ok(bih.bV5Width == 32, "wrong width %lu\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %lu\n", bih.bV5Height);
ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
ok(bih.bV5BitCount == 8, "wrong BitCount %d\n", bih.bV5BitCount);
ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %ld\n", bih.bV5ClrUsed);
ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %ld\n", bih.bV5ClrImportant);
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat32bppBGR))
{
ok(bfh.bfOffBits == 0x0036, "wrong bfOffBits %08x\n", bfh.bfOffBits);
ok(bfh.bfOffBits == 0x0036, "wrong bfOffBits %08lx\n", bfh.bfOffBits);
ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
ok(bih.bV5Width == 32, "wrong width %lu\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %lu\n", bih.bV5Height);
ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
ok(bih.bV5BitCount == 32, "wrong BitCount %d\n", bih.bV5BitCount);
ok(bih.bV5ClrUsed == 0, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
ok(bih.bV5ClrImportant == 0, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
ok(bih.bV5ClrUsed == 0, "wrong ClrUsed %ld\n", bih.bV5ClrUsed);
ok(bih.bV5ClrImportant == 0, "wrong ClrImportant %ld\n", bih.bV5ClrImportant);
}
else
ok(0, "unknown BMP pixel format %s\n", wine_dbgstr_guid(format));
@ -1135,7 +1135,7 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
memset(&png, 0, sizeof(png));
hr = IStream_Read(stream, &png, sizeof(png), NULL);
ok(hr == S_OK, "IStream_Read error %#x\n", hr);
ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
ok(!memcmp(png.png_sig, png_sig, sizeof(png_sig)), "expected PNG signature\n");
ok(!memcmp(png.ihdr_sig, png_IHDR, sizeof(png_IHDR)), "expected PNG IHDR\n");
@ -1233,7 +1233,7 @@ static void check_gif_format(IStream *stream, const WICPixelFormatGUID *format)
memset(&lsd, 0, sizeof(lsd));
hr = IStream_Read(stream, &lsd, sizeof(lsd), NULL);
ok(hr == S_OK, "IStream_Read error %#x\n", hr);
ok(hr == S_OK, "IStream_Read error %#lx\n", hr);
ok(!memcmp(lsd.signature, "GIF89a", 6), "wrong GIF signature %.6s\n", lsd.signature);
@ -1251,7 +1251,7 @@ static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WIC
pos.QuadPart = 0;
hr = IStream_Seek(stream, pos, SEEK_SET, (ULARGE_INTEGER *)&pos);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
if (IsEqualGUID(encoder, &CLSID_WICPngEncoder))
check_png_format(stream, format);
@ -1265,7 +1265,7 @@ static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WIC
ok(0, "unknown encoder %s\n", wine_dbgstr_guid(encoder));
hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
}
struct setting {
@ -1281,7 +1281,7 @@ static void _expect_ref(IUnknown* obj, ULONG ref, int line)
ULONG rc;
IUnknown_AddRef(obj);
rc = IUnknown_Release(obj);
ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
ok_(__FILE__,line)(rc == ref, "expected refcount %ld, got %ld\n", ref, rc);
}
static void test_set_frame_palette(IWICBitmapFrameEncode *frameencode)
@ -1292,28 +1292,28 @@ static void test_set_frame_palette(IWICBitmapFrameEncode *frameencode)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICComponentFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
hr = IWICBitmapFrameEncode_SetPalette(frameencode, NULL);
ok(hr == E_INVALIDARG, "SetPalette failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "SetPalette failed, hr=%lx\n", hr);
hr = IWICComponentFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette failed, hr=%x\n", hr);
ok(hr == S_OK, "CreatePalette failed, hr=%lx\n", hr);
hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
todo_wine
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr=%x\n", hr);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr=%lx\n", hr);
hr = IWICPalette_InitializePredefined(palette, WICBitmapPaletteTypeFixedHalftone256, FALSE);
ok(hr == S_OK, "InitializePredefined failed, hr=%x\n", hr);
ok(hr == S_OK, "InitializePredefined failed, hr=%lx\n", hr);
EXPECT_REF(palette, 1);
hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
ok(hr == S_OK, "SetPalette failed, hr=%x\n", hr);
ok(hr == S_OK, "SetPalette failed, hr=%lx\n", hr);
EXPECT_REF(palette, 1);
hr = IWICBitmapFrameEncode_SetPalette(frameencode, NULL);
ok(hr == E_INVALIDARG, "SetPalette failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "SetPalette failed, hr=%lx\n", hr);
IWICPalette_Release(palette);
IWICComponentFactory_Release(factory);
@ -1339,13 +1339,13 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapEncoder, (void **)&encoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
hr = IWICBitmapEncoder_GetContainerFormat(encoder, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
container_format = &GUID_ContainerFormatPng;
@ -1364,16 +1364,16 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
{
memset(&guid, 0, sizeof(guid));
hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guid);
ok(SUCCEEDED(hr), "Failed to get container format, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to get container format, hr %#lx.\n", hr);
ok(IsEqualGUID(container_format, &guid), "Unexpected container format %s.\n", wine_dbgstr_guid(&guid));
}
hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "Initialize failed, hr=%lx\n", hr);
/* Encoder options are optional. */
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, NULL);
ok(SUCCEEDED(hr), "Failed to create encode frame, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to create encode frame, hr %#lx.\n", hr);
IStream_Release(stream);
IWICBitmapEncoder_Release(encoder);
@ -1381,7 +1381,7 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapEncoder, (void**)&encoder);
ok(SUCCEEDED(hr), "CoCreateInstance(%s) failed, hr=%x\n", wine_dbgstr_guid(clsid_encoder), hr);
ok(SUCCEEDED(hr), "CoCreateInstance(%s) failed, hr=%lx\n", wine_dbgstr_guid(clsid_encoder), hr);
if (SUCCEEDED(hr))
{
hglobal = GlobalAlloc(GMEM_MOVEABLE, 0);
@ -1389,7 +1389,7 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
if (hglobal)
{
hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
}
if (hglobal && SUCCEEDED(hr))
@ -1397,19 +1397,19 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
if (palette)
{
hr = IWICBitmapEncoder_SetPalette(encoder, palette);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "wrong error %#x (%s)\n", hr, name);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "wrong error %#lx (%s)\n", hr, name);
}
hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "Initialize failed, hr=%lx\n", hr);
if (palette)
{
hr = IWICBitmapEncoder_SetPalette(encoder, palette);
if (IsEqualGUID(clsid_encoder, &CLSID_WICGifEncoder))
ok(hr == S_OK, "SetPalette failed, hr=%#x\n", hr);
ok(hr == S_OK, "SetPalette failed, hr=%#lx\n", hr);
else
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "wrong error %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "wrong error %#lx\n", hr);
hr = S_OK;
}
@ -1419,7 +1419,7 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
CreateTestBitmap(srcs[i], &src_obj);
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, &options);
ok(SUCCEEDED(hr), "CreateFrame failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateFrame failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
ok(options != NULL, "Encoder initialization has not created an property bag\n");
@ -1442,22 +1442,22 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
V_UNKNOWN(&var) = settings[j].value;
hr = IPropertyBag2_Write(options, 1, &propbag, &var);
ok(SUCCEEDED(hr), "Writing property %s failed, hr=%x\n", wine_dbgstr_w(settings[j].name), hr);
ok(SUCCEEDED(hr), "Writing property %s failed, hr=%lx\n", wine_dbgstr_w(settings[j].name), hr);
}
}
if (palette)
{
hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "wrong error %#x\n", hr);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "wrong error %#lx\n", hr);
}
hr = IWICBitmapFrameEncode_Initialize(frameencode, options);
ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "Initialize failed, hr=%lx\n", hr);
memcpy(&pixelformat, srcs[i]->format, sizeof(GUID));
hr = IWICBitmapFrameEncode_SetPixelFormat(frameencode, &pixelformat);
ok(SUCCEEDED(hr), "SetPixelFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "SetPixelFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&pixelformat, dsts[i]->format) ||
(IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)) ||
(IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)),
@ -1466,7 +1466,7 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
if (set_size)
{
hr = IWICBitmapFrameEncode_SetSize(frameencode, srcs[i]->width, srcs[i]->height);
ok(hr == S_OK, "SetSize failed, hr=%x\n", hr);
ok(hr == S_OK, "SetSize failed, hr=%lx\n", hr);
}
if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
@ -1475,30 +1475,30 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
if (palette)
{
hr = IWICBitmapFrameEncode_SetPalette(frameencode, palette);
ok(SUCCEEDED(hr), "SetPalette failed, hr=%x (%s)\n", hr, name);
ok(SUCCEEDED(hr), "SetPalette failed, hr=%lx (%s)\n", hr, name);
}
hr = IWICBitmapFrameEncode_WriteSource(frameencode, &src_obj->IWICBitmapSource_iface, rc);
if (rc && (rc->Width <= 0 || rc->Height <= 0))
{
/* WriteSource fails but WriteSource_Proxy succeeds. */
ok(hr == E_INVALIDARG, "WriteSource should fail, hr=%x (%s)\n", hr, name);
ok(hr == E_INVALIDARG, "WriteSource should fail, hr=%lx (%s)\n", hr, name);
hr = IWICBitmapFrameEncode_WriteSource_Proxy(frameencode, &src_obj->IWICBitmapSource_iface, rc);
if (!set_size && rc->Width < 0)
todo_wine
ok(hr == WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS,
"WriteSource_Proxy(%dx%d) got unexpected hr %x (%s)\n", rc->Width, rc->Height, hr, name);
"WriteSource_Proxy(%dx%d) got unexpected hr %lx (%s)\n", rc->Width, rc->Height, hr, name);
else
ok(hr == S_OK, "WriteSource_Proxy failed, %dx%d, hr=%x (%s)\n", rc->Width, rc->Height, hr, name);
ok(hr == S_OK, "WriteSource_Proxy failed, %dx%d, hr=%lx (%s)\n", rc->Width, rc->Height, hr, name);
}
else
{
if (rc)
ok(SUCCEEDED(hr), "WriteSource(%dx%d) failed, hr=%x (%s)\n", rc->Width, rc->Height, hr, name);
ok(SUCCEEDED(hr), "WriteSource(%dx%d) failed, hr=%lx (%s)\n", rc->Width, rc->Height, hr, name);
else
todo_wine_if((IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2) ||
(IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2))
ok(hr == S_OK, "WriteSource(NULL) failed, hr=%x (%s)\n", hr, name);
ok(hr == S_OK, "WriteSource(NULL) failed, hr=%lx (%s)\n", hr, name);
}
@ -1507,9 +1507,9 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
hr = IWICBitmapFrameEncode_Commit(frameencode);
if (!set_size && rc && rc->Height < 0)
todo_wine
ok(hr == WINCODEC_ERR_UNEXPECTEDSIZE, "Commit got unexpected hr %x (%s)\n", hr, name);
ok(hr == WINCODEC_ERR_UNEXPECTEDSIZE, "Commit got unexpected hr %lx (%s)\n", hr, name);
else
ok(hr == S_OK, "Commit failed, hr=%x (%s)\n", hr, name);
ok(hr == S_OK, "Commit failed, hr=%lx (%s)\n", hr, name);
}
IWICBitmapFrameEncode_Release(frameencode);
@ -1531,7 +1531,7 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
if (SUCCEEDED(hr))
{
hr = IWICBitmapEncoder_Commit(encoder);
ok(SUCCEEDED(hr), "Commit failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "Commit failed, hr=%lx\n", hr);
if (IsEqualGUID(&pixelformat, dsts[0]->format))
check_bitmap_format(stream, clsid_encoder, dsts[0]->format);
@ -1541,7 +1541,7 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
{
hr = CoCreateInstance(clsid_decoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
}
if (SUCCEEDED(hr))
@ -1549,57 +1549,57 @@ static void test_multi_encoder_impl(const struct bitmap_data **srcs, const CLSID
IWICPalette *frame_palette;
hr = IWICImagingFactory_CreatePalette(factory, &frame_palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
if (IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
ok(hr == WINCODEC_ERR_WRONGSTATE, "wrong error %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "wrong error %#lx\n", hr);
else
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#lx\n", hr);
hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "Initialize failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
if (IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING) /* XP */, "CopyPalette failed, hr=%#x\n", hr);
ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING) /* XP */, "CopyPalette failed, hr=%#lx\n", hr);
else
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#lx\n", hr);
hr = S_OK;
i=0;
while (SUCCEEDED(hr) && dsts[i])
{
hr = IWICBitmapDecoder_GetFrame(decoder, i, &framedecode);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%x (%s)\n", hr, name);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx (%s)\n", hr, name);
if (SUCCEEDED(hr))
{
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &pixelformat);
ok(hr == S_OK, "GetPixelFormat) failed, hr=%x (%s)\n", hr, name);
ok(hr == S_OK, "GetPixelFormat) failed, hr=%lx (%s)\n", hr, name);
if (IsEqualGUID(&pixelformat, dsts[i]->format))
compare_bitmap_data(srcs[i], dsts[i], (IWICBitmapSource*)framedecode, name);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, frame_palette);
if (winetest_debug > 1)
trace("%s, bpp %d, %s, hr %#x\n", name, dsts[i]->bpp, wine_dbgstr_guid(dsts[i]->format), hr);
trace("%s, bpp %d, %s, hr %#lx\n", name, dsts[i]->bpp, wine_dbgstr_guid(dsts[i]->format), hr);
if (dsts[i]->bpp > 8 || IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormatBlackWhite))
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "wrong error %#lx\n", hr);
else
{
UINT count, ret;
WICColor colors[256];
ok(hr == S_OK, "CopyPalette error %#x (%s)\n", hr, name);
ok(hr == S_OK, "CopyPalette error %#lx (%s)\n", hr, name);
count = 0;
hr = IWICPalette_GetColorCount(frame_palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
memset(colors, 0, sizeof(colors));
ret = 0;
hr = IWICPalette_GetColors(frame_palette, count, colors, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\n", hr);
ok(ret == count, "expected %u, got %u\n", count, ret);
if (IsEqualGUID(clsid_decoder, &CLSID_WICPngDecoder))
{
@ -1702,7 +1702,7 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
HRESULT hr;
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
memset(colors, 0, sizeof(colors));
colors[0] = 0x11111111;
@ -1712,7 +1712,7 @@ static void test_encoder(const struct bitmap_data *src, const CLSID* clsid_encod
colors[4] = 0x55555555;
/* TIFF decoder fails to decode a 8bpp frame if palette has less than 256 colors */
hr = IWICPalette_InitializeCustom(palette, colors, 256);
ok(hr == S_OK, "InitializeCustom error %#x\n", hr);
ok(hr == S_OK, "InitializeCustom error %#lx\n", hr);
srcs[0] = src;
srcs[1] = NULL;
@ -1782,102 +1782,102 @@ static void test_converter_8bppIndexed(void)
CreateTestBitmap(&testdata_24bppBGR, &src_obj);
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
/* NULL palette + Custom type */
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat24bppBGR, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeCustom);
ok(hr == S_OK, "Initialize error %#x\n", hr);
ok(hr == S_OK, "Initialize error %#lx\n", hr);
hr = IWICFormatConverter_CopyPalette(converter, palette);
ok(hr == 0xdeadbeef, "unexpected error %#x\n", hr);
ok(hr == 0xdeadbeef, "unexpected error %#lx\n", hr);
hr = IWICFormatConverter_CopyPixels(converter, NULL, 32 * 3, sizeof(buf), buf);
ok(hr == S_OK, "CopyPixels error %#x\n", hr);
ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
IWICFormatConverter_Release(converter);
/* NULL palette + Custom type */
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeCustom);
ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr);
ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
hr = IWICFormatConverter_CopyPalette(converter, palette);
ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#lx\n", hr);
hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#lx\n", hr);
IWICFormatConverter_Release(converter);
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat4bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeCustom);
ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr);
ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
IWICFormatConverter_Release(converter);
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat2bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeCustom);
ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr);
ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
IWICFormatConverter_Release(converter);
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat1bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeCustom);
ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr);
ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
IWICFormatConverter_Release(converter);
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat1bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeMedianCut);
todo_wine ok(hr == S_OK, "unexpected error %#x\n", hr);
todo_wine ok(hr == S_OK, "unexpected error %#lx\n", hr);
IWICFormatConverter_Release(converter);
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat1bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeFixedBW);
todo_wine ok(hr == S_OK, "unexpected error %#x\n", hr);
todo_wine ok(hr == S_OK, "unexpected error %#lx\n", hr);
IWICFormatConverter_Release(converter);
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat1bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeFixedHalftone8);
todo_wine ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr);
todo_wine ok(hr == E_INVALIDARG, "unexpected error %#lx\n", hr);
IWICFormatConverter_Release(converter);
/* empty palette + Custom type */
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
palette, 0.0, WICBitmapPaletteTypeCustom);
ok(hr == S_OK, "Initialize error %#x\n", hr);
ok(hr == S_OK, "Initialize error %#lx\n", hr);
hr = IWICFormatConverter_CopyPalette(converter, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
memset(buf, 0xaa, sizeof(buf));
hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
ok(hr == S_OK, "CopyPixels error %#x\n", hr);
ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
count = 0;
for (i = 0; i < 32 * 2; i++)
if (buf[i] != 0) count++;
@ -1886,19 +1886,19 @@ static void test_converter_8bppIndexed(void)
/* NULL palette + Predefined type */
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeFixedGray16);
ok(hr == S_OK, "Initialize error %#x\n", hr);
ok(hr == S_OK, "Initialize error %#lx\n", hr);
hr = IWICFormatConverter_CopyPalette(converter, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 16, "expected 16, got %u\n", count);
hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
ok(hr == S_OK, "CopyPixels error %#x\n", hr);
ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
count = 0;
for (i = 0; i < 32 * 2; i++)
if (buf[i] != 0) count++;
@ -1907,19 +1907,19 @@ static void test_converter_8bppIndexed(void)
/* not empty palette + Predefined type */
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
palette, 0.0, WICBitmapPaletteTypeFixedHalftone64);
ok(hr == S_OK, "Initialize error %#x\n", hr);
ok(hr == S_OK, "Initialize error %#lx\n", hr);
hr = IWICFormatConverter_CopyPalette(converter, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 16, "expected 16, got %u\n", count);
hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
ok(hr == S_OK, "CopyPixels error %#x\n", hr);
ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
count = 0;
for (i = 0; i < 32 * 2; i++)
if (buf[i] != 0) count++;
@ -1928,19 +1928,19 @@ static void test_converter_8bppIndexed(void)
/* not empty palette + MedianCut type */
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
palette, 0.0, WICBitmapPaletteTypeMedianCut);
ok(hr == S_OK, "Initialize error %#x\n", hr);
ok(hr == S_OK, "Initialize error %#lx\n", hr);
hr = IWICFormatConverter_CopyPalette(converter, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 16, "expected 16, got %u\n", count);
hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
ok(hr == S_OK, "CopyPixels error %#x\n", hr);
ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
count = 0;
for (i = 0; i < 32 * 2; i++)
if (buf[i] != 0) count++;
@ -1949,21 +1949,21 @@ static void test_converter_8bppIndexed(void)
/* NULL palette + MedianCut type */
hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
ok(hr == S_OK, "CreateFormatConverter error %#lx\n", hr);
hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
&GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
NULL, 0.0, WICBitmapPaletteTypeMedianCut);
ok(hr == S_OK || broken(hr == E_INVALIDARG) /* XP */, "Initialize error %#x\n", hr);
ok(hr == S_OK || broken(hr == E_INVALIDARG) /* XP */, "Initialize error %#lx\n", hr);
if (hr == S_OK)
{
hr = IWICFormatConverter_CopyPalette(converter, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 8, "expected 8, got %u\n", count);
hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
ok(hr == S_OK, "CopyPixels error %#x\n", hr);
ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
count = 0;
for (i = 0; i < 32 * 2; i++)
if (buf[i] != 0) count++;
@ -1983,7 +1983,7 @@ START_TEST(converter)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "failed to create factory: %#x\n", hr);
ok(hr == S_OK, "failed to create factory: %#lx\n", hr);
test_conversion(&testdata_24bppRGB, &testdata_1bppIndexed, "24bppRGB -> 1bppIndexed", TRUE);
test_conversion(&testdata_24bppRGB, &testdata_2bppIndexed, "24bppRGB -> 2bppIndexed", TRUE);

View file

@ -464,11 +464,11 @@ static IWICStream *create_stream(const void *image_data, UINT image_size)
IWICStream *stream = NULL;
hr = IWICImagingFactory_CreateStream(factory, &stream);
ok(hr == S_OK, "CreateStream failed, hr %#x\n", hr);
ok(hr == S_OK, "CreateStream failed, hr %#lx\n", hr);
if (hr != S_OK) goto fail;
hr = IWICStream_InitializeFromMemory(stream, (BYTE *)image_data, image_size);
ok(hr == S_OK, "InitializeFromMemory failed, hr %#x\n", hr);
ok(hr == S_OK, "InitializeFromMemory failed, hr %#lx\n", hr);
if (hr != S_OK) goto fail;
return stream;
@ -493,7 +493,7 @@ static IWICBitmapDecoder *create_decoder(void)
memset(&guidresult, 0, sizeof(guidresult));
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(hr == S_OK, "GetContainerFormat failed, hr %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat failed, hr %#lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatDds),
"Got unexpected container format %s\n", debugstr_guid(&guidresult));
@ -517,7 +517,7 @@ static IWICBitmapEncoder *create_encoder(void)
memset(&guidresult, 0, sizeof(guidresult));
hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guidresult);
ok(hr == S_OK, "GetContainerFormat failed, hr %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat failed, hr %#lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatDds),
"Got unexpected container format %s\n", debugstr_guid(&guidresult));
@ -531,15 +531,15 @@ static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRES
IWICWineDecoder *wine_decoder;
hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand);
ok(hr == expected, "Expected hr %#x, got %#x\n", expected, hr);
ok(hr == expected, "Expected hr %#lx, got %#lx\n", expected, hr);
if (hr != S_OK && wine_init) {
hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICWineDecoder, (void **)&wine_decoder);
ok(hr == S_OK || broken(hr != S_OK), "QueryInterface failed, hr %#x\n", hr);
ok(hr == S_OK || broken(hr != S_OK), "QueryInterface failed, hr %#lx\n", hr);
if (hr == S_OK) {
hr = IWICWineDecoder_Initialize(wine_decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand);
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
ok(hr == S_OK, "Initialize failed, hr %#lx\n", hr);
}
}
@ -566,17 +566,17 @@ static HRESULT create_and_init_encoder(BYTE *image_buffer, UINT buffer_size, WIC
if (!*stream) goto fail;
hr = IWICBitmapEncoder_Initialize(*encoder, (IStream *)*stream, WICBitmapEncoderNoCache);
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
ok(hr == S_OK, "Initialize failed, hr %#lx\n", hr);
if (hr != S_OK) goto fail;
hr = IWICBitmapEncoder_QueryInterface(*encoder, &IID_IWICDdsEncoder, (void **)&dds);
ok(hr == S_OK, "QueryInterface failed, hr %#x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr %#lx\n", hr);
if (hr != S_OK) goto fail;
if (params)
{
hr = IWICDdsEncoder_SetParameters(dds, params);
ok(hr == S_OK, "SetParameters failed, hr %#x\n", hr);
ok(hr == S_OK, "SetParameters failed, hr %#lx\n", hr);
if (hr != S_OK) goto fail;
}
@ -808,33 +808,33 @@ static void test_dds_decoder_global_properties(IWICBitmapDecoder *decoder)
UINT count;
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette failed, hr %#x\n", hr);
ok(hr == S_OK, "CreatePalette failed, hr %#lx\n", hr);
if (hr == S_OK) {
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_CopyPalette(decoder, NULL);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette got unexpected hr %#lx\n", hr);
}
hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, &metadata_reader);
todo_wine ok (hr == S_OK, "GetMetadataQueryReader got unexpected hr %#x\n", hr);
todo_wine ok (hr == S_OK, "GetMetadataQueryReader got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, NULL);
ok(hr == E_INVALIDARG, "GetMetadataQueryReader got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetMetadataQueryReader got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_GetPreview(decoder, &preview);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetPreview got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetPreview got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_GetPreview(decoder, NULL);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetPreview got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetPreview got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, &color_context, &count);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, NULL, NULL);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_GetThumbnail(decoder, &thumnail);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "GetThumbnail got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "GetThumbnail got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_GetThumbnail(decoder, NULL);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "GetThumbnail got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "GetThumbnail got unexpected hr %#lx\n", hr);
if (palette) IWICPalette_Release(palette);
if (metadata_reader) IWICMetadataQueryReader_Release(metadata_reader);
@ -865,18 +865,18 @@ static void test_dds_decoder_image_parameters(void)
if (!decoder) goto next;
hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICDdsDecoder, (void **)&dds_decoder);
ok(hr == S_OK, "QueryInterface failed, hr %#x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr %#lx\n", hr);
if (hr != S_OK) goto next;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == WINCODEC_ERR_WRONGSTATE, "GetFrameCount got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "GetFrameCount got unexpected hr %#lx\n", hr);
hr = IWICBitmapDecoder_GetFrameCount(decoder, NULL);
ok(hr == E_INVALIDARG, "GetFrameCount got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetFrameCount got unexpected hr %#lx\n", hr);
hr = IWICDdsDecoder_GetParameters(dds_decoder, &parameters);
ok(hr == WINCODEC_ERR_WRONGSTATE, "GetParameters got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "GetParameters got unexpected hr %#lx\n", hr);
hr = IWICDdsDecoder_GetParameters(dds_decoder, NULL);
ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#lx\n", hr);
if (test_data[i].init_hr != S_OK && !test_data[i].wine_init) continue;
@ -891,16 +891,16 @@ static void test_dds_decoder_image_parameters(void)
}
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount failed, hr %#x\n", hr);
ok(hr == S_OK, "GetFrameCount failed, hr %#lx\n", hr);
if (hr == S_OK) {
ok(frame_count == test_data[i].expected_frame_count, "Expected frame count %u, got %u\n",
test_data[i].expected_frame_count, frame_count);
}
hr = IWICBitmapDecoder_GetFrameCount(decoder, NULL);
ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#lx\n", hr);
hr = IWICDdsDecoder_GetParameters(dds_decoder, &parameters);
ok(hr == S_OK, "GetParameters failed, hr %#x\n", hr);
ok(hr == S_OK, "GetParameters failed, hr %#lx\n", hr);
if (hr == S_OK) {
ok(parameters.Width == test_data[i].expected_parameters.Width,
"Expected Width %u, got %u\n", test_data[i].expected_parameters.Width, parameters.Width);
@ -920,7 +920,7 @@ static void test_dds_decoder_image_parameters(void)
"Expected AlphaMode %#x, got %#x\n", test_data[i].expected_parameters.AlphaMode, parameters.AlphaMode);
}
hr = IWICDdsDecoder_GetParameters(dds_decoder, NULL);
ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#lx\n", hr);
next:
if (decoder) IWICBitmapDecoder_Release(decoder);
@ -943,13 +943,13 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod
/* frame size tests */
hr = IWICBitmapFrameDecode_GetSize(frame_decode, NULL, NULL);
ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, NULL, &height);
ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, &width, NULL);
ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, &width, &height);
ok(hr == S_OK, "GetSize failed, hr %#x\n", hr);
ok(hr == S_OK, "GetSize failed, hr %#lx\n", hr);
if (hr != S_OK) return;
depth = params->Depth;
@ -977,9 +977,9 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod
}
hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, NULL);
ok(hr == E_INVALIDARG, "GetFormatInfo got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetFormatInfo got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, &format_info);
ok(hr == S_OK, "GetFormatInfo failed, hr %#x\n", hr);
ok(hr == S_OK, "GetFormatInfo failed, hr %#lx\n", hr);
if (hr != S_OK) return;
ok(format_info.DxgiFormat == test->expected_parameters.DxgiFormat,
@ -999,13 +999,13 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod
/* size in blocks tests */
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, NULL);
ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, &height_in_blocks);
ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, NULL);
ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, &height_in_blocks);
ok(hr == S_OK, "GetSizeInBlocks failed, hr %#x\n", hr);
ok(hr == S_OK, "GetSizeInBlocks failed, hr %#lx\n", hr);
if (hr != S_OK) return;
expected_width_in_blocks = (expected_width + expected_block_width - 1) / expected_block_width;
@ -1018,9 +1018,9 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod
/* pixel format tests */
hr = IWICBitmapFrameDecode_GetPixelFormat(frame_decode, NULL);
ok(hr == E_INVALIDARG, "GetPixelFormat got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetPixelFormat got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame_decode, &pixel_format);
ok(hr == S_OK, "GetPixelFormat failed, hr %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat failed, hr %#lx\n", hr);
if (hr != S_OK) return;
ok(IsEqualGUID(&pixel_format, test->expected_pixel_format),
"Expected pixel format %s, got %s\n",
@ -1042,16 +1042,16 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra
int slice_index;
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &pixel_format);
ok(hr == S_OK, "GetPixelFormat failed, hr %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat failed, hr %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapFrameDecode_GetSize(frame, &frame_width, &frame_height);
ok(hr == S_OK, "GetSize failed, hr %#x\n", hr);
ok(hr == S_OK, "GetSize failed, hr %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, &format_info);
ok(hr == S_OK, "GetFormatInfo failed, hr %#x\n", hr);
ok(hr == S_OK, "GetFormatInfo failed, hr %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, &height_in_blocks);
ok(hr == S_OK, "GetSizeInBlocks failed, hr %#x\n", hr);
ok(hr == S_OK, "GetSizeInBlocks failed, hr %#lx\n", hr);
if (hr != S_OK) return;
stride = rect.Width * format_info.BytesPerBlock;
frame_stride = width_in_blocks * format_info.BytesPerBlock;
@ -1060,47 +1060,47 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra
/* CopyBlocks tests */
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, 0, 0, NULL);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_a, stride, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_b, stride, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_c, stride, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_d, stride, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride - 1, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride * 2, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, frame_stride * height_in_blocks - 1, buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, frame_stride * height_in_blocks, buffer);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, 0, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride - 1, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride * 2, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, 0, buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, 1, buffer);
ok(hr == E_INVALIDARG || (hr == S_OK && test->expected_bytes_per_block == 1),
"CopyBlocks got unexpected hr %#x\n", hr);
"CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, stride * rect.Height - 1, buffer);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, stride * rect.Height, buffer);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, sizeof(buffer), NULL);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
block_offset = 128; /* DDS magic and header */
if (has_extended_header(test->data)) block_offset += 20; /* DDS extended header */
@ -1125,14 +1125,14 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra
memset(buffer, 0, sizeof(buffer));
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyBlocks failed, hr %#x\n", hr);
ok(hr == S_OK, "CopyBlocks failed, hr %#lx\n", hr);
if (hr != S_OK) return;
ok(!memcmp(test->data + block_offset, buffer, format_info.BytesPerBlock),
"Block data mismatch\n");
memset(buffer, 0, sizeof(buffer));
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyBlocks failed, hr %#x\n", hr);
ok(hr == S_OK, "CopyBlocks failed, hr %#lx\n", hr);
if (hr != S_OK) return;
ok(!memcmp(test->data + block_offset, buffer, frame_size),
"Block data mismatch\n");
@ -1141,7 +1141,7 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra
memset(pixels, 0, sizeof(pixels));
copy_pixels(test->data + block_offset, frame_stride, pixels, frame_stride * 2, frame_size);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride * 2, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyBlocks failed, hr %#x\n", hr);
ok(hr == S_OK, "CopyBlocks failed, hr %#lx\n", hr);
if (hr != S_OK) return;
ok(!memcmp(pixels, buffer, frame_size),
"Block data mismatch\n");
@ -1154,47 +1154,47 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra
frame_size = frame_stride * frame_height;
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 0, 0, NULL);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect_test_a, stride, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect_test_b, stride, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect_test_c, stride, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect_test_d, stride, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride - 1, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride * 2, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, frame_stride * frame_height - 1, buffer);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, frame_stride * frame_height, buffer);
ok(hr == S_OK, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, 0, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride - 1, sizeof(buffer), buffer);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride * 2, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, 0, buffer);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, 1, buffer);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER || (hr == S_OK && test->expected_bytes_per_block == 1),
"CopyPixels got unexpected hr %#x\n", hr);
"CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, stride * rect.Height - 1, buffer);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, stride * rect.Height, buffer);
ok(hr == S_OK, "CopyPixels got unexpected hr %#x\n", hr);
ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, sizeof(buffer), NULL);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
memset(buffer, 0, sizeof(pixels));
if (is_compressed(format_info.DxgiFormat)) {
@ -1206,7 +1206,7 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra
memset(buffer, 0, sizeof(buffer));
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyPixels failed, hr %#x\n", hr);
ok(hr == S_OK, "CopyPixels failed, hr %#lx\n", hr);
if (hr == S_OK) {
if (is_compressed(format_info.DxgiFormat)) {
ok(color_buffer_match((DWORD *)pixels, (DWORD *)buffer, 1), "Pixels mismatch\n");
@ -1217,7 +1217,7 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra
memset(buffer, 0, sizeof(buffer));
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, sizeof(buffer), buffer);
ok(hr == S_OK, "CopyPixels failed, hr %#x\n", hr);
ok(hr == S_OK, "CopyPixels failed, hr %#lx\n", hr);
if (hr == S_OK) {
if (is_compressed(format_info.DxgiFormat)) {
ok(color_buffer_match((DWORD *)pixels, (DWORD *)buffer, frame_size / (bpp / 8)), "Pixels mismatch\n");
@ -1235,13 +1235,13 @@ static void test_dds_decoder_frame(IWICBitmapDecoder *decoder, struct test_data
WICDdsParameters params;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount failed, hr %#x\n", hr);
ok(hr == S_OK, "GetFrameCount failed, hr %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICDdsDecoder, (void **)&dds_decoder);
ok(hr == S_OK, "QueryInterface failed, hr %#x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr %#lx\n", hr);
if (hr != S_OK) goto end;
hr = IWICDdsDecoder_GetParameters(dds_decoder, &params);
ok(hr == S_OK, "GetParameters failed, hr %#x\n", hr);
ok(hr == S_OK, "GetParameters failed, hr %#lx\n", hr);
if (hr != S_OK) goto end;
if (test->expected_parameters.Dimension == WICDdsTextureCube) params.ArraySize *= 6;
@ -1254,10 +1254,10 @@ static void test_dds_decoder_frame(IWICBitmapDecoder *decoder, struct test_data
winetest_push_context("Frame %u", j);
hr = IWICBitmapDecoder_GetFrame(decoder, j, &frame_decode);
ok(hr == S_OK, "GetFrame failed, hr %#x\n", hr);
ok(hr == S_OK, "GetFrame failed, hr %#lx\n", hr);
if (hr != S_OK) goto next;
hr = IWICBitmapFrameDecode_QueryInterface(frame_decode, &IID_IWICDdsFrameDecode, (void **)&dds_frame);
ok(hr == S_OK, "QueryInterface failed, hr %#x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr %#lx\n", hr);
if (hr != S_OK) goto next;
test_dds_decoder_frame_properties(frame_decode, dds_frame, frame_count, &params, test, j);
@ -1331,11 +1331,11 @@ static void test_dds_encoder_initialize(void)
hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, 0xdeadbeef);
todo_wine
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "Initialize got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "Initialize got unexpected hr %#lx\n", hr);
hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
todo_wine
ok(hr == E_INVALIDARG, "Initialize got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "Initialize got unexpected hr %#lx\n", hr);
IWICBitmapEncoder_Release(encoder);
@ -1345,10 +1345,10 @@ static void test_dds_encoder_initialize(void)
if (!encoder) goto end;
hr = IWICBitmapEncoder_Initialize(encoder, NULL, WICBitmapEncoderNoCache);
ok(hr == E_INVALIDARG, "Initialize got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "Initialize got unexpected hr %#lx\n", hr);
hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
ok(hr == S_OK, "Initialize failed, hr %#lx\n", hr);
IWICBitmapEncoder_Release(encoder);
@ -1358,10 +1358,10 @@ static void test_dds_encoder_initialize(void)
if (!encoder) goto end;
hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
ok(hr == S_OK, "Initialize failed, hr %#lx\n", hr);
hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
ok(hr == WINCODEC_ERR_WRONGSTATE, "Initialize got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "Initialize got unexpected hr %#lx\n", hr);
end:
if (stream) IWICStream_Release(stream);
@ -1383,10 +1383,10 @@ static void test_dds_encoder_params(void)
if (hr != S_OK) goto end;
hr = IWICDdsEncoder_GetParameters(dds_encoder, NULL);
ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#lx\n", hr);
hr = IWICDdsEncoder_GetParameters(dds_encoder, &params);
ok(hr == S_OK, "GetParameters failed, hr %#x\n", hr);
ok(hr == S_OK, "GetParameters failed, hr %#lx\n", hr);
if (hr != S_OK) goto end;
/* default DDS parameters for encoder */
@ -1400,10 +1400,10 @@ static void test_dds_encoder_params(void)
ok(params.AlphaMode == WICDdsAlphaModeUnknown, "Got unexpected AlphaMode %#x\n", params.AlphaMode);
hr = IWICDdsEncoder_SetParameters(dds_encoder, NULL);
ok(hr == E_INVALIDARG, "SetParameters got unexpected hr %#x\n", hr);
ok(hr == E_INVALIDARG, "SetParameters got unexpected hr %#lx\n", hr);
hr = IWICDdsEncoder_SetParameters(dds_encoder, &params_set);
ok(hr == S_OK, "SetParameters failed, hr %#x\n", hr);
ok(hr == S_OK, "SetParameters failed, hr %#lx\n", hr);
if (hr != S_OK) goto end;
IWICDdsEncoder_GetParameters(dds_encoder, &params);
@ -1430,7 +1430,7 @@ static void test_dds_encoder_params(void)
hr = IWICDdsEncoder_SetParameters(dds_encoder, &test_data[i].expected_parameters);
todo_wine_if(test_data[i].init_hr != S_OK)
ok((hr == S_OK && test_data[i].init_hr == S_OK) || hr == WINCODEC_ERR_BADHEADER,
"Test %u: SetParameters got unexpected hr %#x\n", i, hr);
"Test %u: SetParameters got unexpected hr %#lx\n", i, hr);
}
end:
@ -1453,25 +1453,25 @@ static void test_dds_encoder_create_frame(void)
if (hr != S_OK) goto end;
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame0, NULL);
ok(hr == S_OK, "CreateNewFrame failed, hr %#x\n", hr);
ok(hr == S_OK, "CreateNewFrame failed, hr %#lx\n", hr);
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame1, NULL);
ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#lx\n", hr);
IWICBitmapFrameEncode_Release(frame0);
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame1, NULL);
ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#lx\n", hr);
release_encoder(encoder, dds_encoder, stream);
create_and_init_encoder(buffer, sizeof(buffer), &params, &encoder, &dds_encoder, &stream);
hr = IWICDdsEncoder_CreateNewFrame(dds_encoder, &frame0, &array_index, &mip_level, &slice_index);
ok(hr == S_OK, "CreateNewFrame failed, hr %#x\n", hr);
ok(hr == S_OK, "CreateNewFrame failed, hr %#lx\n", hr);
IWICBitmapFrameEncode_Release(frame0);
release_encoder(encoder, dds_encoder, stream);
create_and_init_encoder(buffer, sizeof(buffer), &params, &encoder, &dds_encoder, &stream);
hr = IWICDdsEncoder_CreateNewFrame(dds_encoder, &frame0, NULL, NULL, NULL);
ok(hr == S_OK, "CreateNewFrame failed, hr %#x\n", hr);
ok(hr == S_OK, "CreateNewFrame failed, hr %#lx\n", hr);
IWICBitmapFrameEncode_Release(frame0);
end:
@ -1526,7 +1526,7 @@ static void test_dds_encoder_pixel_format(void)
IWICBitmapEncoder_CreateNewFrame(encoder, &frame, NULL);
hr = IWICBitmapFrameEncode_SetPixelFormat(frame, &format);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "SetPixelFormat got unexpected hr %#x\n", hr);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "SetPixelFormat got unexpected hr %#lx\n", hr);
IWICBitmapFrameEncode_Initialize(frame, NULL);
@ -1536,7 +1536,7 @@ static void test_dds_encoder_pixel_format(void)
format = *(test_formats[j]);
hr = IWICBitmapFrameEncode_SetPixelFormat(frame, &format);
ok(hr == S_OK, "SetPixelFormat failed, hr %#x\n", hr);
ok(hr == S_OK, "SetPixelFormat failed, hr %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
"Got unexpected GUID %s\n", debugstr_guid(&format));
@ -1563,7 +1563,7 @@ START_TEST(ddsformat)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr %#x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr %#lx\n", hr);
if (hr != S_OK) goto end;
test_dds_decoder();

View file

@ -93,7 +93,7 @@ static IStream *create_stream(const void *image_data, UINT image_size)
GlobalUnlock(hmem);
hr = CreateStreamOnHGlobal(hmem, TRUE, &stream);
ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
ok(hr == S_OK, "CreateStreamOnHGlobal error %#lx\n", hr);
return stream;
}
@ -110,10 +110,10 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
if (!stream) return NULL;
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
@ -137,18 +137,18 @@ static void test_global_gif_palette(void)
ok(decoder != 0, "Failed to load GIF image data\n");
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
/* global palette */
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\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]);
@ -157,22 +157,22 @@ static void test_global_gif_palette(void)
/* frame palette */
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
"wrong pixel format %s\n", wine_dbgstr_guid(&format));
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\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]);
@ -199,21 +199,21 @@ static void test_global_gif_palette_2frames(void)
/* active frame 0, GCE transparent index 1 */
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
/* global palette */
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\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]);
@ -222,19 +222,19 @@ static void test_global_gif_palette_2frames(void)
/* frame 0 palette */
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
"wrong pixel format %s\n", wine_dbgstr_guid(&format));
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\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]);
@ -245,18 +245,18 @@ static void test_global_gif_palette_2frames(void)
/* active frame 1, GCE transparent index 2 */
hr = IWICBitmapDecoder_GetFrame(decoder, 1, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
/* global palette */
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\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] == 0xff040506 || broken(color[1] == 0x00040506) /* XP */, "expected 0xff040506, got %#x\n", color[1]);
@ -265,19 +265,19 @@ static void test_global_gif_palette_2frames(void)
/* frame 1 palette */
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
"wrong pixel format %s\n", wine_dbgstr_guid(&format));
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\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] == 0xff040506, "expected 0xff040506, got %#x\n", color[1]);
@ -304,24 +304,24 @@ static void test_local_gif_palette(void)
ok(decoder != 0, "Failed to load GIF image data\n");
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
/* global palette */
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING), "CopyPalette %#x\n", hr);
ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING), "CopyPalette %#lx\n", hr);
if (hr == S_OK)
{
type = -1;
hr = IWICPalette_GetType(palette, &type);
ok(hr == S_OK, "GetType error %#x\n", hr);
ok(hr == S_OK, "GetType error %#lx\n", 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(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 256, "expected 256, got %u\n", count);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\n", hr);
ok(ret == count, "expected %u, got %u\n", count, ret);
ok(color[0] == 0xff000000, "expected 0xff000000, got %#x\n", color[0]);
ok(color[1] == 0x00ffffff, "expected 0x00ffffff, got %#x\n", color[1]);
@ -332,27 +332,27 @@ static void test_local_gif_palette(void)
/* frame palette */
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
"wrong pixel format %s\n", wine_dbgstr_guid(&format));
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
type = -1;
hr = IWICPalette_GetType(palette, &type);
ok(hr == S_OK, "GetType error %#x\n", hr);
ok(hr == S_OK, "GetType error %#lx\n", hr);
ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %#x\n", type);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\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]);
@ -379,32 +379,32 @@ static void test_gif_frame_sizes(void)
ok(decoder != 0, "Failed to load GIF image data\n");
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
ok(hr == S_OK, "GetSize error %x\n", hr);
ok(hr == S_OK, "GetSize error %lx\n", hr);
ok(width == 2, "width = %d\n", width);
ok(height == 2, "height = %d\n", height);
memset(buf, 0xfe, sizeof(buf));
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 4, sizeof(buf), buf);
ok(hr == S_OK, "CopyPixels error %x\n", hr);
ok(hr == S_OK, "CopyPixels error %lx\n", hr);
ok(!memcmp(buf, frame0, sizeof(buf)), "buf = %x %x %x %x %x %x %x %x\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
IWICBitmapFrameDecode_Release(frame);
hr = IWICBitmapDecoder_GetFrame(decoder, 1, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
ok(hr == S_OK, "GetSize error %x\n", hr);
ok(hr == S_OK, "GetSize error %lx\n", hr);
ok(width == 2, "width = %d\n", width);
ok(height == 1, "height = %d\n", height);
memset(buf, 0xfe, sizeof(buf));
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 4, sizeof(buf), buf);
ok(hr == S_OK, "CopyPixels error %x\n", hr);
ok(hr == S_OK, "CopyPixels error %lx\n", hr);
ok(!memcmp(buf, frame1, sizeof(buf)), "buf = %x %x %x %x %x %x %x %x\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
@ -448,9 +448,9 @@ static void test_truncated_gif(void)
if (!stream) return;
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
IWICBitmapDecoder_Release(decoder);
@ -459,9 +459,9 @@ static void test_truncated_gif(void)
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);
ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
IWICBitmapDecoder_Release(decoder);
@ -470,9 +470,9 @@ static void test_truncated_gif(void)
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);
ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
IWICBitmapDecoder_Release(decoder);
@ -481,9 +481,9 @@ static void test_truncated_gif(void)
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);
ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
IWICBitmapDecoder_Release(decoder);
@ -509,38 +509,38 @@ static void test_gif_notrailer(void)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hr = IWICImagingFactory_CreateStream(factory, &gifstream);
ok(hr == S_OK, "CreateStream failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateStream failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICStream_InitializeFromMemory(gifstream, gifimage_notrailer,
sizeof(gifimage_notrailer));
ok(hr == S_OK, "InitializeFromMemory failed, hr=%x\n", hr);
ok(hr == S_OK, "InitializeFromMemory failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = CoCreateInstance(&CLSID_WICGifDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
}
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)gifstream,
WICDecodeMetadataCacheOnDemand);
ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
ok(hr == S_OK, "Initialize failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(hr == S_OK, "GetFrame failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFrame failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%lx\n", hr);
ok(dpiX == 48.0, "expected dpiX=48.0, got %f\n", dpiX);
ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY);
@ -551,7 +551,7 @@ static void test_gif_notrailer(void)
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_GetFrameCount(decoder, &framecount);
ok(hr == S_OK, "GetFrameCount failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFrameCount failed, hr=%lx\n", hr);
ok(framecount == 1, "framecount=%u\n", framecount);
}
@ -571,7 +571,7 @@ START_TEST(gifformat)
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
if (FAILED(hr)) return;
test_global_gif_palette();
@ -585,7 +585,7 @@ START_TEST(gifformat)
/* run the same tests with no COM initialization */
hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory);
ok(hr == S_OK, "WICCreateImagingFactory_Proxy error %#x\n", hr);
ok(hr == S_OK, "WICCreateImagingFactory_Proxy error %#lx\n", hr);
test_global_gif_palette();
test_global_gif_palette_2frames();

View file

@ -143,21 +143,21 @@ static void test_ico_data_(void *data, DWORD data_size, HRESULT init_hr, int tod
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hr = IWICImagingFactory_CreateStream(factory, &icostream);
ok(hr == S_OK, "CreateStream failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateStream failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICStream_InitializeFromMemory(icostream, data, data_size);
ok(hr == S_OK, "InitializeFromMemory failed, hr=%x\n", hr);
ok(hr == S_OK, "InitializeFromMemory failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = CoCreateInstance(&CLSID_WICIcoDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
}
if (SUCCEEDED(hr))
@ -165,12 +165,12 @@ static void test_ico_data_(void *data, DWORD data_size, HRESULT init_hr, int tod
hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)icostream,
WICDecodeMetadataCacheOnDemand);
todo_wine_if(todo)
ok_(__FILE__, line)(hr == init_hr, "Initialize failed, hr=%x\n", hr);
ok_(__FILE__, line)(hr == init_hr, "Initialize failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(hr == S_OK, "GetFrame failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFrame failed, hr=%lx\n", hr);
}
if (SUCCEEDED(hr))
@ -180,16 +180,16 @@ static void test_ico_data_(void *data, DWORD data_size, HRESULT init_hr, int tod
width = height = 0;
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height);
ok(hr == S_OK, "GetFrameSize failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFrameSize failed, hr=%lx\n", hr);
ok(width == 16 && height == 16, "framesize=%ux%u\n", width, height);
hr = IWICBitmapFrameDecode_GetThumbnail(framedecode, &thumbnail);
ok(hr == S_OK, "GetThumbnail failed, hr=%x\n", hr);
ok(hr == S_OK, "GetThumbnail failed, hr=%lx\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(hr == S_OK, "GetFrameSize failed, hr=%lx\n", hr);
ok(width == 16 && height == 16, "framesize=%ux%u\n", width, height);
IWICBitmapSource_Release(thumbnail);
}

View file

@ -35,7 +35,7 @@ static HRESULT get_component_info(const GUID *clsid, IWICComponentInfo **result)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return hr;
hr = IWICImagingFactory_CreateComponentInfo(factory, clsid, result);
@ -133,22 +133,22 @@ static void test_decoder_info(void)
win_skip("DDS decoder is not supported\n");
continue;
}
ok(SUCCEEDED(hr), "Failed to create decoder, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Failed to create decoder, hr %#lx.\n", hr);
decoder_info = NULL;
hr = IWICBitmapDecoder_GetDecoderInfo(decoder, &decoder_info);
ok(hr == S_OK || broken(IsEqualCLSID(&CLSID_WICBmpDecoder, test->clsid) && FAILED(hr)) /* Fails on Windows */,
"%u: failed to get decoder info, hr %#x.\n", i, hr);
"%u: failed to get decoder info, hr %#lx.\n", i, hr);
if (hr == S_OK)
{
decoder_info2 = NULL;
hr = IWICBitmapDecoder_GetDecoderInfo(decoder, &decoder_info2);
ok(hr == S_OK, "Failed to get decoder info, hr %#x.\n", hr);
ok(hr == S_OK, "Failed to get decoder info, hr %#lx.\n", hr);
ok(decoder_info == decoder_info2, "Unexpected decoder info instance.\n");
hr = IWICBitmapDecoderInfo_QueryInterface(decoder_info, &IID_IWICBitmapDecoder, (void **)&decoder2);
ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
IWICBitmapDecoderInfo_Release(decoder_info);
IWICBitmapDecoderInfo_Release(decoder_info2);
@ -159,123 +159,123 @@ static void test_decoder_info(void)
MultiByteToWideChar(CP_ACP, 0, test->extensions, -1, extensionsW, ARRAY_SIZE(extensionsW));
hr = get_component_info(test->clsid, &info);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%lx\n", hr);
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICBitmapDecoderInfo, (void **)&decoder_info);
ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr=%lx\n", hr);
hr = IWICBitmapDecoderInfo_GetCLSID(decoder_info, NULL);
ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%lx\n", hr);
hr = IWICBitmapDecoderInfo_GetCLSID(decoder_info, &clsid);
ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
ok(hr == S_OK, "GetCLSID failed, hr=%lx\n", hr);
ok(IsEqualGUID(test->clsid, &clsid), "GetCLSID returned wrong result\n");
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%lx\n", hr);
len = 0;
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 1, NULL, &len);
ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%lx\n", hr);
todo_wine_if(test->todo)
ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, len, value, NULL);
ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%lx\n", hr);
len = 0;
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 0, NULL, &len);
ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
ok(hr == S_OK, "GetMimeType failed, hr=%lx\n", hr);
todo_wine_if(test->todo)
ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len);
value[0] = 0;
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, len, value, &len);
ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
ok(hr == S_OK, "GetMimeType failed, hr=%lx\n", hr);
todo_wine_if(test->todo) {
ok(lstrcmpW(value, mimetypeW) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value));
ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len);
}
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 1, value, &len);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetMimeType failed, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetMimeType failed, hr=%lx\n", hr);
todo_wine_if(test->todo)
ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 256, value, &len);
ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
ok(hr == S_OK, "GetMimeType failed, hr=%lx\n", hr);
todo_wine_if(test->todo) {
ok(lstrcmpW(value, mimetypeW) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value));
ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len);
}
num_formats = 0xdeadbeef;
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, 0, NULL, &num_formats);
ok(hr == S_OK, "GetPixelFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetPixelFormats failed, hr=%lx\n", hr);
ok((num_formats <= 21 && num_formats >= 1) ||
broken(IsEqualCLSID(test->clsid, &CLSID_WICIcoDecoder) && num_formats == 0) /* WinXP */,
"%u: got %d formats\n", i, num_formats);
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "GetPixelFormats failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetPixelFormats failed, hr=%lx\n", hr);
count = 0xdeadbeef;
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, 0, pixelformats, &count);
ok(hr == S_OK, "GetPixelFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetPixelFormats failed, hr=%lx\n", hr);
ok(count == 0, "got %d formats\n", count);
count = 0xdeadbeef;
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, 1, pixelformats, &count);
ok(hr == S_OK, "GetPixelFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetPixelFormats failed, hr=%lx\n", hr);
ok((count == 1) || broken(IsEqualCLSID(test->clsid, &CLSID_WICIcoDecoder) && count == 0) /* WinXP */,
"%u: got %d formats\n", i, num_formats);
ok(is_pixelformat(&pixelformats[0]), "got invalid pixel format\n");
count = 0xdeadbeef;
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, num_formats, pixelformats, &count);
ok(hr == S_OK, "GetPixelFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetPixelFormats failed, hr=%lx\n", hr);
ok(count == num_formats, "got %d formats, expected %d\n", count, num_formats);
for (j = 0; j < num_formats; j++)
ok(is_pixelformat(&pixelformats[j]), "got invalid pixel format\n");
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, num_formats, pixelformats, NULL);
ok(hr == E_INVALIDARG, "GetPixelFormats failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetPixelFormats failed, hr=%lx\n", hr);
count = 0xdeadbeef;
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, ARRAY_SIZE(pixelformats),
pixelformats, &count);
ok(hr == S_OK, "GetPixelFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetPixelFormats failed, hr=%lx\n", hr);
ok(count == num_formats, "got %d formats, expected %d\n", count, num_formats);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%lx\n", hr);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 1, NULL, &len);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%lx\n", hr);
todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder))
ok(len == lstrlenW(extensionsW) + 1, "%u: GetFileExtensions returned wrong len %i\n", i, len);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, len, value, NULL);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%lx\n", hr);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 0, NULL, &len);
ok(hr == S_OK, "GetFileExtensions failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFileExtensions failed, hr=%lx\n", hr);
todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder))
ok(len == lstrlenW(extensionsW) + 1, "GetFileExtensions returned wrong len %i\n", len);
value[0] = 0;
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, len, value, &len);
ok(hr == S_OK, "GetFileExtensions failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFileExtensions failed, hr=%lx\n", hr);
todo_wine_if(test->todo)
ok(lstrcmpW(value, extensionsW) == 0, "GetFileExtensions returned wrong value %s\n", wine_dbgstr_w(value));
todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder))
ok(len == lstrlenW(extensionsW) + 1, "GetFileExtensions returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 1, value, &len);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetFileExtensions failed, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetFileExtensions failed, hr=%lx\n", hr);
todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder))
ok(len == lstrlenW(extensionsW) + 1, "GetFileExtensions returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 256, value, &len);
ok(hr == S_OK, "GetFileExtensions failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFileExtensions failed, hr=%lx\n", hr);
todo_wine_if(test->todo)
ok(lstrcmpW(value, extensionsW) == 0, "GetFileExtensions returned wrong value %s\n", wine_dbgstr_w(value));
todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder))
@ -303,29 +303,29 @@ static void test_pixelformat_info(void)
BOOL supportstransparency;
hr = get_component_info(&GUID_WICPixelFormat32bppBGRA, &info);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%lx\n", hr);
if (FAILED(hr))
return;
hr = IWICComponentInfo_GetAuthor(info, 0, NULL, 0);
ok(hr == E_INVALIDARG, "GetAuthor failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetAuthor failed, hr=%lx\n", hr);
len = 0xdeadbeef;
hr = IWICComponentInfo_GetAuthor(info, 0, NULL, &len);
ok(hr == S_OK, "GetAuthor failed, hr=%x\n", hr);
ok(hr == S_OK, "GetAuthor failed, hr=%lx\n", hr);
ok(len < 255 && len > 0, "invalid length 0x%x\n", len);
known_len = len;
memset(value, 0xaa, 256 * sizeof(WCHAR));
hr = IWICComponentInfo_GetAuthor(info, len-1, value, NULL);
ok(hr == E_INVALIDARG, "GetAuthor failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetAuthor failed, hr=%lx\n", hr);
ok(value[0] == 0xaaaa, "string modified\n");
len = 0xdeadbeef;
memset(value, 0xaa, 256 * sizeof(WCHAR));
hr = IWICComponentInfo_GetAuthor(info, known_len-1, value, &len);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetAuthor failed, hr=%x\n", hr);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetAuthor failed, hr=%lx\n", hr);
ok(len == known_len, "got length of 0x%x, expected 0x%x\n", len, known_len);
ok(value[known_len-1] == 0xaaaa, "string modified past given length\n");
ok(value[0] == 0xaaaa, "string modified\n");
@ -333,7 +333,7 @@ static void test_pixelformat_info(void)
len = 0xdeadbeef;
memset(value, 0xaa, 256 * sizeof(WCHAR));
hr = IWICComponentInfo_GetAuthor(info, known_len, value, &len);
ok(hr == S_OK, "GetAuthor failed, hr=%x\n", hr);
ok(hr == S_OK, "GetAuthor failed, hr=%lx\n", hr);
ok(len == known_len, "got length of 0x%x, expected 0x%x\n", len, known_len);
ok(value[known_len-1] == 0, "string not terminated at expected length\n");
ok(value[known_len-2] != 0xaaaa, "string not modified at given length\n");
@ -341,107 +341,107 @@ static void test_pixelformat_info(void)
len = 0xdeadbeef;
memset(value, 0xaa, 256 * sizeof(WCHAR));
hr = IWICComponentInfo_GetAuthor(info, known_len+1, value, &len);
ok(hr == S_OK, "GetAuthor failed, hr=%x\n", hr);
ok(hr == S_OK, "GetAuthor failed, hr=%lx\n", hr);
ok(len == known_len, "got length of 0x%x, expected 0x%x\n", len, known_len);
ok(value[known_len] == 0xaaaa, "string modified past end\n");
ok(value[known_len-1] == 0, "string not terminated at expected length\n");
ok(value[known_len-2] != 0xaaaa, "string not modified at given length\n");
hr = IWICComponentInfo_GetCLSID(info, NULL);
ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%lx\n", hr);
memset(&guid, 0xaa, sizeof(guid));
hr = IWICComponentInfo_GetCLSID(info, &guid);
ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
ok(hr == S_OK, "GetCLSID failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guid, &GUID_WICPixelFormat32bppBGRA), "unexpected CLSID %s\n", wine_dbgstr_guid(&guid));
hr = IWICComponentInfo_GetComponentType(info, NULL);
ok(hr == E_INVALIDARG, "GetComponentType failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetComponentType failed, hr=%lx\n", hr);
hr = IWICComponentInfo_GetComponentType(info, &componenttype);
ok(hr == S_OK, "GetComponentType failed, hr=%x\n", hr);
ok(hr == S_OK, "GetComponentType failed, hr=%lx\n", hr);
ok(componenttype == WICPixelFormat, "unexpected component type 0x%x\n", componenttype);
len = 0xdeadbeef;
hr = IWICComponentInfo_GetFriendlyName(info, 0, NULL, &len);
ok(hr == S_OK, "GetFriendlyName failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFriendlyName failed, hr=%lx\n", hr);
ok(len < 255 && len > 0, "invalid length 0x%x\n", len);
hr = IWICComponentInfo_GetSigningStatus(info, NULL);
ok(hr == E_INVALIDARG, "GetSigningStatus failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetSigningStatus failed, hr=%lx\n", hr);
hr = IWICComponentInfo_GetSigningStatus(info, &signing);
ok(hr == S_OK, "GetSigningStatus failed, hr=%x\n", hr);
ok(signing == WICComponentSigned, "unexpected signing status 0x%x\n", signing);
ok(hr == S_OK, "GetSigningStatus failed, hr=%lx\n", hr);
ok(signing == WICComponentSigned, "unexpected signing status 0x%lx\n", signing);
len = 0xdeadbeef;
hr = IWICComponentInfo_GetSpecVersion(info, 0, NULL, &len);
ok(hr == S_OK, "GetSpecVersion failed, hr=%x\n", hr);
ok(hr == S_OK, "GetSpecVersion failed, hr=%lx\n", hr);
ok(len == 0, "invalid length 0x%x\n", len); /* spec version does not apply to pixel formats */
memset(&guid, 0xaa, sizeof(guid));
hr = IWICComponentInfo_GetVendorGUID(info, &guid);
ok(hr == S_OK, "GetVendorGUID failed, hr=%x\n", hr);
ok(hr == S_OK, "GetVendorGUID failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guid, &GUID_VendorMicrosoft) ||
broken(IsEqualGUID(&guid, &GUID_NULL)) /* XP */, "unexpected GUID %s\n", wine_dbgstr_guid(&guid));
len = 0xdeadbeef;
hr = IWICComponentInfo_GetVersion(info, 0, NULL, &len);
ok(hr == S_OK, "GetVersion failed, hr=%x\n", hr);
ok(hr == S_OK, "GetVersion failed, hr=%lx\n", hr);
ok(len == 0, "invalid length 0x%x\n", len); /* version does not apply to pixel formats */
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void**)&pixelformat_info);
ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICPixelFormatInfo_GetBitsPerPixel(pixelformat_info, NULL);
ok(hr == E_INVALIDARG, "GetBitsPerPixel failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetBitsPerPixel failed, hr=%lx\n", hr);
hr = IWICPixelFormatInfo_GetBitsPerPixel(pixelformat_info, &uiresult);
ok(hr == S_OK, "GetBitsPerPixel failed, hr=%x\n", hr);
ok(hr == S_OK, "GetBitsPerPixel failed, hr=%lx\n", hr);
ok(uiresult == 32, "unexpected bpp %i\n", uiresult);
hr = IWICPixelFormatInfo_GetChannelCount(pixelformat_info, &uiresult);
ok(hr == S_OK, "GetChannelCount failed, hr=%x\n", hr);
ok(hr == S_OK, "GetChannelCount failed, hr=%lx\n", hr);
ok(uiresult == 4, "unexpected channel count %i\n", uiresult);
hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%lx\n", hr);
uiresult = 0xdeadbeef;
hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 0, NULL, &uiresult);
ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr);
ok(hr == S_OK, "GetChannelMask failed, hr=%lx\n", hr);
ok(uiresult == 4, "unexpected length %i\n", uiresult);
memset(abbuffer, 0xaa, sizeof(abbuffer));
hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, known_len, abbuffer, NULL);
ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%lx\n", hr);
ok(abbuffer[0] == 0xaa, "buffer modified\n");
uiresult = 0xdeadbeef;
memset(abbuffer, 0xaa, sizeof(abbuffer));
hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 3, abbuffer, &uiresult);
ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetChannelMask failed, hr=%lx\n", hr);
ok(abbuffer[0] == 0xaa, "buffer modified\n");
ok(uiresult == 4, "unexpected length %i\n", uiresult);
memset(abbuffer, 0xaa, sizeof(abbuffer));
hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 4, abbuffer, &uiresult);
ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr);
ok(*((ULONG*)abbuffer) == 0xff, "unexpected mask 0x%x\n", *((ULONG*)abbuffer));
ok(hr == S_OK, "GetChannelMask failed, hr=%lx\n", hr);
ok(*((ULONG*)abbuffer) == 0xff, "unexpected mask 0x%lx\n", *((ULONG*)abbuffer));
ok(uiresult == 4, "unexpected length %i\n", uiresult);
memset(abbuffer, 0xaa, sizeof(abbuffer));
hr = IWICPixelFormatInfo_GetChannelMask(pixelformat_info, 0, 5, abbuffer, &uiresult);
ok(hr == S_OK, "GetChannelMask failed, hr=%x\n", hr);
ok(*((ULONG*)abbuffer) == 0xff, "unexpected mask 0x%x\n", *((ULONG*)abbuffer));
ok(hr == S_OK, "GetChannelMask failed, hr=%lx\n", hr);
ok(*((ULONG*)abbuffer) == 0xff, "unexpected mask 0x%lx\n", *((ULONG*)abbuffer));
ok(abbuffer[4] == 0xaa, "buffer modified past actual length\n");
ok(uiresult == 4, "unexpected length %i\n", uiresult);
memset(&guid, 0xaa, sizeof(guid));
hr = IWICPixelFormatInfo_GetFormatGUID(pixelformat_info, &guid);
ok(hr == S_OK, "GetFormatGUID failed, hr=%x\n", hr);
ok(hr == S_OK, "GetFormatGUID failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guid, &GUID_WICPixelFormat32bppBGRA), "unexpected GUID %s\n", wine_dbgstr_guid(&guid));
IWICPixelFormatInfo_Release(pixelformat_info);
@ -454,19 +454,19 @@ static void test_pixelformat_info(void)
else
{
hr = IWICPixelFormatInfo2_GetNumericRepresentation(pixelformat_info2, NULL);
ok(hr == E_INVALIDARG, "GetNumericRepresentation failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetNumericRepresentation failed, hr=%lx\n", hr);
numericrepresentation = 0xdeadbeef;
hr = IWICPixelFormatInfo2_GetNumericRepresentation(pixelformat_info2, &numericrepresentation);
ok(hr == S_OK, "GetNumericRepresentation failed, hr=%x\n", hr);
ok(hr == S_OK, "GetNumericRepresentation failed, hr=%lx\n", hr);
ok(numericrepresentation == WICPixelFormatNumericRepresentationUnsignedInteger, "unexpected numeric representation %i\n", numericrepresentation);
hr = IWICPixelFormatInfo2_SupportsTransparency(pixelformat_info2, NULL);
ok(hr == E_INVALIDARG, "SupportsTransparency failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "SupportsTransparency failed, hr=%lx\n", hr);
supportstransparency = 0xdeadbeef;
hr = IWICPixelFormatInfo2_SupportsTransparency(pixelformat_info2, &supportstransparency);
ok(hr == S_OK, "SupportsTransparency failed, hr=%x\n", hr);
ok(hr == S_OK, "SupportsTransparency failed, hr=%lx\n", hr);
ok(supportstransparency == 1, "unexpected value %i\n", supportstransparency);
IWICPixelFormatInfo2_Release(pixelformat_info2);
@ -483,7 +483,7 @@ static DWORD WINAPI cache_across_threads_test(void *arg)
CoInitialize(NULL);
hr = get_component_info(&CLSID_WICUnknownMetadataReader, &info);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%lx\n", hr);
ok(info == arg, "unexpected info pointer %p\n", info);
IWICComponentInfo_Release(info);
@ -505,16 +505,16 @@ static void test_reader_info(void)
WICMetadataPattern *patterns;
hr = get_component_info(&CLSID_WICUnknownMetadataReader, &info2);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%lx\n", hr);
IWICComponentInfo_Release(info2);
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void**)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hr = IWICImagingFactory_CreateComponentInfo(factory, &CLSID_WICUnknownMetadataReader, &info);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%lx\n", hr);
ok(info == info2, "info != info2\n");
thread = CreateThread(NULL, 0, cache_across_threads_test, info, 0, &tid);
@ -522,36 +522,36 @@ static void test_reader_info(void)
CloseHandle(thread);
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICMetadataReaderInfo, (void**)&reader_info);
ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr=%lx\n", hr);
hr = IWICMetadataReaderInfo_GetCLSID(reader_info, NULL);
ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%lx\n", hr);
hr = IWICMetadataReaderInfo_GetCLSID(reader_info, &clsid);
ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
ok(hr == S_OK, "GetCLSID failed, hr=%lx\n", hr);
ok(IsEqualGUID(&CLSID_WICUnknownMetadataReader, &clsid), "GetCLSID returned wrong result\n");
hr = IWICMetadataReaderInfo_GetMetadataFormat(reader_info, &clsid);
ok(hr == S_OK, "GetMetadataFormat failed, hr=%x\n", hr);
ok(hr == S_OK, "GetMetadataFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&GUID_MetadataFormatUnknown, &clsid), "GetMetadataFormat returned wrong result\n");
hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "GetContainerFormats failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetContainerFormats failed, hr=%lx\n", hr);
count = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, &count);
ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetContainerFormats failed, hr=%lx\n", hr);
ok(count == 0, "unexpected count %d\n", count);
hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_ContainerFormatPng,
0, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "GetPatterns failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetPatterns failed, hr=%lx\n", hr);
count = size = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_ContainerFormatPng,
0, NULL, &count, &size);
ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND || broken(hr == S_OK) /* Windows XP */,
"GetPatterns failed, hr=%x\n", hr);
"GetPatterns failed, hr=%lx\n", hr);
ok(count == 0xdeadbeef, "unexpected count %d\n", count);
ok(size == 0xdeadbeef, "unexpected size %d\n", size);
@ -561,7 +561,7 @@ static void test_reader_info(void)
hr = IWICImagingFactory_CreateComponentInfo(factory, &CLSID_WICXMPStructMetadataReader, &info);
todo_wine
ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%lx\n", hr);
if (FAILED(hr))
{
@ -570,49 +570,49 @@ static void test_reader_info(void)
}
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICMetadataReaderInfo, (void**)&reader_info);
ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr=%lx\n", hr);
hr = IWICMetadataReaderInfo_GetCLSID(reader_info, NULL);
ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%lx\n", hr);
hr = IWICMetadataReaderInfo_GetCLSID(reader_info, &clsid);
ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
ok(hr == S_OK, "GetCLSID failed, hr=%lx\n", hr);
ok(IsEqualGUID(&CLSID_WICXMPStructMetadataReader, &clsid), "GetCLSID returned wrong result\n");
hr = IWICMetadataReaderInfo_GetMetadataFormat(reader_info, &clsid);
ok(hr == S_OK, "GetMetadataFormat failed, hr=%x\n", hr);
ok(hr == S_OK, "GetMetadataFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&GUID_MetadataFormatXMPStruct, &clsid), "GetMetadataFormat returned wrong result\n");
hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "GetContainerFormats failed, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetContainerFormats failed, hr=%lx\n", hr);
count = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, &count);
ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetContainerFormats failed, hr=%lx\n", hr);
ok(count >= 2, "unexpected count %d\n", count);
count = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 1, container_formats, &count);
ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetContainerFormats failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %d\n", count);
count = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 10, container_formats, &count);
ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr);
ok(hr == S_OK, "GetContainerFormats failed, hr=%lx\n", hr);
ok(count == min(count, 10), "unexpected count %d\n", count);
count = size = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_ContainerFormatPng,
0, NULL, &count, &size);
ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND || broken(hr == S_OK) /* Windows XP */,
"GetPatterns failed, hr=%x\n", hr);
"GetPatterns failed, hr=%lx\n", hr);
ok(count == 0xdeadbeef, "unexpected count %d\n", count);
ok(size == 0xdeadbeef, "unexpected size %d\n", size);
count = size = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_MetadataFormatXMP,
0, NULL, &count, &size);
ok(hr == S_OK, "GetPatterns failed, hr=%x\n", hr);
ok(hr == S_OK, "GetPatterns failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %d\n", count);
ok(size > sizeof(WICMetadataPattern), "unexpected size %d\n", size);
@ -623,14 +623,14 @@ static void test_reader_info(void)
count = size = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_MetadataFormatXMP,
size-1, patterns, &count, &size);
ok(hr == S_OK, "GetPatterns failed, hr=%x\n", hr);
ok(hr == S_OK, "GetPatterns failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %d\n", count);
ok(size > sizeof(WICMetadataPattern), "unexpected size %d\n", size);
count = size = 0xdeadbeef;
hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_MetadataFormatXMP,
size, patterns, &count, &size);
ok(hr == S_OK, "GetPatterns failed, hr=%x\n", hr);
ok(hr == S_OK, "GetPatterns failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %d\n", count);
ok(size == sizeof(WICMetadataPattern) + patterns->Length * 2, "unexpected size %d\n", size);
@ -660,15 +660,15 @@ static void test_imagingfactory_interfaces(void)
}
hr = IWICImagingFactory2_QueryInterface(factory2, &IID_IWICComponentFactory, (void **)&component_factory);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IWICComponentFactory_QueryInterface(component_factory, &IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(factory == (IWICImagingFactory *)component_factory, "Unexpected factory pointer.\n");
IWICImagingFactory_Release(factory);
hr = IWICImagingFactory2_QueryInterface(factory2, &IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(factory == (IWICImagingFactory *)component_factory, "Unexpected factory pointer.\n");
IWICComponentFactory_Release(component_factory);

View file

@ -76,12 +76,12 @@ static void test_decode_adobe_cmyk(void)
hr = CoCreateInstance(&CLSID_WICJpegDecoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapDecoder, (void**)&decoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
hjpegdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(jpeg_adobe_cmyk_1x5));
ok(hjpegdata != 0, "GlobalAlloc failed\n");
@ -92,31 +92,31 @@ static void test_decode_adobe_cmyk(void)
GlobalUnlock(hjpegdata);
hr = CreateStreamOnHGlobal(hjpegdata, FALSE, &jpegstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapDecoder_Initialize(decoder, jpegstream, WICDecodeMetadataCacheOnLoad);
ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
ok(hr == S_OK, "Initialize failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatJpeg), "unexpected container format\n");
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %u\n", count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height);
ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetSize failed, hr=%lx\n", hr);
ok(width == 1, "expected width=1, got %u\n", width);
ok(height == 5, "expected height=5, got %u\n", height);
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat32bppCMYK) ||
broken(IsEqualGUID(&guidresult, &GUID_WICPixelFormat24bppBGR)), /* xp/2003 */
"unexpected pixel format: %s\n", wine_dbgstr_guid(&guidresult));
@ -126,20 +126,20 @@ static void test_decode_adobe_cmyk(void)
for(i=2; i>0; --i)
{
hr = IWICBitmapFrameDecode_CopyPixels(framedecode, NULL, 4, sizeof(imagedata), imagedata);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%lx\n", hr);
ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)) ||
broken(!memcmp(imagedata, expected_imagedata_24bpp, sizeof(expected_imagedata))), /* xp/2003 */
"unexpected image data\n");
}
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#lx.\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#lx.\n", hr);
IWICPalette_Release(palette);

File diff suppressed because it is too large Load diff

View file

@ -40,165 +40,165 @@ static void test_custom_palette(void)
BOOL boolresult;
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
hr = IWICPalette_GetType(palette, &type);
ok(SUCCEEDED(hr), "GetType failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetType failed, hr=%lx\n", hr);
ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %x\n", type);
hr = IWICPalette_GetColorCount(palette, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
hr = IWICPalette_GetColors(palette, 0, colors, &count);
ok(SUCCEEDED(hr), "GetColors failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColors failed, hr=%lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
hr = IWICPalette_GetColors(palette, 4, colors, &count);
ok(SUCCEEDED(hr), "GetColors failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColors failed, hr=%lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
memcpy(colors, initcolors, sizeof(initcolors));
hr = IWICPalette_InitializeCustom(palette, colors, 4);
ok(SUCCEEDED(hr), "InitializeCustom failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "InitializeCustom failed, hr=%lx\n", hr);
hr = IWICPalette_GetType(palette, &type);
ok(SUCCEEDED(hr), "GetType failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetType failed, hr=%lx\n", hr);
ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %x\n", type);
hr = IWICPalette_GetColorCount(palette, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
memset(colors, 0, sizeof(colors));
count = 0;
hr = IWICPalette_GetColors(palette, 4, colors, &count);
ok(SUCCEEDED(hr), "GetColors failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColors failed, hr=%lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
ok(!memcmp(colors, initcolors, sizeof(colors)), "got unexpected palette data\n");
memset(colors, 0, sizeof(colors));
count = 0;
hr = IWICPalette_GetColors(palette, 2, colors, &count);
ok(SUCCEEDED(hr), "GetColors failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColors failed, hr=%lx\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
ok(!memcmp(colors, initcolors, sizeof(WICColor)*2), "got unexpected palette data\n");
count = 0;
hr = IWICPalette_GetColors(palette, 6, colors, &count);
ok(SUCCEEDED(hr), "GetColors failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColors failed, hr=%lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
hr = IWICPalette_HasAlpha(palette, &boolresult);
ok(SUCCEEDED(hr), "HasAlpha failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "HasAlpha failed, hr=%lx\n", hr);
ok(!boolresult, "expected FALSE, got TRUE\n");
hr = IWICPalette_IsBlackWhite(palette, &boolresult);
ok(SUCCEEDED(hr), "IsBlackWhite failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "IsBlackWhite failed, hr=%lx\n", hr);
ok(!boolresult, "expected FALSE, got TRUE\n");
hr = IWICPalette_IsGrayscale(palette, &boolresult);
ok(SUCCEEDED(hr), "IsGrayscale failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "IsGrayscale failed, hr=%lx\n", hr);
ok(!boolresult, "expected FALSE, got TRUE\n");
hr = IWICImagingFactory_CreatePalette(factory, &palette2);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
hr = IWICPalette_InitializeFromPalette(palette2, palette);
ok(SUCCEEDED(hr), "InitializeFromPalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "InitializeFromPalette failed, hr=%lx\n", hr);
type = 0xdeadbeef;
hr = IWICPalette_GetType(palette2, &type);
ok(SUCCEEDED(hr), "GetType failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetType failed, hr=%lx\n", hr);
ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %x\n", type);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette2, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
memset(colors, 0, sizeof(colors));
count = 0xdeadbeef;
hr = IWICPalette_GetColors(palette2, 4, colors, &count);
ok(SUCCEEDED(hr), "GetColors failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColors failed, hr=%lx\n", hr);
ok(count == 4, "expected 4, got %u\n", count);
ok(!memcmp(colors, initcolors, sizeof(colors)), "got unexpected palette data\n");
/* try a palette with some alpha in it */
colors[2] = 0x80ffffff;
hr = IWICPalette_InitializeCustom(palette, colors, 4);
ok(SUCCEEDED(hr), "InitializeCustom failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "InitializeCustom failed, hr=%lx\n", hr);
hr = IWICPalette_HasAlpha(palette, &boolresult);
ok(SUCCEEDED(hr), "HasAlpha failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "HasAlpha failed, hr=%lx\n", hr);
ok(boolresult, "expected TRUE, got FALSE\n");
/* setting to a 0-color palette is acceptable */
hr = IWICPalette_InitializeCustom(palette, NULL, 0);
ok(SUCCEEDED(hr), "InitializeCustom failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "InitializeCustom failed, hr=%lx\n", hr);
type = 0xdeadbeef;
hr = IWICPalette_GetType(palette, &type);
ok(SUCCEEDED(hr), "GetType failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetType failed, hr=%lx\n", hr);
ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %x\n", type);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
count = 0xdeadbeef;
hr = IWICPalette_GetColors(palette, 4, colors, &count);
ok(SUCCEEDED(hr), "GetColors failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColors failed, hr=%lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
hr = IWICPalette_InitializeFromPalette(palette2, palette);
ok(SUCCEEDED(hr), "InitializeFromPalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "InitializeFromPalette failed, hr=%lx\n", hr);
type = 0xdeadbeef;
hr = IWICPalette_GetType(palette2, &type);
ok(SUCCEEDED(hr), "GetType failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetType failed, hr=%lx\n", hr);
ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %x\n", type);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette2, &count);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColorCount failed, hr=%lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
memset(colors, 0, sizeof(colors));
count = 0xdeadbeef;
hr = IWICPalette_GetColors(palette2, 4, colors, &count);
ok(SUCCEEDED(hr), "GetColors failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetColors failed, hr=%lx\n", hr);
ok(count == 0, "expected 0, got %u\n", count);
/* IWICPalette is paranoid about NULL pointers */
hr = IWICPalette_GetType(palette, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
hr = IWICPalette_GetColorCount(palette, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
hr = IWICPalette_InitializeCustom(palette, NULL, 4);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
hr = IWICPalette_GetColors(palette, 4, NULL, &count);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
hr = IWICPalette_GetColors(palette, 4, colors, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
hr = IWICPalette_HasAlpha(palette, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
hr = IWICPalette_IsBlackWhite(palette, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
hr = IWICPalette_IsGrayscale(palette, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
hr = IWICPalette_InitializeFromPalette(palette, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %lx\n", hr);
IWICPalette_Release(palette2);
IWICPalette_Release(palette);
@ -453,47 +453,47 @@ static void test_predefined_palette(void)
WICColor color[256];
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICPalette_InitializePredefined(palette, WICBitmapPaletteTypeCustom, FALSE);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICPalette_InitializePredefined(palette, WICBitmapPaletteTypeMedianCut, FALSE);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICPalette_InitializePredefined(palette, 0x0f, FALSE);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
IWICPalette_Release(palette);
for (i = 0; i < ARRAY_SIZE(td); i++)
{
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "%u: CreatePalette error %#x\n", i, hr);
ok(hr == S_OK, "%u: CreatePalette error %#lx\n", i, hr);
hr = IWICPalette_InitializePredefined(palette, td[i].type, td[i].add_transparent);
ok(hr == S_OK, "%u: InitializePredefined error %#x\n", i, hr);
ok(hr == S_OK, "%u: InitializePredefined error %#lx\n", i, hr);
bret = -1;
hr = IWICPalette_IsBlackWhite(palette, &bret);
ok(hr == S_OK, "%u: IsBlackWhite error %#x\n", i, hr);
ok(hr == S_OK, "%u: IsBlackWhite error %#lx\n", i, hr);
ok(bret == td[i].is_bw ||
broken(td[i].type == WICBitmapPaletteTypeFixedBW && bret != td[i].is_bw), /* XP */
"%u: expected %d, got %d\n",i, td[i].is_bw, bret);
bret = -1;
hr = IWICPalette_IsGrayscale(palette, &bret);
ok(hr == S_OK, "%u: IsGrayscale error %#x\n", i, hr);
ok(hr == S_OK, "%u: IsGrayscale error %#lx\n", i, hr);
ok(bret == td[i].is_gray, "%u: expected %d, got %d\n", i, td[i].is_gray, bret);
type = -1;
hr = IWICPalette_GetType(palette, &type);
ok(hr == S_OK, "%u: GetType error %#x\n", i, hr);
ok(hr == S_OK, "%u: GetType error %#lx\n", i, hr);
ok(type == td[i].type, "%u: expected %#x, got %#x\n", i, td[i].type, type);
count = 0xdeadbeef;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "%u: GetColorCount error %#x\n", i, hr);
ok(hr == S_OK, "%u: GetColorCount error %#lx\n", i, hr);
ok(count == td[i].count, "%u: expected %u, got %u\n", i, td[i].count, count);
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "%u: GetColors error %#x\n", i, hr);
ok(hr == S_OK, "%u: GetColors error %#lx\n", i, hr);
ok(ret == count, "%u: expected %u, got %u\n", i, count, ret);
if (ret == td[i].count)
{
@ -571,68 +571,68 @@ static void test_palette_from_bitmap(void)
hr = IWICImagingFactory_CreateBitmapFromMemory(factory, width, height, &GUID_WICPixelFormat24bppRGB,
stride, stride * height, data, &bitmap);
ok(hr == S_OK, "CreateBitmapFromMemory error %#x\n", hr);
ok(hr == S_OK, "CreateBitmapFromMemory error %#lx\n", hr);
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 0, FALSE);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 1, FALSE);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 257, FALSE);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICPalette_InitializeFromBitmap(palette, NULL, 16, FALSE);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 2, FALSE);
ok(hr == S_OK, "InitializeFromBitmap error %#x\n", hr);
ok(hr == S_OK, "InitializeFromBitmap error %#lx\n", hr);
count = 0;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 2, TRUE);
ok(hr == S_OK, "InitializeFromBitmap error %#x\n", hr);
ok(hr == S_OK, "InitializeFromBitmap error %#lx\n", hr);
count = 0;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
/* without transparent color */
hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 16, FALSE);
ok(hr == S_OK, "InitializeFromBitmap error %#x\n", hr);
ok(hr == S_OK, "InitializeFromBitmap error %#lx\n", hr);
type = -1;
hr = IWICPalette_GetType(palette, &type);
ok(hr == S_OK, "GetType error %#x\n", hr);
ok(hr == S_OK, "GetType error %#lx\n", hr);
ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %#x\n", type);
count = 0;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 16, "expected 16, got %u\n", count);
memset(color, 0, sizeof(color));
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\n", hr);
ok(ret == count, "expected %u, got %u\n", count, ret);
ok(color[count - 1] != 0, "expected !0, got %08x\n", color[count - 1]);
/* with transparent color */
hr = IWICPalette_InitializeFromBitmap(palette, (IWICBitmapSource *)bitmap, 16, TRUE);
ok(hr == S_OK, "InitializeFromBitmap error %#x\n", hr);
ok(hr == S_OK, "InitializeFromBitmap error %#lx\n", hr);
type = -1;
hr = IWICPalette_GetType(palette, &type);
ok(hr == S_OK, "GetType error %#x\n", hr);
ok(hr == S_OK, "GetType error %#lx\n", hr);
ok(type == WICBitmapPaletteTypeCustom, "expected WICBitmapPaletteTypeCustom, got %#x\n", type);
count = 0;
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 16, "expected 16, got %u\n", count);
memset(color, 0xff, sizeof(color));
hr = IWICPalette_GetColors(palette, count, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\n", hr);
ok(ret == count, "expected %u, got %u\n", count, ret);
ok(color[count - 1] == 0, "expected 0, got %08x\n", color[count - 1]);
@ -650,7 +650,7 @@ START_TEST(palette)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
test_custom_palette();
test_predefined_palette();

View file

@ -294,7 +294,7 @@ static HRESULT create_decoder(const void *image_data, UINT image_size, IWICBitma
if (hr == S_OK)
{
hr = IWICBitmapDecoder_GetContainerFormat(*decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatPng),
"wrong container format %s\n", wine_dbgstr_guid(&format));
@ -346,182 +346,182 @@ static void test_color_contexts(void)
BOOL ret;
hr = create_decoder(png_no_color_profile, sizeof(png_no_color_profile), &decoder);
ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr);
ok(hr == S_OK, "Failed to load PNG image data %#lx\n", hr);
if (hr != S_OK) return;
/* global color context */
hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, NULL);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, &count);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#lx\n", hr);
ok(count == 0xdeadbeef, "unexpected count %u\n", count);
/* frame color context */
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetColorContexts(frame, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICBitmapFrameDecode_GetColorContexts(frame, 0, NULL, &count);
ok(hr == S_OK, "GetColorContexts error %#x\n", hr);
ok(hr == S_OK, "GetColorContexts error %#lx\n", hr);
ok(!count, "unexpected count %u\n", count);
IWICBitmapFrameDecode_Release(frame);
IWICBitmapDecoder_Release(decoder);
hr = create_decoder(png_color_profile, sizeof(png_color_profile), &decoder);
ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr);
ok(hr == S_OK, "Failed to load PNG image data %#lx\n", hr);
if (hr != S_OK) return;
/* global color context */
count = 0xdeadbeef;
hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, &count);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#lx\n", hr);
ok(count == 0xdeadbeef, "unexpected count %u\n", count);
/* frame color context */
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
count = 0xdeadbeef;
hr = IWICBitmapFrameDecode_GetColorContexts(frame, 0, NULL, &count);
ok(hr == S_OK, "GetColorContexts error %#x\n", hr);
ok(hr == S_OK, "GetColorContexts error %#lx\n", hr);
ok(count == 1, "unexpected count %u\n", count);
hr = IWICImagingFactory_CreateColorContext(factory, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
hr = IWICImagingFactory_CreateColorContext(factory, &context);
ok(hr == S_OK, "CreateColorContext error %#x\n", hr);
ok(hr == S_OK, "CreateColorContext error %#lx\n", hr);
hr = IWICColorContext_GetType(context, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
type = 0xdeadbeef;
hr = IWICColorContext_GetType(context, &type);
ok(hr == S_OK, "GetType error %#x\n", hr);
ok(hr == S_OK, "GetType error %#lx\n", hr);
ok(type == WICColorContextUninitialized, "unexpected type %u\n", type);
hr = IWICColorContext_GetProfileBytes(context, 0, NULL, NULL);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#x\n", hr);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#lx\n", hr);
size = 0;
hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#x\n", hr);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#lx\n", hr);
ok(!size, "unexpected size %u\n", size);
hr = IWICColorContext_GetExifColorSpace(context, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
colorspace = 0xdeadbeef;
hr = IWICColorContext_GetExifColorSpace(context, &colorspace);
ok(hr == S_OK, "GetExifColorSpace error %#x\n", hr);
ok(hr == S_OK, "GetExifColorSpace error %#lx\n", hr);
ok(colorspace == 0xffffffff, "unexpected color space %u\n", colorspace);
hr = IWICColorContext_InitializeFromExifColorSpace(context, 0);
ok(hr == S_OK, "InitializeFromExifColorSpace error %#x\n", hr);
ok(hr == S_OK, "InitializeFromExifColorSpace error %#lx\n", hr);
hr = IWICColorContext_InitializeFromExifColorSpace(context, 1);
ok(hr == S_OK, "InitializeFromExifColorSpace error %#x\n", hr);
ok(hr == S_OK, "InitializeFromExifColorSpace error %#lx\n", hr);
hr = IWICColorContext_InitializeFromExifColorSpace(context, 2);
ok(hr == S_OK, "InitializeFromExifColorSpace error %#x\n", hr);
ok(hr == S_OK, "InitializeFromExifColorSpace error %#lx\n", hr);
colorspace = 0xdeadbeef;
hr = IWICColorContext_GetExifColorSpace(context, &colorspace);
ok(hr == S_OK, "GetExifColorSpace error %#x\n", hr);
ok(hr == S_OK, "GetExifColorSpace error %#lx\n", hr);
ok(colorspace == 2, "unexpected color space %u\n", colorspace);
size = 0;
hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#x\n", hr);
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#lx\n", hr);
ok(!size, "unexpected size %u\n", size);
type = 0xdeadbeef;
hr = IWICColorContext_GetType(context, &type);
ok(hr == S_OK, "GetType error %#x\n", hr);
ok(hr == S_OK, "GetType error %#lx\n", hr);
ok(type == WICColorContextExifColorSpace, "unexpected type %u\n", type);
hr = IWICBitmapFrameDecode_GetColorContexts(frame, count, &context, &count);
ok(hr == WINCODEC_ERR_WRONGSTATE, "GetColorContexts error %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "GetColorContexts error %#lx\n", hr);
IWICColorContext_Release(context);
IWICBitmapFrameDecode_Release(frame);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICImagingFactory_CreateColorContext(factory, &context);
ok(hr == S_OK, "CreateColorContext error %#x\n", hr);
ok(hr == S_OK, "CreateColorContext error %#lx\n", hr);
count = 1;
hr = IWICBitmapFrameDecode_GetColorContexts(frame, count, &context, &count);
ok(hr == S_OK, "GetColorContexts error %#x\n", hr);
ok(hr == S_OK, "GetColorContexts error %#lx\n", hr);
hr = IWICColorContext_GetProfileBytes(context, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#lx\n", hr);
size = 0;
hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size);
ok(hr == S_OK, "GetProfileBytes error %#x\n", hr);
ok(hr == S_OK, "GetProfileBytes error %#lx\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);
ok(hr == S_OK, "GetProfileBytes error %#lx\n", hr);
tmpfile = save_profile( buffer, size );
HeapFree(GetProcessHeap(), 0, buffer);
type = 0xdeadbeef;
hr = IWICColorContext_GetType(context, &type);
ok(hr == S_OK, "GetType error %#x\n", hr);
ok(hr == S_OK, "GetType error %#lx\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(hr == S_OK, "GetExifColorSpace error %#lx\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);
ok(hr == WINCODEC_ERR_WRONGSTATE, "InitializeFromExifColorSpace error %#lx\n", hr);
if (tmpfile)
{
hr = IWICColorContext_InitializeFromFilename(context, NULL);
ok(hr == E_INVALIDARG, "InitializeFromFilename error %#x\n", hr);
ok(hr == E_INVALIDARG, "InitializeFromFilename error %#lx\n", hr);
hr = IWICColorContext_InitializeFromFilename(context, tmpfile);
ok(hr == S_OK, "InitializeFromFilename error %#x\n", hr);
ok(hr == S_OK, "InitializeFromFilename error %#lx\n", hr);
ret = DeleteFileW(tmpfile);
ok(ret, "DeleteFileW failed %u\n", GetLastError());
ok(ret, "DeleteFileW failed %lu\n", GetLastError());
type = 0xdeadbeef;
hr = IWICColorContext_GetType(context, &type);
ok(hr == S_OK, "GetType error %#x\n", hr);
ok(hr == S_OK, "GetType error %#lx\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(hr == S_OK, "GetExifColorSpace error %#lx\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);
ok(hr == WINCODEC_ERR_WRONGSTATE, "InitializeFromExifColorSpace error %#lx\n", hr);
size = 0;
hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size);
ok(hr == S_OK, "GetProfileBytes error %#x\n", hr);
ok(hr == S_OK, "GetProfileBytes error %#lx\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);
ok(hr == S_OK, "GetProfileBytes error %#lx\n", hr);
HeapFree(GetProcessHeap(), 0, buffer);
HeapFree(GetProcessHeap(), 0, tmpfile);
@ -562,28 +562,28 @@ static void test_png_palette(void)
char *buf;
hr = create_decoder(png_PLTE_tRNS, sizeof(png_PLTE_tRNS), &decoder);
ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr);
ok(hr == S_OK, "Failed to load PNG image data %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat1bppIndexed),
"got wrong format %s\n", wine_dbgstr_guid(&format));
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\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(hr == S_OK, "GetColors error %#lx\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]);
@ -593,21 +593,21 @@ static void test_png_palette(void)
IWICBitmapDecoder_Release(decoder);
hr = create_decoder(png_gray_tRNS, sizeof(png_gray_tRNS), &decoder);
ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr);
ok(hr == S_OK, "Failed to load PNG image data %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat64bppRGBA),
"got wrong format %s\n", wine_dbgstr_guid(&format));
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette error %#x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette error %#lx\n", hr);
IWICPalette_Release(palette);
IWICBitmapFrameDecode_Release(frame);
@ -619,28 +619,28 @@ static void test_png_palette(void)
buf[24] = 8; /* override bit depth */
hr = create_decoder(buf, sizeof(png_gray_tRNS), &decoder);
ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr);
ok(hr == S_OK, "Failed to load PNG image data %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
"got wrong format %s\n", wine_dbgstr_guid(&format));
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 256, "expected 256, got %u\n", count);
hr = IWICPalette_GetColors(palette, 256, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\n", hr);
ok(ret == count, "expected %u, got %u\n", count, ret);
ok(color[0] == 0x00000000, "expected 0x00000000, got %#x\n", color[0]);
ok(color[1] == 0xff010101, "expected 0xff010101, got %#x\n", color[1]);
@ -813,17 +813,17 @@ static void test_color_formats(void)
hr = create_decoder(buf, sizeof(buf), &decoder);
if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, TRUE))
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x\n", i, hr);
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#lx\n", i, hr);
else
todo_wine_if(td[i].todo_load)
ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x\n", i, td[i].color_type, td[i].bit_depth, hr);
ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#lx\n", i, td[i].color_type, td[i].bit_depth, hr);
if (hr != S_OK) goto next_1;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
todo_wine_if(td[i].todo)
ok(IsEqualGUID(&format, td[i].format_PLTE_tRNS),
"PLTE+tRNS: expected %s, got %s (type %d, bpp %d)\n",
@ -841,17 +841,17 @@ next_1:
hr = create_decoder(buf, sizeof(buf), &decoder);
if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, TRUE))
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x\n", i, hr);
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#lx\n", i, hr);
else
todo_wine_if(td[i].todo_load)
ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x\n", i, td[i].color_type, td[i].bit_depth, hr);
ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#lx\n", i, td[i].color_type, td[i].bit_depth, hr);
if (hr != S_OK) goto next_2;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, td[i].format_PLTE),
"PLTE: expected %s, got %s (type %d, bpp %d)\n",
wine_dbgstr_guid(td[i].format_PLTE), wine_dbgstr_guid(&format), td[i].color_type, td[i].bit_depth);
@ -869,17 +869,17 @@ next_2:
hr = create_decoder(buf, sizeof(buf), &decoder);
if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, FALSE))
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x\n", i, hr);
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#lx\n", i, hr);
else
todo_wine_if(td[i].todo_load)
ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x\n", i, td[i].color_type, td[i].bit_depth, hr);
ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#lx\n", i, td[i].color_type, td[i].bit_depth, hr);
if (hr != S_OK) goto next_3;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, td[i].format),
"expected %s, got %s (type %d, bpp %d)\n",
wine_dbgstr_guid(td[i].format), wine_dbgstr_guid(&format), td[i].color_type, td[i].bit_depth);
@ -896,17 +896,17 @@ next_3:
hr = create_decoder(buf, sizeof(buf), &decoder);
if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, FALSE))
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x\n", i, hr);
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#lx\n", i, hr);
else
todo_wine_if(td[i].todo_load)
ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x\n", i, td[i].color_type, td[i].bit_depth, hr);
ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#lx\n", i, td[i].color_type, td[i].bit_depth, hr);
if (hr != S_OK) continue;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
todo_wine_if(td[i].todo)
ok(IsEqualGUID(&format, td[i].format_PLTE_tRNS),
"tRNS: expected %s, got %s (type %d, bpp %d)\n",
@ -944,7 +944,7 @@ static void test_chunk_size(void)
memcpy(png_8M_tEXt + sizeof(png_8M_tEXt) - sizeof(png_8M_tEXt_end), png_8M_tEXt_end, sizeof(png_8M_tEXt_end));
hr = create_decoder(png_8M_tEXt, sizeof(png_8M_tEXt), &decoder);
ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr);
ok(hr == S_OK, "Failed to load PNG image data %#lx\n", hr);
if (hr != S_OK) return;
IWICBitmapDecoder_Release(decoder);
@ -957,7 +957,7 @@ START_TEST(pngformat)
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
if (FAILED(hr)) return;
test_color_contexts();

View file

@ -41,36 +41,36 @@ static void test_propertybag_getpropertyinfo(IPropertyBag2 *property, ULONG expe
/* 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);
"GetPropertyInfo handled iProperty out of bounce wrong, hr=%lx\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 handled cProperty out of bounce wrong, hr=%lx\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);
ok(hr == S_OK, "GetPropertyInfo failed, hr=%lx\n", hr);
if (FAILED(hr))
return;
ok(expected_count == out_count,
"GetPropertyInfo returned unexpected property count, %i != %i)\n",
"GetPropertyInfo returned unexpected property count, %li != %li)\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(pb[0].dwType == PROPBAG2_TYPE_DATA, "Invalid variant type, pb[0].dwType=%lx\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));
CoTaskMemFree(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(pb[1].dwType == PROPBAG2_TYPE_DATA, "Invalid variant type, pb[1].dwType=%lx\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));
CoTaskMemFree(pb[1].pstrName);
}
@ -81,15 +81,15 @@ static void test_propertybag_countproperties(IPropertyBag2 *property, ULONG expe
HRESULT hr;
hr = IPropertyBag2_CountProperties(property, NULL);
ok(hr == E_INVALIDARG, "CountProperties returned unexpected result, hr=%x\n", hr);
ok(hr == E_INVALIDARG, "CountProperties returned unexpected result, hr=%lx\n", hr);
hr = IPropertyBag2_CountProperties(property, &count);
ok(hr == S_OK, "CountProperties failed, hr=%x\n", hr);
ok(hr == S_OK, "CountProperties failed, hr=%lx\n", hr);
if (FAILED(hr))
return;
ok(count == expected_count, "CountProperties returned invalid value, count=%i\n", count);
ok(count == expected_count, "CountProperties returned invalid value, count=%li\n", count);
}
static void test_propertybag_read(IPropertyBag2 *property)
@ -103,17 +103,17 @@ static void test_propertybag_read(IPropertyBag2 *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);
"Read for an unknown property did not fail with expected code, hr=%lx\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);
ok(hr == S_OK, "Read failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
ok(itm_hr[0] == S_OK,
"Read failed, itm_hr[0]=%x\n", itm_hr[0]);
"Read failed, itm_hr[0]=%lx\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,
@ -128,14 +128,14 @@ static void test_propertybag_read(IPropertyBag2 *property)
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);
ok(hr == S_OK, "Read failed, hr=%lx\n", hr);
if (SUCCEEDED(hr))
{
ok(itm_hr[0] == S_OK, "Read failed, itm_hr[0]=%x\n", itm_hr[0]);
ok(itm_hr[0] == S_OK, "Read failed, itm_hr[0]=%lx\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(itm_hr[1] == S_OK, "Read failed, itm_hr[1]=%lx\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));
@ -160,12 +160,12 @@ static void test_propertybag_read(IPropertyBag2 *property)
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);
ok(hr == E_FAIL, "Read failed, hr=%lx\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(itm_hr[0] == S_OK, "Read error code has unexpected value, itm_hr[0]=%lx\n", itm_hr[0]);
ok(itm_hr[1] == -1, "Read error code has unexpected value, itm_hr[1]=%lx\n", itm_hr[1]);
ok(itm_hr[2] == -1, "Read error code has unexpected value, itm_hr[2]=%lx\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]));
@ -189,14 +189,14 @@ static void test_propertybag_write(IPropertyBag2 *property)
/* 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);
ok(hr == E_FAIL, "Write for an unknown property did not fail with expected code, hr=%lx\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);
ok(hr == S_OK, "Write for one property failed, hr=%lx\n", hr);
/* 3. One property with mismatching type */
options[0].pstrName = (LPOLESTR)wszTestProperty1;
@ -204,14 +204,14 @@ static void test_propertybag_write(IPropertyBag2 *property)
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);
"Write with mismatching type did not fail with expected code hr=%lx\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);
"Write to reset to empty value does not fail with expected code, hr=%lx\n", hr);
/* 5. Set two properties */
options[0].pstrName = (LPOLESTR)wszTestProperty1;
@ -221,7 +221,7 @@ static void test_propertybag_write(IPropertyBag2 *property)
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);
ok(hr == S_OK, "Write for two properties failed, hr=%lx\n", hr);
}
static void test_empty_propertybag(void)
@ -232,11 +232,11 @@ static void test_empty_propertybag(void)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICComponentFactory, (void**)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
hr = IWICComponentFactory_CreateEncoderPropertyBag(factory, NULL, 0, &property);
ok(hr == S_OK, "Creating EncoderPropertyBag failed, hr=%x\n", hr);
ok(hr == S_OK, "Creating EncoderPropertyBag failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
test_propertybag_countproperties(property, 0);
@ -260,11 +260,11 @@ static void test_filled_propertybag(void)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICComponentFactory, (void**)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr=%lx\n", hr);
hr = IWICComponentFactory_CreateEncoderPropertyBag(factory, opts, 2, &property);
ok(hr == S_OK, "Creating EncoderPropertyBag failed, hr=%x\n", hr);
ok(hr == S_OK, "Creating EncoderPropertyBag failed, hr=%lx\n", hr);
if (FAILED(hr)) return;
test_propertybag_countproperties(property, 2);

File diff suppressed because it is too large Load diff

View file

@ -32,7 +32,7 @@ static void _expect_ref(IUnknown* obj, ULONG ref, int line)
ULONG rc;
IUnknown_AddRef(obj);
rc = IUnknown_Release(obj);
ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
ok_(__FILE__,line)(rc == ref, "expected refcount %ld, got %ld\n", ref, rc);
}
#define IFD_BYTE 1
@ -363,7 +363,7 @@ static IStream *create_stream(const void *data, int data_size)
GlobalUnlock(hdata);
hr = CreateStreamOnHGlobal(hdata, TRUE, &stream);
ok(hr == S_OK, "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
return stream;
}
@ -385,13 +385,13 @@ static HRESULT create_decoder(const void *image_data, UINT image_size, IWICBitma
GlobalUnlock(hmem);
hr = CreateStreamOnHGlobal(hmem, TRUE, &stream);
ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
ok(hr == S_OK, "CreateStreamOnHGlobal error %#lx\n", hr);
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, decoder);
if (hr == S_OK)
{
hr = IWICBitmapDecoder_GetContainerFormat(*decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(hr == S_OK, "GetContainerFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatTiff),
"wrong container format %s\n", wine_dbgstr_guid(&format));
@ -409,23 +409,23 @@ static HRESULT get_pixelformat_info(const GUID *format, UINT *bpp, UINT *channel
IWICPixelFormatInfo2 *formatinfo;
hr = IWICImagingFactory_CreateComponentInfo(factory, format, &info);
ok(hr == S_OK, "CreateComponentInfo(%s) error %#x\n", wine_dbgstr_guid(format), hr);
ok(hr == S_OK, "CreateComponentInfo(%s) error %#lx\n", wine_dbgstr_guid(format), hr);
if (hr == S_OK)
{
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void **)&formatinfo);
if (hr == S_OK)
{
hr = IWICPixelFormatInfo2_SupportsTransparency(formatinfo, transparency);
ok(hr == S_OK, "SupportsTransparency error %#x\n", hr);
ok(hr == S_OK, "SupportsTransparency error %#lx\n", hr);
IWICPixelFormatInfo2_Release(formatinfo);
}
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void **)&formatinfo);
if (hr == S_OK)
{
hr = IWICPixelFormatInfo2_GetBitsPerPixel(formatinfo, bpp);
ok(hr == S_OK, "GetBitsPerPixel error %#x\n", hr);
ok(hr == S_OK, "GetBitsPerPixel error %#lx\n", hr);
hr = IWICPixelFormatInfo2_GetChannelCount(formatinfo, channels);
ok(hr == S_OK, "GetChannelCount error %#x\n", hr);
ok(hr == S_OK, "GetChannelCount error %#lx\n", hr);
IWICPixelFormatInfo2_Release(formatinfo);
}
IWICComponentInfo_Release(info);
@ -445,7 +445,7 @@ static void dump_tiff(void *buf)
for (i = 0; i < count; i++)
{
printf("tag %u: id %04x, type %04x, count %u, value %d",
printf("tag %u: id %04x, type %04x, count %lu, value %ld",
i, tag[i].id, tag[i].type, tag[i].count, tag[i].value);
if (tag[i].id == 0x102 && tag[i].count > 2)
{
@ -466,22 +466,22 @@ static void test_tiff_1bpp_palette(void)
GUID format;
hr = create_decoder(&tiff_1bpp_data, sizeof(tiff_1bpp_data), &decoder);
ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormatBlackWhite),
"got wrong format %s\n", wine_dbgstr_guid(&format));
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE,
"expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#x\n", hr);
"expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#lx\n", hr);
IWICPalette_Release(palette);
IWICBitmapFrameDecode_Release(frame);
@ -507,77 +507,77 @@ static void test_QueryCapability(void)
if (!stream) return;
hr = IWICImagingFactory_CreateDecoder(factory, &GUID_ContainerFormatTiff, NULL, &decoder);
ok(hr == S_OK, "CreateDecoder error %#x\n", hr);
ok(hr == S_OK, "CreateDecoder error %#lx\n", hr);
if (FAILED(hr)) return;
frame_count = 0xdeadbeef;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK || broken(hr == E_POINTER) /* XP */, "GetFrameCount error %#x\n", hr);
ok(hr == S_OK || broken(hr == E_POINTER) /* XP */, "GetFrameCount error %#lx\n", hr);
ok(frame_count == 0, "expected 0, got %u\n", frame_count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == WINCODEC_ERR_FRAMEMISSING || broken(hr == E_POINTER) /* XP */, "expected WINCODEC_ERR_FRAMEMISSING, got %#x\n", hr);
ok(hr == WINCODEC_ERR_FRAMEMISSING || broken(hr == E_POINTER) /* XP */, "expected WINCODEC_ERR_FRAMEMISSING, got %#lx\n", hr);
pos.QuadPart = 4;
hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
capability = 0xdeadbeef;
hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
ok(hr == S_OK, "QueryCapability error %#x\n", hr);
ok(hr == S_OK, "QueryCapability error %#lx\n", hr);
ok(capability == exp_caps || capability == exp_caps_xp,
"expected %#x, got %#x\n", exp_caps, capability);
"expected %#lx, got %#lx\n", exp_caps, capability);
frame_count = 0xdeadbeef;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
ok(frame_count == 1, "expected 1, got %u\n", frame_count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
IWICBitmapFrameDecode_Release(frame);
pos.QuadPart = 5;
hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#lx\n", hr);
hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#lx\n", hr);
IWICBitmapDecoder_Release(decoder);
/* CreateDecoderFromStream fails if seeked past the start */
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
todo_wine
ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "expected WINCODEC_ERR_COMPONENTNOTFOUND, got %#x\n", hr);
ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "expected WINCODEC_ERR_COMPONENTNOTFOUND, got %#lx\n", hr);
if (SUCCEEDED(hr))
IWICBitmapDecoder_Release(decoder);
pos.QuadPart = 0;
hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
ok(hr == S_OK, "IStream_Seek error %#lx\n", hr);
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
ok(hr == S_OK, "CreateDecoderFromStream error %#lx\n", hr);
frame_count = 0xdeadbeef;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
ok(frame_count == 1, "expected 1, got %u\n", frame_count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
IWICBitmapFrameDecode_Release(frame);
hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#lx\n", hr);
hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#lx\n", hr);
IWICBitmapDecoder_Release(decoder);
IStream_Release(stream);
@ -598,39 +598,39 @@ static void test_tiff_8bpp_alpha(void)
0x55,0x55,0x55,0x66,0x77,0x77,0x77,0x88 };
hr = create_decoder(&tiff_8bpp_alpha, sizeof(tiff_8bpp_alpha), &decoder);
ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
ok(frame_count == 1, "expected 1, got %u\n", frame_count);
EXPECT_REF(decoder, 1);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
EXPECT_REF(decoder, 2);
IWICBitmapDecoder_Release(decoder);
hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
ok(hr == S_OK, "GetSize error %#x\n", hr);
ok(hr == S_OK, "GetSize error %#lx\n", hr);
ok(width == 2, "expected 2, got %u\n", width);
ok(height == 2, "expected 2, got %u\n", height);
hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y);
ok(hr == S_OK, "GetResolution error %#x\n", hr);
ok(hr == S_OK, "GetResolution error %#lx\n", hr);
ok(dpi_x == 96.0, "expected 96.0, got %f\n", dpi_x);
ok(dpi_y == 96.0, "expected 96.0, got %f\n", dpi_y);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppPBGRA),
"got wrong format %s\n", wine_dbgstr_guid(&format));
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE,
"expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#x\n", hr);
"expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#lx\n", hr);
IWICPalette_Release(palette);
rc.X = 0;
@ -638,7 +638,7 @@ static void test_tiff_8bpp_alpha(void)
rc.Width = 2;
rc.Height = 2;
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rc, 8, sizeof(data), data);
ok(hr == S_OK, "CopyPixels error %#x\n", hr);
ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
for (i = 0; i < sizeof(data); i++)
ok(data[i] == expected_data[i], "%u: expected %02x, got %02x\n", i, expected_data[i], data[i]);
@ -691,28 +691,28 @@ static void test_tiff_8bpp_palette(void)
generate_tiff_palette(buf + FIELD_OFFSET(struct tiff_8bpp_data, palette_data), 256);
hr = create_decoder(buf, sizeof(buf), &decoder);
ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat8bppIndexed),
"expected GUID_WICPixelFormat8bppIndexed, got %s\n", wine_dbgstr_guid(&format));
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == S_OK, "CopyPalette error %#x\n", hr);
ok(hr == S_OK, "CopyPalette error %#lx\n", hr);
hr = IWICPalette_GetColorCount(palette, &count);
ok(hr == S_OK, "GetColorCount error %#x\n", hr);
ok(hr == S_OK, "GetColorCount error %#lx\n", hr);
ok(count == 256, "expected 256, got %u\n", count);
hr = IWICPalette_GetColors(palette, 256, color, &ret);
ok(hr == S_OK, "GetColors error %#x\n", hr);
ok(hr == S_OK, "GetColors error %#lx\n", hr);
ok(ret == count, "expected %u, got %u\n", count, ret);
ok(color[0] == 0xff112233, "got %#x\n", color[0]);
ok(color[1] == 0xff445566, "got %#x\n", color[1]);
@ -740,14 +740,14 @@ static void test_tiff_resolution(void)
tiff_resolution_image_data.entry[12].value = test_data->resolution_unit;
hr = create_decoder(&tiff_resolution_image_data, sizeof(tiff_resolution_image_data), &decoder);
ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "%d: GetFrame error %#x\n", i, hr);
ok(hr == S_OK, "%d: GetFrame error %#lx\n", i, hr);
hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y);
ok(hr == S_OK, "%d: GetResolution error %#x\n", i, hr);
ok(hr == S_OK, "%d: GetResolution error %#lx\n", i, hr);
if (test_data->broken_dpi_x != 0)
{
@ -789,29 +789,29 @@ 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, "Failed to load TIFF image data %#x\n", hr);
ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
if (hr != S_OK) return;
ok(decoder != NULL, "Failed to load TIFF image data\n");
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
ok(count == 1, "got %u\n", count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
ok(hr == S_OK, "GetSize error %#x\n", hr);
ok(hr == S_OK, "GetSize error %#lx\n", hr);
ok(width == 1, "got %u\n", width);
ok(height == 1, "got %u\n", height);
hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y);
ok(hr == S_OK, "GetResolution error %#x\n", hr);
ok(hr == S_OK, "GetResolution error %#lx\n", hr);
ok(dpi_x == 300.0, "got %f\n", dpi_x);
ok(dpi_y == 300.0, "got %f\n", dpi_y);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat24bppBGR),
"got wrong format %s\n", wine_dbgstr_guid(&format));
@ -824,10 +824,10 @@ static void test_tiff_24bpp(void)
rc.Height = 1;
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rc, stride, sizeof(data), data);
if (stride < 3)
ok(hr == E_INVALIDARG, "CopyPixels(%u) should fail: %#x\n", stride, hr);
ok(hr == E_INVALIDARG, "CopyPixels(%u) should fail: %#lx\n", stride, hr);
else
{
ok(hr == S_OK, "CopyPixels(%u) error %#x\n", stride, hr);
ok(hr == S_OK, "CopyPixels(%u) error %#lx\n", stride, hr);
for (i = 0; i < sizeof(data); i++)
ok(data[i] == expected_data[i], "%u: expected %02x, got %02x\n", i, expected_data[i], data[i]);
@ -1205,7 +1205,7 @@ static void test_color_formats(void)
if (!td[i].data)
{
ok(hr == WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT || hr == WINCODEC_ERR_COMPONENTNOTFOUND /* win8+ */ || hr == WINCODEC_ERR_BADIMAGE /* XP */,
"%u: (%d,%d,%d,%d) wrong error %#x\n", i, td[i].photometric, td[i].samples, td[i].extra_samples, td[i].bps, hr);
"%u: (%d,%d,%d,%d) wrong error %#lx\n", i, td[i].photometric, td[i].samples, td[i].extra_samples, td[i].bps, hr);
if (hr == S_OK)
{
IWICBitmapDecoder_Release(decoder);
@ -1215,15 +1215,15 @@ static void test_color_formats(void)
}
else
ok(hr == S_OK || broken(hr == WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT || hr == WINCODEC_ERR_BADIMAGE) /* XP */,
"%u: failed to load TIFF image data (%d,%d,%d,%d) %#x\n",
"%u: failed to load TIFF image data (%d,%d,%d,%d) %#lx\n",
i, td[i].photometric, td[i].samples, td[i].extra_samples, td[i].bps, hr);
if (hr != S_OK) continue;
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "%u: GetFrame error %#x\n", i, hr);
ok(hr == S_OK, "%u: GetFrame error %#lx\n", i, hr);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "%u: GetPixelFormat error %#x\n", i, hr);
ok(hr == S_OK, "%u: GetPixelFormat error %#lx\n", i, hr);
if (IsEqualGUID(td[i].data->format, &GUID_WICPixelFormat96bppRGBFloat) && IsEqualGUID(&format, &GUID_WICPixelFormat128bppRGBFloat))
{
win_skip("Windows Server 2008 misinterprets 96bppRGBFloat as 128bppRGBFloat, skipping the tests\n");
@ -1238,14 +1238,14 @@ static void test_color_formats(void)
transparency = (td[i].photometric == 2 && td[i].samples == 4); /* for XP */
hr = get_pixelformat_info(&format, &bpp, &channels, &transparency);
ok(hr == S_OK, "%u: get_pixelformat_bpp error %#x\n", i, hr);
ok(hr == S_OK, "%u: get_pixelformat_bpp error %#lx\n", i, hr);
ok(bpp == td[i].data->bpp, "%u: expected %u, got %u\n", i, td[i].data->bpp, bpp);
ok(channels == td[i].samples, "%u: expected %u, got %u\n", i, td[i].samples, channels);
ok(transparency == (td[i].photometric == 2 && td[i].samples == 4), "%u: got %u\n", i, transparency);
memset(pixels, 0, sizeof(pixels));
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, width_bytes(td[i].data->width, bpp), sizeof(pixels), pixels);
ok(hr == S_OK, "%u: CopyPixels error %#x\n", i, hr);
ok(hr == S_OK, "%u: CopyPixels error %#lx\n", i, hr);
ret = memcmp(pixels, td[i].data->bits, width_bytes(td[i].data->width, bpp));
if (ret && td[i].alt_data)
ret = memcmp(pixels, td[i].alt_data->bits, width_bytes(td[i].data->width, bpp));
@ -1277,36 +1277,36 @@ static void test_tiff_4bps_bgra(void)
0,0xff,0,0, 0xff,0xff,0,0xff, 0xff,0xff,0xff,0 };
hr = create_decoder(&tiff_4bps_bgra, sizeof(tiff_4bps_bgra), &decoder);
ok(hr == S_OK, "Failed to load TIFF image data %#x\n", hr);
ok(hr == S_OK, "Failed to load TIFF image data %#lx\n", hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
ok(hr == S_OK, "GetFrameCount error %#lx\n", hr);
ok(frame_count == 1, "expected 1, got %u\n", frame_count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
ok(hr == S_OK, "GetFrame error %#lx\n", hr);
hr = IWICBitmapFrameDecode_GetSize(frame, &width, &height);
ok(hr == S_OK, "GetSize error %#x\n", hr);
ok(hr == S_OK, "GetSize error %#lx\n", hr);
ok(width == 3, "got %u\n", width);
ok(height == 2, "got %u\n", height);
hr = IWICBitmapFrameDecode_GetResolution(frame, &dpi_x, &dpi_y);
ok(hr == S_OK, "GetResolution error %#x\n", hr);
ok(hr == S_OK, "GetResolution error %#lx\n", hr);
ok(dpi_x == 96.0, "expected 96.0, got %f\n", dpi_x);
ok(dpi_y == 96.0, "expected 96.0, got %f\n", dpi_y);
hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
ok(hr == S_OK, "GetPixelFormat error %#x\n", hr);
ok(hr == S_OK, "GetPixelFormat error %#lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
"got wrong format %s\n", wine_dbgstr_guid(&format));
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
ok(hr == S_OK, "CreatePalette error %#lx\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(frame, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE,
"expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#x\n", hr);
"expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %#lx\n", hr);
IWICPalette_Release(palette);
memset(data, 0xaa, sizeof(data));
@ -1315,7 +1315,7 @@ static void test_tiff_4bps_bgra(void)
rc.Width = 3;
rc.Height = 2;
hr = IWICBitmapFrameDecode_CopyPixels(frame, &rc, 12, sizeof(data), data);
ok(hr == S_OK, "CopyPixels error %#x\n", hr);
ok(hr == S_OK, "CopyPixels error %#lx\n", hr);
for (i = 0; i < sizeof(data); i++)
ok(data[i] == expected_data[i], "%u: expected %02x, got %02x\n", i, expected_data[i], data[i]);
@ -1332,7 +1332,7 @@ START_TEST(tiffformat)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
ok(hr == S_OK, "CoCreateInstance error %#lx\n", hr);
if (FAILED(hr)) return;
test_tiff_4bps_bgra();

View file

@ -95,7 +95,7 @@ static void test_decode(void)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%lx\n", hr);
hwmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(wmp_imagedata));
ok(hwmpdata != 0, "GlobalAlloc failed\n");
@ -105,38 +105,38 @@ static void test_decode(void)
GlobalUnlock(hwmpdata);
hr = CreateStreamOnHGlobal(hwmpdata, FALSE, &wmpstream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_Initialize(decoder, wmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
ok(hr == S_OK, "Initialize failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_Initialize(decoder, wmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == WINCODEC_ERR_WRONGSTATE, "Initialize returned %x\n", hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "Initialize returned %lx\n", hr);
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatWmp),
"unexpected container format\n");
hr = IWICBitmapDecoder_GetFrameCount(decoder, &count);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%lx\n", hr);
ok(count == 1, "unexpected count %u\n", count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, NULL);
ok(hr == E_INVALIDARG, "GetFrame(NULL) returned hr=%x\n", hr);
ok(hr == E_INVALIDARG, "GetFrame(NULL) returned hr=%lx\n", hr);
for (j = 2; j > 0; --j)
{
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetFrame failed, hr=%lx\n", hr);
hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height);
ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetSize failed, hr=%lx\n", hr);
ok(width == 1, "expected width=1, got %u\n", width);
ok(height == 5, "expected height=5, got %u\n", height);
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &format);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%lx\n", hr);
ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
"unexpected pixel format: %s\n", wine_dbgstr_guid(&format));
@ -145,20 +145,20 @@ static void test_decode(void)
memset(imagedata, 0, sizeof(imagedata));
hr = IWICBitmapFrameDecode_CopyPixels(
framedecode, NULL, 4, sizeof(imagedata), imagedata);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CopyPixels failed, hr=%lx\n", hr);
ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)) ||
broken(!memcmp(imagedata, broken_imagedata, sizeof(imagedata)) /* w2008s64 */),
"unexpected image data\n");
}
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr);
ok(SUCCEEDED(hr), "CreatePalette failed, hr=%lx\n", hr);
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#lx.\n", hr);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#lx.\n", hr);
IWICPalette_Release(palette);