[Gdiplus 2/5] Test for GdipGetRegionBounds

Adam Petaccia adam at tpetaccia.com
Sat Aug 16 22:28:08 CDT 2008


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

diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index 0b8ed41..6072840 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -463,6 +463,80 @@ static void test_getregiondata(void)
     expect(Ok, status);
 }
 
+static void test_regionbounds(void)
+{
+    GpStatus stat;
+    GpRegion* region;
+    GpGraphics* graphics;
+    GpPath* path;
+    HDC hdc;
+    RectF rect;
+
+    hdc = GetDC(0);
+    stat = GdipCreateFromHDC(hdc, &graphics);
+    expect(Ok, stat);
+
+    rect.X = 5;
+    rect.Y = 7;
+    rect.Width  = 10;
+    rect.Height = 20;
+    stat = GdipCreateRegionRect(&rect, &region);
+    expect(Ok, stat);
+
+    /* Clear the rect to make sure what we get isn't stale data */
+    memset(&rect, 0xee, sizeof(RectF));
+todo_wine
+{
+    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);
+
+    stat = GdipCreateRegionPath(path, &region);
+    expect(Ok, stat);
+todo_wine
+{
+    stat = GdipGetRegionBounds(region, graphics, &rect);
+    expect(Ok, stat);
+    ok(rect.X == 1, "Expected 1 for X, got %f\n", rect.X);
+    ok(rect.Y == 1, "Expected 1 for Y, got %f\n", rect.Y);
+    ok(rect.Width == 8, "Expected 8 for Width, got %f\n", rect.Width);
+    ok(rect.Height == 3, "Expected 3 for Height, got %f\n", rect.Height);
+}
+
+    GdipDeletePath(path);
+
+    stat = GdipSetEmpty(region);
+    expect(Ok, stat);
+todo_wine
+{
+    stat = GdipGetRegionBounds(region, graphics, &rect);
+    expect(Ok, stat);
+    ok(rect.X == 0, "Expected 0 for X, got %f\n", rect.X);
+    ok(rect.Y == 0, "Expected 0 for Y, got %f\n", rect.Y);
+    ok(rect.Width == 0, "Expected 0 for Width, got %f\n", rect.Width);
+    ok(rect.Height == 0, "Expected 0 for Height, got %f\n", rect.Height);
+}
+
+    GdipDeleteGraphics(graphics);
+    GdipDeleteRegion(region);
+
+    ReleaseDC(0, hdc);
+}
+
 START_TEST(region)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -476,6 +550,7 @@ START_TEST(region)
     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
 
     test_getregiondata();
+    test_regionbounds();
 
     GdiplusShutdown(gdiplusToken);
 
-- 
1.5.4.3




More information about the wine-patches mailing list