windowscodecs: Add a test for loading a .bmp file with BITMAPINFOHEADER.

This commit is contained in:
Dmitry Timoshkov 2013-01-09 15:46:23 +08:00 committed by Alexandre Julliard
parent af59e6f1b7
commit 01ab797b64
2 changed files with 23 additions and 7 deletions

View File

@ -31,15 +31,21 @@
static const char testbmp_24bpp[] = { static const char testbmp_24bpp[] = {
/* BITMAPFILEHEADER */ /* BITMAPFILEHEADER */
66,77, /* "BM" */ 66,77, /* "BM" */
50,0,0,0, /* file size */ 78,0,0,0, /* file size */
0,0,0,0, /* reserved */ 0,0,0,0, /* reserved */
26,0,0,0, /* offset to bits */ 54,0,0,0, /* offset to bits */
/* BITMAPCOREHEADER */ /* BITMAPINFOHEADER */
12,0,0,0, /* header size */ 40,0,0,0, /* header size */
2,0, /* width */ 2,0,0,0, /* width */
3,0, /* height */ 3,0,0,0, /* height */
1,0, /* planes */ 1,0, /* planes */
24,0, /* bit count */ 24,0, /* bit count */
0,0,0,0, /* compression */
0,0,0,0, /* image size */
0x74,0x12,0,0, /* X pels per meter => 120 dpi */
0,0,0,0, /* Y pels per meter */
0,0,0,0, /* colors used */
0,0,0,0, /* colors important */
/* bits */ /* bits */
0,0,0, 0,255,0, 0,0, 0,0,0, 0,255,0, 0,0,
255,0,0, 255,255,0, 0,0, 255,0,0, 255,255,0, 0,0,
@ -86,7 +92,14 @@ static void test_decode_24bpp(void)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad); hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad);
ok(hr == S_OK, "Initialize failed, hr=%x\n", hr); ok(hr == S_OK || broken(hr == WINCODEC_ERR_BADIMAGE) /* XP */, "Initialize failed, hr=%x\n", hr);
if (FAILED(hr))
{
win_skip("BMP decoder failed to initialize\n");
GlobalFree(hbmpdata);
IWICBitmapDecoder_Release(decoder);
return;
}
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult); hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr); ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
@ -125,7 +138,9 @@ static void test_decode_24bpp(void)
hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY); hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr); ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
todo_wine
ok(dpiX == 96.0, "expected dpiX=96.0, got %f\n", dpiX); ok(dpiX == 96.0, "expected dpiX=96.0, got %f\n", dpiX);
todo_wine
ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY); ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY);
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult); hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);

View File

@ -213,6 +213,7 @@ cpp_quote("#define WINCODEC_ERR_PROPERTYNOTFOUND 0x88982f40")
cpp_quote("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44") cpp_quote("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44")
cpp_quote("#define WINCODEC_ERR_PALETTEUNAVAILABLE 0x88982f45") cpp_quote("#define WINCODEC_ERR_PALETTEUNAVAILABLE 0x88982f45")
cpp_quote("#define WINCODEC_ERR_COMPONENTNOTFOUND 0x88982f50") cpp_quote("#define WINCODEC_ERR_COMPONENTNOTFOUND 0x88982f50")
cpp_quote("#define WINCODEC_ERR_BADIMAGE 0x88982f60")
cpp_quote("#define WINCODEC_ERR_FRAMEMISSING 0x88982f62") cpp_quote("#define WINCODEC_ERR_FRAMEMISSING 0x88982f62")
cpp_quote("#define WINCODEC_ERR_BADMETADATAHEADER 0x88982f63") cpp_quote("#define WINCODEC_ERR_BADMETADATAHEADER 0x88982f63")
cpp_quote("#define WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT 0x88982f80") cpp_quote("#define WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT 0x88982f80")