[PATCH 1/2] gdi32: Add tests for CreatePolyPolygonRgn

Fabian Maurer dark.shadow4 at web.de
Sun May 19 07:05:41 CDT 2019


Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/gdi32/tests/Makefile.in |  3 +-
 dlls/gdi32/tests/region.c    | 68 ++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 dlls/gdi32/tests/region.c

diff --git a/dlls/gdi32/tests/Makefile.in b/dlls/gdi32/tests/Makefile.in
index 90d7223f47..e97df6f843 100644
--- a/dlls/gdi32/tests/Makefile.in
+++ b/dlls/gdi32/tests/Makefile.in
@@ -15,7 +15,8 @@ C_SRCS = \
 	metafile.c \
 	palette.c \
 	path.c \
-	pen.c
+	pen.c \
+	region.c

 FONT_SRCS = \
 	vertical.sfd \
diff --git a/dlls/gdi32/tests/region.c b/dlls/gdi32/tests/region.c
new file mode 100644
index 0000000000..90f91d4440
--- /dev/null
+++ b/dlls/gdi32/tests/region.c
@@ -0,0 +1,68 @@
+/*
+ * Unit test suite for region
+ *
+ * Copyright 2019 Fabian Maurer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+
+#include "wine/heap.h"
+#include "wine/test.h"
+
+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(region)
+{
+    test_CreatePolyPolygonRgn();
+}
--
2.21.0




More information about the wine-devel mailing list