Vincent Povirk : gdiplus: Add tests for image palette size.

Alexandre Julliard julliard at winehq.org
Fri May 15 16:55:06 CDT 2020


Module: wine
Branch: master
Commit: 606ba15ac57e33641503a38a4f00c1ce3feb96a7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=606ba15ac57e33641503a38a4f00c1ce3feb96a7

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu May 14 20:51:11 2020 -0500

gdiplus: Add tests for image palette size.

Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/tests/image.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index f63346e1db..de6fad093d 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -3583,20 +3583,22 @@ static void test_image_properties(void)
         UINT prop_size2; /* if win7 behaves differently */
         UINT prop_id;
         UINT prop_id2; /* if win7 behaves differently */
+        INT palette_size;
     }
     td[] =
     {
-        { pngimage, sizeof(pngimage), ImageTypeBitmap, 4, ~0, 1, 20, 0x5110, 0x132 },
-        { jpgimage, sizeof(jpgimage), ImageTypeBitmap, 2, ~0, 128, 0, 0x5090, 0x5091 },
-        { tiffimage, sizeof(tiffimage), ImageTypeBitmap, 16, 0, 4, 0, 0xfe, 0 },
-        { bmpimage, sizeof(bmpimage), ImageTypeBitmap, 0, 0, 0, 0, 0, 0 },
-        { wmfimage, sizeof(wmfimage), ImageTypeMetafile, 0, 0, 0, 0, 0, 0 }
+        { pngimage, sizeof(pngimage), ImageTypeBitmap, 4, ~0, 1, 20, 0x5110, 0x132, 12 },
+        { jpgimage, sizeof(jpgimage), ImageTypeBitmap, 2, ~0, 128, 0, 0x5090, 0x5091, 12 },
+        { tiffimage, sizeof(tiffimage), ImageTypeBitmap, 16, 0, 4, 0, 0xfe, 0, 12 },
+        { bmpimage, sizeof(bmpimage), ImageTypeBitmap, 0, 0, 0, 0, 0, 0, 16 },
+        { wmfimage, sizeof(wmfimage), ImageTypeMetafile, 0, 0, 0, 0, 0, 0, -GenericError }
     };
     GpStatus status;
     GpImage *image;
     UINT prop_count, prop_size, i;
     PROPID prop_id[16] = { 0 };
     ImageType image_type;
+    INT palette_size;
     union
     {
         PropertyItem data;
@@ -3617,6 +3619,21 @@ static void test_image_properties(void)
         ok(td[i].image_type == image_type, "%u: expected image_type %d, got %d\n",
            i, td[i].image_type, image_type);
 
+        palette_size = -1;
+        status = GdipGetImagePaletteSize(image, &palette_size);
+        if (td[i].palette_size >= 0)
+        {
+            ok(status == Ok, "%u: GdipGetImagePaletteSize error %d\n", i, status);
+            ok(td[i].palette_size == palette_size, "%u: expected palette_size %d, got %d\n",
+               i, td[i].palette_size, palette_size);
+        }
+        else
+        {
+            ok(status == -td[i].palette_size, "%u: GdipGetImagePaletteSize returned %d\n", i, status);
+            ok(palette_size == 0, "%u: expected palette_size 0, got %d\n",
+               i, palette_size);
+        }
+
         status = GdipGetPropertyCount(image, &prop_count);
         ok(status == Ok, "%u: GdipGetPropertyCount error %d\n", i, status);
         todo_wine_if(td[i].image_data == pngimage || td[i].image_data == jpgimage)




More information about the wine-cvs mailing list