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

Alexandre Julliard julliard at winehq.org
Wed Jan 9 13:30:37 CST 2013


Module: wine
Branch: master
Commit: 01ab797b64300f21dada7973c4278f3eab6dc342
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=01ab797b64300f21dada7973c4278f3eab6dc342

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Jan  9 15:46:23 2013 +0800

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

---

 dlls/windowscodecs/tests/bmpformat.c |   29 ++++++++++++++++++++++-------
 include/wincodec.idl                 |    1 +
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c
index 39820b3..5140577 100644
--- a/dlls/windowscodecs/tests/bmpformat.c
+++ b/dlls/windowscodecs/tests/bmpformat.c
@@ -31,15 +31,21 @@
 static const char testbmp_24bpp[] = {
     /* BITMAPFILEHEADER */
     66,77, /* "BM" */
-    50,0,0,0, /* file size */
+    78,0,0,0, /* file size */
     0,0,0,0, /* reserved */
-    26,0,0,0, /* offset to bits */
-    /* BITMAPCOREHEADER */
-    12,0,0,0, /* header size */
-    2,0, /* width */
-    3,0, /* height */
+    54,0,0,0, /* offset to bits */
+    /* BITMAPINFOHEADER */
+    40,0,0,0, /* header size */
+    2,0,0,0, /* width */
+    3,0,0,0, /* height */
     1,0, /* planes */
     24,0, /* bit count */
+    0,0,0,0, /* compression */
+    0,0,0,0, /* image size */
+    0x74,0x12,0,0, /* X pels per meter => 120 dpi */
+    0,0,0,0, /* Y pels per meter */
+    0,0,0,0, /* colors used */
+    0,0,0,0, /* colors important */
     /* bits */
     0,0,0,     0,255,0,     0,0,
     255,0,0,   255,255,0,   0,0,
@@ -86,7 +92,14 @@ static void test_decode_24bpp(void)
         if (SUCCEEDED(hr))
         {
             hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad);
-            ok(hr == S_OK, "Initialize failed, hr=%x\n", hr);
+            ok(hr == S_OK || broken(hr == WINCODEC_ERR_BADIMAGE) /* XP */, "Initialize failed, hr=%x\n", hr);
+            if (FAILED(hr))
+            {
+                win_skip("BMP decoder failed to initialize\n");
+                GlobalFree(hbmpdata);
+                IWICBitmapDecoder_Release(decoder);
+                return;
+            }
 
             hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
             ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr);
@@ -125,7 +138,9 @@ static void test_decode_24bpp(void)
 
                 hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
                 ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
+todo_wine
                 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);
 
                 hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
diff --git a/include/wincodec.idl b/include/wincodec.idl
index b4f2a6a..c727bf3 100644
--- a/include/wincodec.idl
+++ b/include/wincodec.idl
@@ -213,6 +213,7 @@ cpp_quote("#define WINCODEC_ERR_PROPERTYNOTFOUND 0x88982f40")
 cpp_quote("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44")
 cpp_quote("#define WINCODEC_ERR_PALETTEUNAVAILABLE 0x88982f45")
 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_BADMETADATAHEADER 0x88982f63")
 cpp_quote("#define WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT 0x88982f80")




More information about the wine-cvs mailing list