diff --git a/src/cairo.c b/src/cairo.c index f5b92a778..3011125f8 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -1887,9 +1887,9 @@ slim_hidden_def(cairo_close_path); * the corresponding drawing operations. * * The result of cairo_path_extents() is defined as equivalent to the - * limit of cairo_stroke_extents() as the line width approaches 0.0, - * (but never reaching the empty-rectangle returned by - * cairo_stroke_extents() for a line width of 0.0). + * limit of cairo_stroke_extents() with CAIRO_LINE_CAP_ROUND as the + * line width approaches 0.0, (but never reaching the empty-rectangle + * returned by cairo_stroke_extents() for a line width of 0.0). * * Specifically, this means that zero-area sub-paths such as * cairo_move_to();cairo_line_to() segments, (even degenerate cases diff --git a/test/get-path-extents.c b/test/get-path-extents.c index 0be57a704..5e82c1eac 100644 --- a/test/get-path-extents.c +++ b/test/get-path-extents.c @@ -166,6 +166,34 @@ draw (cairo_t *cr, int width, int height) cairo_new_path (cr2); cairo_restore (cr2); + /* Test that with CAIRO_LINE_CAP_ROUND, we get "dots" from + * cairo_move_to; cairo_rel_line_to(0,0) */ + cairo_save (cr2); + + cairo_set_line_cap (cr2, CAIRO_LINE_CAP_ROUND); + cairo_set_line_width (cr2, 20); + + cairo_move_to (cr2, 200, 400); + cairo_rel_line_to (cr2, 0, 0); + phase = "Single 'dot'"; + if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) || + !check_extents (phase, cr2, STROKE, EQUALS, 190, 390, 20, 20) || + !check_extents (phase, cr2, PATH, EQUALS, 200, 400, 0, 0)) + ret = CAIRO_TEST_FAILURE; + + /* Add another dot without starting a new path */ + cairo_move_to (cr2, 100, 500); + cairo_rel_line_to (cr2, 0, 0); + phase = "Multiple 'dots'"; + if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) || + !check_extents (phase, cr2, STROKE, EQUALS, 90, 390, 120, 120) || + !check_extents (phase, cr2, PATH, EQUALS, 100, 400, 100, 100)) + 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);