gdiplus/test: Add GdipSetImageAttributesRemapTable test and fix typo.

This commit is contained in:
Justin Chevrier 2010-03-03 20:06:32 -05:00 committed by Alexandre Julliard
parent 86292d1dba
commit 74a3945b00
2 changed files with 67 additions and 1 deletions

View file

@ -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);
}

View file

@ -45,7 +45,7 @@ enum ColorAdjustType
struct ColorMap
{
Color oldColor;
Color newCOlor;
Color newColor;
};
#ifndef __cplusplus