Module: wine Branch: master Commit: f71cb580a43903838abcf855281f503edaa8e3d0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f71cb580a43903838abcf85528...
Author: Vincent Povirk vincent@codeweavers.com Date: Sat Dec 26 20:25:01 2009 -0500
gdiplus: Add test for image resolution functions.
---
dlls/gdiplus/tests/image.c | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 67a2fa8..4721a58 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -889,6 +889,69 @@ static void test_createfromwmf(void) GdipDisposeImage(img); }
+static void test_resolution(void) +{ + GpStatus stat; + GpBitmap *bitmap; + REAL res=-1.0; + HDC screendc; + int screenxres, screenyres; + + /* create Bitmap */ + stat = GdipCreateBitmapFromScan0(1, 1, 32, PixelFormat24bppRGB, NULL, &bitmap); + expect(Ok, stat); + + /* test invalid values */ + stat = GdipGetImageHorizontalResolution(NULL, &res); + expect(InvalidParameter, stat); + + stat = GdipGetImageHorizontalResolution((GpImage*)bitmap, NULL); + expect(InvalidParameter, stat); + + stat = GdipGetImageVerticalResolution(NULL, &res); + expect(InvalidParameter, stat); + + stat = GdipGetImageVerticalResolution((GpImage*)bitmap, NULL); + expect(InvalidParameter, stat); + + stat = GdipBitmapSetResolution(NULL, 96.0, 96.0); + todo_wine expect(InvalidParameter, stat); + + stat = GdipBitmapSetResolution(bitmap, 0.0, 0.0); + todo_wine expect(InvalidParameter, stat); + + /* defaults to screen resolution */ + screendc = GetDC(0); + + screenxres = GetDeviceCaps(screendc, LOGPIXELSX); + screenyres = GetDeviceCaps(screendc, LOGPIXELSY); + + ReleaseDC(0, screendc); + + stat = GdipGetImageHorizontalResolution((GpImage*)bitmap, &res); + todo_wine expect(Ok, stat); + todo_wine expectf((REAL)screenxres, res); + + stat = GdipGetImageVerticalResolution((GpImage*)bitmap, &res); + todo_wine expect(Ok, stat); + todo_wine expectf((REAL)screenyres, res); + + /* test changing the resolution */ + stat = GdipBitmapSetResolution(bitmap, screenxres*2.0, screenyres*3.0); + todo_wine expect(Ok, stat); + + stat = GdipGetImageHorizontalResolution((GpImage*)bitmap, &res); + todo_wine expect(Ok, stat); + todo_wine expectf(screenxres*2.0, res); + + stat = GdipGetImageVerticalResolution((GpImage*)bitmap, &res); + todo_wine expect(Ok, stat); + todo_wine expectf(screenyres*3.0, res); + + stat = GdipDisposeImage((GpImage*)bitmap); + expect(Ok, stat); +} + static void test_createhbitmap(void) { GpStatus stat; @@ -1465,6 +1528,7 @@ START_TEST(image) test_getrawformat(); test_loadwmf(); test_createfromwmf(); + test_resolution(); test_createhbitmap(); test_getsetpixel(); test_palette();