Justin Chevrier : gdiplus/test: Add GdipSetImageAttributesRemapTable test and fix typo.

Alexandre Julliard julliard at winehq.org
Thu Mar 4 11:21:41 CST 2010


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

Author: Justin Chevrier <jchevrier at gmail.com>
Date:   Wed Mar  3 20:06:32 2010 -0500

gdiplus/test: Add GdipSetImageAttributesRemapTable test and fix typo.

---

 dlls/gdiplus/tests/image.c   |   66 ++++++++++++++++++++++++++++++++++++++++++
 include/gdipluscolormatrix.h |    2 +-
 2 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 9d5c051..2e3bd74 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 532e8f4..fbf1b2a 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




More information about the wine-cvs mailing list