From 390e22894b093184e489ea762ffc29eeb1c81d2b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 17 Jan 2008 13:13:40 +0000 Subject: [PATCH] [test/in-fill-trapezoid] Add a few holes. Complete the coverage of _cairo_trap_contains() by cutting holes out of the simple shapes. --- test/in-fill-trapezoid.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/in-fill-trapezoid.c b/test/in-fill-trapezoid.c index 0e9f0582d..a544e4392 100644 --- a/test/in-fill-trapezoid.c +++ b/test/in-fill-trapezoid.c @@ -40,6 +40,8 @@ draw (cairo_t *cr, int width, int height) { cairo_test_status_t ret = CAIRO_TEST_SUCCESS; + cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); + /* simple rectangle */ cairo_new_path (cr); cairo_rectangle (cr, -10, -10, 20, 20); @@ -56,6 +58,24 @@ draw (cairo_t *cr, int width, int height) ret = CAIRO_TEST_FAILURE; } + /* holey rectangle */ + cairo_new_path (cr); + cairo_rectangle (cr, -10, -10, 20, 20); + cairo_rectangle (cr, -5, -5, 10, 10); + if (cairo_in_fill (cr, 0, 0)) { + cairo_test_log ("Error: Found an unexpected point inside rectangular hole\n"); + ret = CAIRO_TEST_FAILURE; + } + + /* holey circle */ + cairo_new_path (cr); + cairo_arc (cr, 0, 0, 10, 0, 2 * M_PI); + cairo_arc (cr, 0, 0, 5, 0, 2 * M_PI); + if (cairo_in_fill (cr, 0, 0)) { + cairo_test_log ("Error: Found an unexpected point inside circular hole\n"); + ret = CAIRO_TEST_FAILURE; + } + return ret; }