Dmitry Timoshkov : gdiplus: Add a test for palette associated with black&white TIFF image.

Alexandre Julliard julliard at winehq.org
Thu Jul 12 18:00:33 CDT 2012


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Jul 12 19:13:15 2012 +0900

gdiplus: Add a test for palette associated with black&white TIFF image.

---

 dlls/gdiplus/tests/image.c |   48 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index c001a86..29182aa 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -3295,6 +3295,53 @@ static void test_GdipGetAllPropertyItems(void)
     GdipDisposeImage(image);
 }
 
+static void test_tiff_palette(void)
+{
+    GpStatus status;
+    GpImage *image;
+    PixelFormat format;
+    INT size;
+    struct
+    {
+        ColorPalette pal;
+        ARGB entry[256];
+    } palette;
+
+    /* 1bpp TIFF without palette */
+    image = load_image((const BYTE *)&TIFF_data, sizeof(TIFF_data));
+    ok(image != 0, "Failed to load TIFF image data\n");
+    if (!image) return;
+
+    status = GdipGetImagePixelFormat(image, &format);
+    expect(Ok, status);
+todo_wine
+    ok(format == PixelFormat1bppIndexed, "expected PixelFormat1bppIndexed, got %#x\n", format);
+
+    status = GdipGetImagePaletteSize(image, &size);
+    ok(status == Ok || broken(status == GenericError), /* XP */
+       "GdipGetImagePaletteSize error %d\n", status);
+    if (status == GenericError)
+    {
+        GdipDisposeImage(image);
+        return;
+    }
+todo_wine
+    expect(sizeof(ColorPalette) + sizeof(ARGB), size);
+
+    status = GdipGetImagePalette(image, &palette.pal, size);
+    expect(Ok, status);
+    expect(0, palette.pal.Flags);
+todo_wine
+    expect(2, palette.pal.Count);
+    if (palette.pal.Count == 2)
+    {
+        ok(palette.pal.Entries[0] == 0xff000000, "expected 0xff000000, got %#x\n", palette.pal.Entries[0]);
+        ok(palette.pal.Entries[1] == 0xffffffff, "expected 0xffffffff, got %#x\n", palette.pal.Entries[1]);
+    }
+
+    GdipDisposeImage(image);
+}
+
 START_TEST(image)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -3307,6 +3354,7 @@ START_TEST(image)
 
     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
 
+    test_tiff_palette();
     test_GdipGetAllPropertyItems();
     test_tiff_properties();
     test_image_properties();




More information about the wine-cvs mailing list