From 0c42d5c176b27725ac8ab293c3e941be64f51613 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 30 Sep 2014 16:14:57 +0100 Subject: test: Add another coverage example demonstrating the seams in tor References: https://bugs.freedesktop.org/show_bug.cgi?id=84396 Signed-off-by: Chris Wilson --- test/coverage.c | 53 +++++++++++++++++++++++++++++++ test/reference/coverage-abutting.ref.png | Bin 0 -> 777 bytes 2 files changed, 53 insertions(+) create mode 100644 test/reference/coverage-abutting.ref.png diff --git a/test/coverage.c b/test/coverage.c index fdf801284..2f0e21229 100644 --- a/test/coverage.c +++ b/test/coverage.c @@ -286,6 +286,53 @@ triangles (cairo_t *cr, int width, int height) return CAIRO_TEST_SUCCESS; } +static cairo_test_status_t +abutting (cairo_t *cr, int width, int height) +{ + int x, y; + + cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); + cairo_paint (cr); + + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.75); + +#if GENERATE_REFERENCE + cairo_paint (cr); +#else + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + + for (y = 0; y < 16; y++) { + for (x = 0; x < 16; x++) { + double theta = (y * 16 + x) * M_PI / 512; + double cx = 16 * cos (theta) + x * 16; + double cy = 16 * sin (theta) + y * 16; + + cairo_move_to (cr, x * 16, y * 16); + cairo_line_to (cr, cx, cy); + cairo_line_to (cr, (x + 1) * 16, y * 16); + cairo_fill (cr); + + cairo_move_to (cr, (x + 1) * 16, y * 16); + cairo_line_to (cr, cx, cy); + cairo_line_to (cr, (x + 1) * 16, (y + 1) * 16); + cairo_fill (cr); + + cairo_move_to (cr, (x + 1) * 16, (y + 1) * 16); + cairo_line_to (cr, cx, cy); + cairo_line_to (cr, x * 16, (y + 1) * 16); + cairo_fill (cr); + + cairo_move_to (cr, x * 16, (y + 1) * 16); + cairo_line_to (cr, cx, cy); + cairo_line_to (cr, x * 16, y * 16); + cairo_fill (cr); + } + } +#endif + + return CAIRO_TEST_SUCCESS; +} + static cairo_test_status_t column_triangles (cairo_t *cr, int width, int height) { @@ -451,3 +498,9 @@ CAIRO_TEST (coverage_triangles, "target=raster", /* requirements */ WIDTH, HEIGHT, NULL, triangles) +CAIRO_TEST (coverage_abutting, + "Check the fidelity of the rasterisation.", + NULL, /* keywords */ + "target=raster", /* requirements */ + 16*16, 16*16, + NULL, abutting) diff --git a/test/reference/coverage-abutting.ref.png b/test/reference/coverage-abutting.ref.png new file mode 100644 index 000000000..8e37ca313 Binary files /dev/null and b/test/reference/coverage-abutting.ref.png differ -- cgit v1.2.1