summaryrefslogtreecommitdiff
path: root/test/get-path-extents.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2008-01-21 16:45:41 -0800
committerCarl Worth <cworth@cworth.org>2008-01-21 16:45:41 -0800
commit47cf7ed769891b00abf96d14de6e79c0fa893cf9 (patch)
treeb515f70c424064f844f04dd3a9f3f553eefffe22 /test/get-path-extents.c
parent1ca186f51134e7d5969937760b068caba0070d31 (diff)
downloadcairo-47cf7ed769891b00abf96d14de6e79c0fa893cf9.tar.gz
Test and document that fill rule has no effect on cairo_path_extents
Diffstat (limited to 'test/get-path-extents.c')
-rw-r--r--test/get-path-extents.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/get-path-extents.c b/test/get-path-extents.c
index 5e82c1eac..12901fd05 100644
--- a/test/get-path-extents.c
+++ b/test/get-path-extents.c
@@ -244,6 +244,55 @@ draw (cairo_t *cr, int width, int height)
cairo_new_path (cr2);
cairo_restore (cr2);
+ cairo_save (cr2);
+
+ cairo_set_line_width (cr2, 4);
+
+ cairo_rectangle (cr2, 10, 10, 30, 30);
+ cairo_rectangle (cr2, 25, 10, 15, 30);
+
+ cairo_set_fill_rule (cr2, CAIRO_FILL_RULE_EVEN_ODD);
+ phase = "EVEN_ODD overlapping rectangles";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 15, 30) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 8, 8, 34, 34) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 30, 30))
+ ret = CAIRO_TEST_FAILURE;
+
+ /* Test other fill rule with the same path. */
+
+ cairo_set_fill_rule (cr2, CAIRO_FILL_RULE_WINDING);
+ phase = "WINDING overlapping rectangles";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 30, 30) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 8, 8, 34, 34) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 30, 30))
+ ret = CAIRO_TEST_FAILURE;
+
+ /* Now, change the direction of the second rectangle and test both
+ * fill rules again. */
+ cairo_new_path (cr2);
+ cairo_rectangle (cr2, 10, 10, 30, 30);
+ cairo_rectangle (cr2, 25, 40, 15, -30);
+
+ cairo_set_fill_rule (cr2, CAIRO_FILL_RULE_EVEN_ODD);
+ phase = "EVEN_ODD overlapping rectangles";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 15, 30) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 8, 8, 34, 34) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 30, 30))
+ ret = CAIRO_TEST_FAILURE;
+
+ /* Test other fill rule with the same path. */
+
+ cairo_set_fill_rule (cr2, CAIRO_FILL_RULE_WINDING);
+ phase = "WINDING overlapping rectangles";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 15, 30) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 8, 8, 34, 34) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 30, 30))
+ ret = CAIRO_TEST_FAILURE;
+
+ cairo_new_path (cr2);
+
+ cairo_restore (cr2);
+
/* http://bugs.freedesktop.org/show_bug.cgi?id=7245 */
phase = "Arc";
cairo_save (cr2);