summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-01-17 11:22:19 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-01-17 11:50:51 +0000
commitda9c43329ad09ccf48f8a71d28848f111af7ecb5 (patch)
treec86c508f04e291a83aae4655c96aaa143e84878a
parentf638e5ea355cf0268a4b099ce7b8b98c69df6b67 (diff)
[test/in-fill-trapezoid] Add test to exercise _cairo_trap_contains().
A simple test to provide coverage of _cairo_trap_contains(), though not yet seeking boundary conditions.
-rw-r--r--test/.gitignore1
-rw-r--r--test/Makefile.am1
-rw-r--r--test/in-fill-trapezoid.c66
3 files changed, 68 insertions, 0 deletions
diff --git a/test/.gitignore b/test/.gitignore
index 2aaf613b..0d4b86c8 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -71,6 +71,7 @@ gradient-zero-stops
imagediff
infinite-join
in-fill-empty-trapezoid
+in-fill-trapezoid
invalid-matrix
leaky-dash
leaky-polygon
diff --git a/test/Makefile.am b/test/Makefile.am
index b110c8d6..12d89abe 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,6 +54,7 @@ gradient-alpha$(EXEEXT) \
gradient-zero-stops$(EXEEXT) \
infinite-join$(EXEEXT) \
in-fill-empty-trapezoid$(EXEEXT) \
+in-fill-trapezoid$(EXEEXT) \
invalid-matrix$(EXEEXT) \
leaky-dash$(EXEEXT) \
leaky-polygon$(EXEEXT) \
diff --git a/test/in-fill-trapezoid.c b/test/in-fill-trapezoid.c
new file mode 100644
index 00000000..0e9f0582
--- /dev/null
+++ b/test/in-fill-trapezoid.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2008 Chris Wilson
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Chris Wilson <chris@chris-wilson.co.uk>
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_draw_function_t draw;
+
+cairo_test_t test = {
+ "in-fill-trapezoid",
+ "Test _cairo_trap_contains via cairo_in_fill",
+ 0, 0,
+ draw
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_test_status_t ret = CAIRO_TEST_SUCCESS;
+
+ /* simple rectangle */
+ cairo_new_path (cr);
+ cairo_rectangle (cr, -10, -10, 20, 20);
+ if (! cairo_in_fill (cr, 0, 0)) {
+ cairo_test_log ("Error: Failed to find point inside rectangle\n");
+ ret = CAIRO_TEST_FAILURE;
+ }
+
+ /* simple circle */
+ cairo_new_path (cr);
+ cairo_arc (cr, 0, 0, 10, 0, 2 * M_PI);
+ if (! cairo_in_fill (cr, 0, 0)) {
+ cairo_test_log ("Error: Failed to find point inside circle\n");
+ ret = CAIRO_TEST_FAILURE;
+ }
+
+ return ret;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}