summaryrefslogtreecommitdiff
path: root/test/dash-caps-joins.c
diff options
context:
space:
mode:
authorJeff Muizelaar <jeff@freiheit.infidigm.net>2006-07-15 14:39:26 -0400
committerJeff Muizelaar <jeff@freiheit.infidigm.net>2006-07-15 14:39:26 -0400
commitb607cdff98e621a6650bccef20f9877a0e7aa1d9 (patch)
tree881a40143585a5b0370577e816af47395f170eaf /test/dash-caps-joins.c
parentc70edff0842bc6f7238e17a5fe92dddceec283d3 (diff)
Test closed dashed paths where the first and last sub-path do not join.
This tests the situation reported by Keith Wells where the start point of a closed dashed path was not being properly capped.
Diffstat (limited to 'test/dash-caps-joins.c')
-rw-r--r--test/dash-caps-joins.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/test/dash-caps-joins.c b/test/dash-caps-joins.c
index 722a59d2..370d05dd 100644
--- a/test/dash-caps-joins.c
+++ b/test/dash-caps-joins.c
@@ -41,7 +41,7 @@ cairo_test_t test = {
"dash-caps-joins",
"Test caps and joins when dashing",
3 * (PAD + SIZE) + PAD,
- PAD + SIZE + PAD,
+ PAD + SIZE + PAD + SIZE + PAD,
draw
};
@@ -62,6 +62,8 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
double dash[] = {LINE_WIDTH, 1.5 * LINE_WIDTH};
+ double dash_offset = -2 * LINE_WIDTH;
+ int i;
/* We draw in the default black, so paint white first. */
cairo_save (cr);
@@ -69,29 +71,36 @@ draw (cairo_t *cr, int width, int height)
cairo_paint (cr);
cairo_restore (cr);
- cairo_set_line_width (cr, LINE_WIDTH);
- cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), - 2 * LINE_WIDTH);
+ for (i=0; i<2; i++) {
+ cairo_save (cr);
+ cairo_set_line_width (cr, LINE_WIDTH);
+ cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), dash_offset);
- cairo_translate (cr, PAD, PAD);
+ cairo_translate (cr, PAD, PAD);
- make_path (cr);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
- cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
- cairo_stroke (cr);
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
+ cairo_stroke (cr);
- cairo_translate (cr, SIZE + PAD, 0.);
+ cairo_translate (cr, SIZE + PAD, 0.);
- make_path (cr);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
- cairo_stroke (cr);
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
+ cairo_stroke (cr);
- cairo_translate (cr, SIZE + PAD, 0.);
+ cairo_translate (cr, SIZE + PAD, 0.);
- make_path (cr);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
- cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
- cairo_stroke (cr);
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
+ cairo_stroke (cr);
+
+ cairo_restore (cr);
+ cairo_translate (cr, 0., SIZE + PAD);
+ dash_offset = 0;
+ }
return CAIRO_TEST_SUCCESS;
}