From 078c6a39255f56a4fe6d0a7ec477f1b15a402130 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 26 Aug 2008 01:58:49 +0400 Subject: [PATCH] gdiplus: Implemented GdipIsInfiniteRegion with tests. --- dlls/gdiplus/region.c | 10 ++++++-- dlls/gdiplus/tests/graphics.c | 8 ++++-- dlls/gdiplus/tests/region.c | 47 +++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c index 11b5aa66bb..45d0e51fac 100644 --- a/dlls/gdiplus/region.c +++ b/dlls/gdiplus/region.c @@ -770,11 +770,17 @@ GpStatus WINGDIPAPI GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGra return NotImplemented; } +/* I think graphics is ignored here */ GpStatus WINGDIPAPI GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, BOOL *res) { - FIXME("(%p, %p, %p): stub\n", region, graphics, res); + TRACE("(%p, %p, %p)\n", region, graphics, res); - return NotImplemented; + if(!region || !graphics || !res) + return InvalidParameter; + + *res = (region->node.type == RegionDataInfiniteRect); + + return Ok; } GpStatus WINGDIPAPI GdipSetEmpty(GpRegion *region) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index b0ed5c06c2..082ffe80e6 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -770,12 +770,16 @@ static void test_getclip(void) GpGraphics *graphics = NULL; HDC hdc = GetDC(0); GpRegion *clip; + GpRectF rect; BOOL res; status = GdipCreateFromHDC(hdc, &graphics); expect(Ok, status); - status = GdipCreateRegion(&clip); + rect.X = rect.Y = 0.0; + rect.Height = rect.Width = 100.0; + + status = GdipCreateRegionRect(&rect, &clip); /* NULL arguments */ status = GdipGetClip(NULL, NULL); @@ -789,7 +793,7 @@ static void test_getclip(void) status = GdipGetClip(graphics, clip); todo_wine expect(Ok, status); status = GdipIsInfiniteRegion(clip, graphics, &res); - todo_wine expect(Ok, status); + expect(Ok, status); todo_wine expect(TRUE, res); GdipDeleteRegion(clip); diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c index 0b8ed4160f..b207f3f579 100644 --- a/dlls/gdiplus/tests/region.c +++ b/dlls/gdiplus/tests/region.c @@ -463,6 +463,52 @@ static void test_getregiondata(void) expect(Ok, status); } +static void test_isinfinite(void) +{ + GpStatus status; + GpRegion *region; + GpGraphics *graphics = NULL; + GpMatrix *m; + HDC hdc = GetDC(0); + BOOL res; + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + GdipCreateRegion(®ion); + + GdipCreateMatrix2(3.0, 0.0, 0.0, 1.0, 20.0, 30.0, &m); + + /* NULL arguments */ + status = GdipIsInfiniteRegion(NULL, NULL, NULL); + expect(InvalidParameter, status); + status = GdipIsInfiniteRegion(region, NULL, NULL); + expect(InvalidParameter, status); + status = GdipIsInfiniteRegion(NULL, graphics, NULL); + expect(InvalidParameter, status); + status = GdipIsInfiniteRegion(NULL, NULL, &res); + expect(InvalidParameter, status); + status = GdipIsInfiniteRegion(region, NULL, &res); + expect(InvalidParameter, status); + + res = FALSE; + status = GdipIsInfiniteRegion(region, graphics, &res); + expect(Ok, status); + expect(TRUE, res); + + /* after world transform */ + status = GdipSetWorldTransform(graphics, m); + expect(Ok, status); + + res = FALSE; + status = GdipIsInfiniteRegion(region, graphics, &res); + expect(Ok, status); + expect(TRUE, res); + + GdipDeleteMatrix(m); + GdipDeleteRegion(region); + ReleaseDC(0, hdc); +} + START_TEST(region) { struct GdiplusStartupInput gdiplusStartupInput; @@ -476,6 +522,7 @@ START_TEST(region) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); test_getregiondata(); + test_isinfinite(); GdiplusShutdown(gdiplusToken);