Module: wine Branch: master Commit: e1cb441781c79d9fedf8490ebfcb0fcfe1846086 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e1cb441781c79d9fedf8490ebf...
Author: Vincent Povirk vincent@codeweavers.com Date: Wed Sep 23 10:41:06 2009 -0500
gdiplus: Add tests for GdipBitmap(Get|Set)Pixel.
---
dlls/gdiplus/tests/image.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 5378cb8..d32b9f8 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -799,6 +799,79 @@ static void test_createhbitmap(void) expect(Ok, stat); }
+static void test_getsetpixel(void) +{ + GpStatus stat; + GpBitmap *bitmap; + ARGB color; + BYTE bits[16] = {0x00,0x00,0x00,0x00, 0x00,0xff,0xff,0x00, + 0xff,0x00,0x00,0x00, 0xff,0xff,0xff,0x00}; + + stat = GdipCreateBitmapFromScan0(2, 2, 8, PixelFormat32bppRGB, bits, &bitmap); + expect(Ok, stat); + + /* null parameters */ + stat = GdipBitmapGetPixel(NULL, 1, 1, &color); + expect(InvalidParameter, stat); + + stat = GdipBitmapGetPixel(bitmap, 1, 1, NULL); + expect(InvalidParameter, stat); + + stat = GdipBitmapSetPixel(NULL, 1, 1, 0); + expect(InvalidParameter, stat); + + /* out of bounds */ + stat = GdipBitmapGetPixel(bitmap, -1, 1, &color); + todo_wine expect(InvalidParameter, stat); + + stat = GdipBitmapSetPixel(bitmap, -1, 1, 0); + todo_wine expect(InvalidParameter, stat); + + stat = GdipBitmapGetPixel(bitmap, 1, -1, &color); + todo_wine expect(InvalidParameter, stat); + + stat = GdipBitmapSetPixel(bitmap, 1, -1, 0); + todo_wine expect(InvalidParameter, stat); + + stat = GdipBitmapGetPixel(bitmap, 2, 1, &color); + todo_wine expect(InvalidParameter, stat); + + stat = GdipBitmapSetPixel(bitmap, 2, 1, 0); + todo_wine expect(InvalidParameter, stat); + + stat = GdipBitmapGetPixel(bitmap, 1, 2, &color); + todo_wine expect(InvalidParameter, stat); + + stat = GdipBitmapSetPixel(bitmap, 1, 2, 0); + todo_wine expect(InvalidParameter, stat); + + /* valid use */ + stat = GdipBitmapGetPixel(bitmap, 1, 1, &color); + todo_wine expect(Ok, stat); + todo_wine expect(0xffffffff, color); + + stat = GdipBitmapGetPixel(bitmap, 0, 1, &color); + todo_wine expect(Ok, stat); + todo_wine expect(0xff0000ff, color); + + stat = GdipBitmapSetPixel(bitmap, 1, 1, 0xff676869); + todo_wine expect(Ok, stat); + + stat = GdipBitmapSetPixel(bitmap, 0, 0, 0xff474849); + todo_wine expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap, 1, 1, &color); + todo_wine expect(Ok, stat); + todo_wine expect(0xff676869, color); + + stat = GdipBitmapGetPixel(bitmap, 0, 0, &color); + todo_wine expect(Ok, stat); + todo_wine expect(0xff474849, color); + + stat = GdipDisposeImage((GpImage*)bitmap); + expect(Ok, stat); +} + START_TEST(image) { struct GdiplusStartupInput gdiplusStartupInput; @@ -825,6 +898,7 @@ START_TEST(image) test_fromhicon(); test_getrawformat(); test_createhbitmap(); + test_getsetpixel();
GdiplusShutdown(gdiplusToken); }