diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-13 13:24:52 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-13 16:21:08 +0100 |
commit | 54c8e8ccfc242fd17144c64202f628c87edbb6f4 (patch) | |
tree | ba39ea978d92ab08b086f387c227565fbbbe25f0 /test/line-width-overlap.c | |
parent | 829eabfc9531a3e4490760b6bbd33286cd280e95 (diff) | |
download | cairo-54c8e8ccfc242fd17144c64202f628c87edbb6f4.tar.gz |
test: Add a couple of variants to line-width-overlap
The bug may be in only the fast-path, but future bugs may lie elsewhere.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'test/line-width-overlap.c')
-rw-r--r-- | test/line-width-overlap.c | 81 |
1 files changed, 79 insertions, 2 deletions
diff --git a/test/line-width-overlap.c b/test/line-width-overlap.c index cd23d32db..ac8c23479 100644 --- a/test/line-width-overlap.c +++ b/test/line-width-overlap.c @@ -54,9 +54,9 @@ draw (cairo_t *cr, int width, int height) /* rectangle that is smaller than the line width in center of image */ cairo_rectangle (cr, - (SIZE - RECT_SIZE) / 2, (SIZE - RECT_SIZE) / 2, - RECT_SIZE, + (SIZE - RECT_SIZE) / 2, + RECT_SIZE, RECT_SIZE); cairo_stroke (cr); @@ -64,9 +64,86 @@ draw (cairo_t *cr, int width, int height) return CAIRO_TEST_SUCCESS; } +/* and again slightly offset to trigger another path */ +static cairo_test_status_t +draw_offset (cairo_t *cr, int width, int height) +{ + cairo_translate (cr, .5, .5); + return draw (cr, width, height); +} + +static cairo_test_status_t +draw_rotated (cairo_t *cr, int width, int height) +{ + cairo_translate (cr, SIZE/2, SIZE/2); + cairo_rotate (cr, M_PI/4); + cairo_translate (cr, -SIZE/2, -SIZE/2); + + return draw (cr, width, height); +} + +static cairo_test_status_t +draw_flipped (cairo_t *cr, int width, int height) +{ + cairo_translate (cr, SIZE/2, SIZE/2); + cairo_scale (cr, -1, 1); + cairo_translate (cr, -SIZE/2, -SIZE/2); + + return draw (cr, width, height); +} + +static cairo_test_status_t +draw_flopped (cairo_t *cr, int width, int height) +{ + cairo_translate (cr, SIZE/2, SIZE/2); + cairo_scale (cr, 1, -1); + cairo_translate (cr, -SIZE/2, -SIZE/2); + + return draw (cr, width, height); +} + +static cairo_test_status_t +draw_dashed (cairo_t *cr, int width, int height) +{ + const double dashes[] = { 4 }; + cairo_set_dash (cr, dashes, 1, 0); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT); + return draw (cr, width, height); +} + CAIRO_TEST (line_width_overlap, "Test overlapping lines due to large line width", "stroke", /* keywords */ NULL, /* requirements */ SIZE, SIZE, NULL, draw) +CAIRO_TEST (line_width_overlap_offset, + "Test overlapping lines due to large line width", + "stroke", /* keywords */ + NULL, /* requirements */ + SIZE, SIZE, + NULL, draw_offset) +CAIRO_TEST (line_width_overlap_rotated, + "Test overlapping lines due to large line width", + "stroke", /* keywords */ + NULL, /* requirements */ + SIZE, SIZE, + NULL, draw_rotated) +CAIRO_TEST (line_width_overlap_flipped, + "Test overlapping lines due to large line width", + "stroke", /* keywords */ + NULL, /* requirements */ + SIZE, SIZE, + NULL, draw_flipped) +CAIRO_TEST (line_width_overlap_flopped, + "Test overlapping lines due to large line width", + "stroke", /* keywords */ + NULL, /* requirements */ + SIZE, SIZE, + NULL, draw_flopped) +CAIRO_TEST (line_width_overlap_dashed, + "Test overlapping lines due to large line width", + "stroke", /* keywords */ + NULL, /* requirements */ + SIZE, SIZE, + NULL, draw_dashed) |