[Gdiplus 09/15] Test for GdipGetRegionBounds

Adam Petaccia adam at tpetaccia.com
Wed Jul 9 02:33:55 CDT 2008


---
 dlls/gdiplus/tests/region.c |   61 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index 166df2d..d4c3ddc 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -23,6 +23,8 @@
 #include "wingdi.h"
 #include "wine/test.h"
 
+#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
+
 static inline void expect_dword(DWORD *value, DWORD expected)
 {
     ok(*value == expected, "expected %08x got %08x\n", expected, *value);
@@ -203,6 +205,64 @@ todo_wine
 
 }
 
+static void test_regionbounds(void)
+{
+    GpStatus stat;
+    GpRegion* region;
+    GpGraphics* graphics;
+    GpPath* path;
+    HDC hdc;
+    RectF rect;
+
+    hdc = GetDC(0);
+    GdipCreateFromHDC(hdc, &graphics);
+    ReleaseDC(0, hdc);
+
+    rect.X = 5;
+    rect.Y = 7;
+    rect.Width  = 10;
+    rect.Height = 20;
+todo_wine
+{
+    stat = GdipCreateRegionRect(&rect, &region);
+    expect(Ok, stat);
+
+    /* Clear the rect to make sure what we get isn't stale data */
+    ZeroMemory(&rect, sizeof(RectF));
+    stat = GdipGetRegionBounds(region, graphics, &rect);
+    ok(rect.X == 5, "Expected 5 for X, got %f\n", rect.X);
+    ok(rect.Y == 7, "Expected 7 for Y, got %f\n", rect.Y);
+    ok(rect.Width == 10, "Expected a width of 10, got %f\n", rect.Width);
+    ok(rect.Height == 20, "Expected a height of 20, got %f\n", rect.Height);
+    stat = GdipDeleteRegion(region);
+    expect(Ok, stat);
+}
+
+    stat = GdipCreatePath(FillModeAlternate, &path);
+    expect(Ok, stat);
+    stat = GdipAddPathLine(path, 5, 1, 9, 4);
+    expect(Ok, stat);
+    stat = GdipAddPathLine(path, 9, 4, 1, 4);
+    expect(Ok, stat);
+    stat = GdipAddPathLine(path, 1, 4, 5, 1);
+    expect(Ok, stat);
+todo_wine
+{
+    stat = GdipCreateRegionPath(path, &region);
+    expect(Ok, stat);
+    stat = GdipGetRegionBounds(region, graphics, &rect);
+    expect(Ok, stat);
+    ok(rect.X == 1, "Expected 0 for X, got %f\n", rect.X);
+    ok(rect.Y == 1, "Expected 0 for Y, got %f\n", rect.Y);
+    ok(rect.Width == 8, "Expected 0 for Width, got %f\n", rect.Width);
+    ok(rect.Height == 3, "Expected 0 for Height, got %f\n", rect.Height);
+}
+
+    GdipDeleteGraphics(graphics);
+    GdipDeletePath(path);
+    GdipDeleteRegion(region);
+}
+
 START_TEST(region)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -216,6 +276,7 @@ START_TEST(region)
     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
 
     test_create_rgn();
+    test_regionbounds();
 
     GdiplusShutdown(gdiplusToken);
 
-- 
1.5.4.3




More information about the wine-patches mailing list