Dmitry Timoshkov : gdiplus/tests: Add GdipGetClipBounds tests.

Alexandre Julliard julliard at winehq.org
Mon Jul 8 13:50:22 CDT 2013


Module: wine
Branch: master
Commit: e1572f9cd15bb44e1067569a570b19e5f2aee69d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e1572f9cd15bb44e1067569a570b19e5f2aee69d

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Jul  4 18:34:57 2013 +0900

gdiplus/tests: Add GdipGetClipBounds tests.

---

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

diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 6ed1463..e12cac0 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -4521,6 +4521,64 @@ static void test_bitmapfromgraphics(void)
     GdipDisposeImage((GpImage*)bitmap);
 }
 
+static void test_clipping(void)
+{
+    HDC hdc;
+    GpStatus status;
+    GpGraphics *graphics;
+    GpRegion *region;
+    GpMatrix *matrix;
+    GpRectF rect;
+
+    hdc = CreateCompatibleDC(0);
+    status = GdipCreateFromHDC(hdc, &graphics);
+    expect(Ok, status);
+
+    status = GdipCreateRegion(&region);
+    expect(Ok, status);
+    status = GdipSetEmpty(region);
+    expect(Ok, status);
+
+    rect.X = rect.Y = 100.0;
+    rect.Width = rect.Height = 100.0;
+    status = GdipCombineRegionRect(region, &rect, CombineModeUnion);
+    expect(Ok, status);
+    status = GdipSetClipRegion(graphics, region, CombineModeReplace);
+    expect(Ok, status);
+
+    status = GdipGetClipBounds(graphics, &rect);
+    expect(Ok, status);
+    expectf(100.0, rect.X);
+    expectf(100.0, rect.Y);
+    expectf(100.0, rect.Width);
+    expectf(100.0, rect.Height);
+
+    status = GdipCreateMatrix(&matrix);
+    expect(Ok, status);
+    status = GdipScaleMatrix(matrix, 2.0, 4.0, MatrixOrderAppend);
+    expect(Ok, status);
+    status = GdipTranslateMatrix(matrix, 10.0, 20.0, MatrixOrderAppend);
+    expect(Ok, status);
+    status = GdipSetWorldTransform(graphics, matrix);
+    expect(Ok, status);
+
+    status = GdipGetClipBounds(graphics, &rect);
+    expect(Ok, status);
+todo_wine
+    expectf(45.0, rect.X);
+todo_wine
+    expectf(20.0, rect.Y);
+todo_wine
+    expectf(50.0, rect.Width);
+todo_wine
+    expectf(25.0, rect.Height);
+
+    GdipDeleteMatrix(matrix);
+    GdipDeleteRegion(region);
+    GdipDeleteGraphics(graphics);
+    DeleteDC(hdc);
+}
+
 START_TEST(graphics)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -4547,6 +4605,7 @@ START_TEST(graphics)
 
     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
 
+    test_clipping();
     test_measured_extra_space();
     test_measure_string();
     test_font_height_scaling();




More information about the wine-cvs mailing list