summaryrefslogtreecommitdiff
path: root/test/caps-joins.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-11-28 23:58:55 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-11-29 11:20:29 +0000
commitf0804d4856496a46d0b2270d5815856bf63b4cf8 (patch)
tree21385c1e9f16420fe92c2cccc7594f5e6cffcc4d /test/caps-joins.c
parentf39dd86e292e9af3438acb041a3a7330fb4a3b22 (diff)
downloadcairo-f0804d4856496a46d0b2270d5815856bf63b4cf8.tar.gz
[test] Exercise caps and joins under reflection.
The nature of the joins depends critically upon whether the joint is clockwise or counter-clockwise, so extend the basic caps-joins test to exercise both conditions i.e. repeat the test under a reflection.
Diffstat (limited to 'test/caps-joins.c')
-rw-r--r--test/caps-joins.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/test/caps-joins.c b/test/caps-joins.c
index 5ec6a8175..9d1c2a889 100644
--- a/test/caps-joins.c
+++ b/test/caps-joins.c
@@ -37,21 +37,15 @@ make_path (cairo_t *cr)
cairo_rel_line_to (cr, SIZE, 0.);
cairo_close_path (cr);
- cairo_move_to (cr, 2 * LINE_WIDTH, 0.);
- cairo_rel_line_to (cr, 3 * LINE_WIDTH, 0.);
- cairo_rel_line_to (cr, 0., 3 * LINE_WIDTH);
+ cairo_move_to (cr, 5 * LINE_WIDTH, 3 * LINE_WIDTH);
+ cairo_rel_line_to (cr, 0., -3 * LINE_WIDTH);
+ cairo_rel_line_to (cr, -3 * LINE_WIDTH, 0.);
}
-static cairo_test_status_t
-draw (cairo_t *cr, int width, int height)
+static void
+draw_caps_joins (cairo_t *cr)
{
- /* We draw in the default black, so paint white first. */
cairo_save (cr);
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
- cairo_paint (cr);
- cairo_restore (cr);
-
- cairo_set_line_width (cr, LINE_WIDTH);
cairo_translate (cr, PAD, PAD);
@@ -74,6 +68,28 @@ draw (cairo_t *cr, int width, int height)
cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
cairo_stroke (cr);
+ cairo_restore (cr);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ /* We draw in the default black, so paint white first. */
+ cairo_save (cr);
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
+ cairo_paint (cr);
+ cairo_restore (cr);
+
+ cairo_set_line_width (cr, LINE_WIDTH);
+
+ draw_caps_joins (cr);
+
+ /* and reflect to generate the opposite vertex ordering */
+ cairo_translate (cr, 0, height);
+ cairo_scale (cr, 1, -1);
+
+ draw_caps_joins (cr);
+
return CAIRO_TEST_SUCCESS;
}
@@ -82,6 +98,6 @@ CAIRO_TEST (caps_joins,
"stroke", /* keywords */
NULL, /* requirements */
3 * (PAD + SIZE) + PAD,
- PAD + SIZE + PAD,
+ 2 * (PAD + SIZE) + PAD,
NULL, draw)