From fb57a6637836c0f435d3b4224b95a4a3f2581874 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 27 Aug 2008 23:30:55 +0400 Subject: [PATCH] gdiplus: Implemented GdipIsEmptyRegion with tests. --- dlls/gdiplus/region.c | 9 ++++++-- dlls/gdiplus/tests/region.c | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c index 5f40dfe860d..e97dc62c9ab 100644 --- a/dlls/gdiplus/region.c +++ b/dlls/gdiplus/region.c @@ -735,9 +735,14 @@ GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HR GpStatus WINGDIPAPI GdipIsEmptyRegion(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 == RegionDataEmptyRect); + + return Ok; } GpStatus WINGDIPAPI GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGraphics *graphics, diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c index b207f3f579b..550730aa0b3 100644 --- a/dlls/gdiplus/tests/region.c +++ b/dlls/gdiplus/tests/region.c @@ -506,6 +506,50 @@ static void test_isinfinite(void) GdipDeleteMatrix(m); GdipDeleteRegion(region); + GdipDeleteGraphics(graphics); + ReleaseDC(0, hdc); +} + +static void test_isempty(void) +{ + GpStatus status; + GpRegion *region; + GpGraphics *graphics = NULL; + HDC hdc = GetDC(0); + BOOL res; + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + GdipCreateRegion(®ion); + + /* NULL arguments */ + status = GdipIsEmptyRegion(NULL, NULL, NULL); + expect(InvalidParameter, status); + status = GdipIsEmptyRegion(region, NULL, NULL); + expect(InvalidParameter, status); + status = GdipIsEmptyRegion(NULL, graphics, NULL); + expect(InvalidParameter, status); + status = GdipIsEmptyRegion(NULL, NULL, &res); + expect(InvalidParameter, status); + status = GdipIsEmptyRegion(region, NULL, &res); + expect(InvalidParameter, status); + + /* default is infinite */ + res = TRUE; + status = GdipIsEmptyRegion(region, graphics, &res); + expect(Ok, status); + expect(FALSE, res); + + status = GdipSetEmpty(region); + expect(Ok, status); + + res = FALSE; + status = GdipIsEmptyRegion(region, graphics, &res); + expect(Ok, status); + expect(TRUE, res); + + GdipDeleteRegion(region); + GdipDeleteGraphics(graphics); ReleaseDC(0, hdc); } @@ -523,6 +567,7 @@ START_TEST(region) test_getregiondata(); test_isinfinite(); + test_isempty(); GdiplusShutdown(gdiplusToken);