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>
This commit is contained in:
Chris Wilson 2011-08-13 13:24:52 +01:00
parent 829eabfc95
commit 54c8e8ccfc
6 changed files with 83 additions and 2 deletions

View file

@ -690,6 +690,10 @@ REFERENCE_IMAGES = \
leaky-polygon.image16.ref.png \
leaky-polygon.ps.ref.png \
leaky-polygon.ref.png \
line-width-overlap-flipped.ref.png \
line-width-overlap-flopped.ref.png \
line-width-overlap-offset.ref.png \
line-width-overlap-rotated.ref.png \
line-width-overlap.ref.png \
line-width-scale.image16.ref.png \
line-width-scale.ps2.ref.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

View file

@ -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)