From dd13a00541ebd85bb7687add8b76fa3fb1d82b95 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 17 Jan 2008 10:09:22 +0000 Subject: [PATCH] [test/get-path-extents] Check extents of degenerate paths. Ensure that degenerate paths have zero extents. --- test/get-path-extents.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/get-path-extents.c b/test/get-path-extents.c index 917039efc..ba2b116ba 100644 --- a/test/get-path-extents.c +++ b/test/get-path-extents.c @@ -121,6 +121,41 @@ draw (cairo_t *cr, int width, int height) !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0)) ret = CAIRO_TEST_FAILURE; + cairo_save (cr2); + + cairo_new_path (cr2); + cairo_move_to (cr2, 200, 400); + cairo_rel_line_to (cr2, 0., 0.); + phase = "Degenerate line"; + if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) || + !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0)) + ret = CAIRO_TEST_FAILURE; + + cairo_new_path (cr2); + cairo_move_to (cr2, 200, 400); + cairo_rel_curve_to (cr2, 0., 0., 0., 0., 0., 0.); + phase = "Degenerate curve"; + if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) || + !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0)) + ret = CAIRO_TEST_FAILURE; + + cairo_new_path (cr2); + cairo_arc (cr2, 200, 400, 0., 0, 2 * M_PI); + phase = "Degenerate arc (R=0)"; + if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) || + !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0)) + ret = CAIRO_TEST_FAILURE; + + cairo_new_path (cr2); + cairo_arc (cr2, 200, 400, 10., 0, 0); + phase = "Degenerate arc (Θ=0)"; + if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) || + !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0)) + ret = CAIRO_TEST_FAILURE; + + cairo_new_path (cr2); + cairo_restore (cr2); + /* http://bugs.freedesktop.org/show_bug.cgi?id=7965 */ phase = "A vertical, open path"; cairo_save (cr2);