From 74a3945b0095b7613d210b9c33ff201d8bebee82 Mon Sep 17 00:00:00 2001 From: Justin Chevrier Date: Wed, 3 Mar 2010 20:06:32 -0500 Subject: [PATCH] gdiplus/test: Add GdipSetImageAttributesRemapTable test and fix typo. --- dlls/gdiplus/tests/image.c | 66 ++++++++++++++++++++++++++++++++++++ include/gdipluscolormatrix.h | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 9d5c0512fd0..2e3bd74aa29 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -1745,6 +1745,71 @@ static void test_rotateflip(void) GdipDisposeImage(bitmap); } +static void test_remaptable(void) +{ + GpStatus stat; + GpImageAttributes *imageattr; + GpBitmap *bitmap1, *bitmap2; + GpGraphics *graphics; + ARGB color; + ColorMap *map; + + map = GdipAlloc(sizeof(ColorMap)); + + map->oldColor.Argb = 0xff00ff00; + map->newColor.Argb = 0xffff00ff; + + stat = GdipSetImageAttributesRemapTable(NULL, ColorAdjustTypeDefault, TRUE, 1, map); + todo_wine expect(InvalidParameter, stat); + + stat = GdipCreateImageAttributes(&imageattr); + expect(Ok, stat); + + stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 1, NULL); + todo_wine expect(InvalidParameter, stat); + + stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeCount, TRUE, 1, map); + todo_wine expect(InvalidParameter, stat); + + stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeAny, TRUE, 1, map); + todo_wine expect(InvalidParameter, stat); + + stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 0, map); + todo_wine expect(InvalidParameter, stat); + + stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, FALSE, 0, NULL); + todo_wine expect(Ok, stat); + + stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 1, map); + todo_wine expect(Ok, stat); + + stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1); + expect(Ok, stat); + + stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap2); + expect(Ok, stat); + + stat = GdipBitmapSetPixel(bitmap1, 0, 0, 0xff00ff00); + expect(Ok, stat); + + stat = GdipGetImageGraphicsContext((GpImage*)bitmap2, &graphics); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + todo_wine ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color); + + GdipDeleteGraphics(graphics); + GdipDisposeImage((GpImage*)bitmap1); + GdipDisposeImage((GpImage*)bitmap2); + GdipDisposeImageAttributes(imageattr); + GdipFree(map); +} + START_TEST(image) { struct GdiplusStartupInput gdiplusStartupInput; @@ -1780,6 +1845,7 @@ START_TEST(image) test_gamma(); test_multiframegif(); test_rotateflip(); + test_remaptable(); GdiplusShutdown(gdiplusToken); } diff --git a/include/gdipluscolormatrix.h b/include/gdipluscolormatrix.h index 532e8f4c788..fbf1b2a402f 100644 --- a/include/gdipluscolormatrix.h +++ b/include/gdipluscolormatrix.h @@ -45,7 +45,7 @@ enum ColorAdjustType struct ColorMap { Color oldColor; - Color newCOlor; + Color newColor; }; #ifndef __cplusplus