[PATCH v2 1/2] gdi32: Add tests for CreatePolyPolygonRgn
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> --- dlls/gdi32/tests/clipping.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/dlls/gdi32/tests/clipping.c b/dlls/gdi32/tests/clipping.c index 60bd31e8e4..5a8a8b0c2a 100644 --- a/dlls/gdi32/tests/clipping.c +++ b/dlls/gdi32/tests/clipping.c @@ -533,6 +533,38 @@ static void test_window_dc_clipping(void) DestroyWindow(hwnd); } +static void test_CreatePolyPolygonRgn(void) +{ + HRGN region; + POINT points_zero[] = { {0, 0}, {0, 0}, {0, 0} }; + POINT points_mixed[] = { {0, 0}, {0, 0}, {0, 0}, {6, 6}, {6, 6}, {6, 6} }; + POINT points_six[] = { {6, 6}, {6, 6}, {6, 6} }; + POINT points_line[] = { {1, 0}, {11, 0}, {21, 0}}; + INT counts_single_poly[] = { 3 }; + INT counts_two_poly[] = { 3, 3 }; + + /* When all polygons are just one point or line, return must not be NULL */ + + region = CreatePolyPolygonRgn(points_zero, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE); + todo_wine + ok (region != NULL, "region must not be NULL\n"); + DeleteObject(region); + + region = CreatePolyPolygonRgn(points_six, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE); + todo_wine + ok (region != NULL, "region must not be NULL\n"); + DeleteObject(region); + + region = CreatePolyPolygonRgn(points_line, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE); + todo_wine + ok (region != NULL, "region must not be NULL\n"); + DeleteObject(region); + + region = CreatePolyPolygonRgn(points_mixed, counts_two_poly, ARRAY_SIZE(counts_two_poly), ALTERNATE); + todo_wine + ok (region != NULL, "region must not be NULL\n"); + DeleteObject(region); +} START_TEST(clipping) { @@ -541,4 +573,5 @@ START_TEST(clipping) test_GetClipRgn(); test_memory_dc_clipping(); test_window_dc_clipping(); + test_CreatePolyPolygonRgn(); } -- 2.21.0
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46655 Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> --- dlls/gdi32/region.c | 3 +-- dlls/gdi32/tests/clipping.c | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/dlls/gdi32/region.c b/dlls/gdi32/region.c index cad6428dc9..93238b5a84 100644 --- a/dlls/gdi32/region.c +++ b/dlls/gdi32/region.c @@ -2627,8 +2627,7 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo if (! (pETEs = HeapAlloc( GetProcessHeap(), 0, sizeof(EdgeTableEntry) * total ))) return 0; - if (!(nb_points = REGION_CreateEdgeTable( Count, nbpolygons, Pts, &ET, pETEs, &SLLBlock, clip_rect ))) - goto done; + nb_points = REGION_CreateEdgeTable( Count, nbpolygons, Pts, &ET, pETEs, &SLLBlock, clip_rect ); if (!(obj = alloc_region( nb_points / 2 ))) goto done; diff --git a/dlls/gdi32/tests/clipping.c b/dlls/gdi32/tests/clipping.c index 5a8a8b0c2a..4d68bad0dd 100644 --- a/dlls/gdi32/tests/clipping.c +++ b/dlls/gdi32/tests/clipping.c @@ -546,22 +546,18 @@ static void test_CreatePolyPolygonRgn(void) /* When all polygons are just one point or line, return must not be NULL */ region = CreatePolyPolygonRgn(points_zero, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE); - todo_wine ok (region != NULL, "region must not be NULL\n"); DeleteObject(region); region = CreatePolyPolygonRgn(points_six, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE); - todo_wine ok (region != NULL, "region must not be NULL\n"); DeleteObject(region); region = CreatePolyPolygonRgn(points_line, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE); - todo_wine ok (region != NULL, "region must not be NULL\n"); DeleteObject(region); region = CreatePolyPolygonRgn(points_mixed, counts_two_poly, ARRAY_SIZE(counts_two_poly), ALTERNATE); - todo_wine ok (region != NULL, "region must not be NULL\n"); DeleteObject(region); } -- 2.21.0
On Sun, May 19, 2019 at 04:31:45PM +0200, Fabian Maurer wrote:
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> --- dlls/gdi32/tests/clipping.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
diff --git a/dlls/gdi32/tests/clipping.c b/dlls/gdi32/tests/clipping.c index 60bd31e8e4..5a8a8b0c2a 100644 --- a/dlls/gdi32/tests/clipping.c +++ b/dlls/gdi32/tests/clipping.c @@ -533,6 +533,38 @@ static void test_window_dc_clipping(void) DestroyWindow(hwnd); }
+static void test_CreatePolyPolygonRgn(void) +{ + HRGN region; + POINT points_zero[] = { {0, 0}, {0, 0}, {0, 0} }; + POINT points_mixed[] = { {0, 0}, {0, 0}, {0, 0}, {6, 6}, {6, 6}, {6, 6} }; + POINT points_six[] = { {6, 6}, {6, 6}, {6, 6} }; + POINT points_line[] = { {1, 0}, {11, 0}, {21, 0}}; + INT counts_single_poly[] = { 3 }; + INT counts_two_poly[] = { 3, 3 }; + + /* When all polygons are just one point or line, return must not be NULL */ + + region = CreatePolyPolygonRgn(points_zero, counts_single_poly, ARRAY_SIZE(counts_single_poly), ALTERNATE); + todo_wine + ok (region != NULL, "region must not be NULL\n");
It would be good to check the GetRgnBox() returns an empty rectangle. Also, since the implementation change is so small, merging these two patches together would probably be simpler. Huw.
participants (2)
-
Fabian Maurer -
Huw Davies