[cairo-commit] test/coverage.c test/reference

Chris Wilson ickle at kemper.freedesktop.org
Tue Sep 30 08:16:05 PDT 2014


 test/coverage.c                          |   53 +++++++++++++++++++++++++++++++
 test/reference/coverage-abutting.ref.png |binary
 2 files changed, 53 insertions(+)

New commits:
commit 0c42d5c176b27725ac8ab293c3e941be64f51613
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Sep 30 16:14:57 2014 +0100

    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 <chris at chris-wilson.co.uk>

diff --git a/test/coverage.c b/test/coverage.c
index fdf8012..2f0e212 100644
--- a/test/coverage.c
+++ b/test/coverage.c
@@ -287,6 +287,53 @@ triangles (cairo_t *cr, int width, int height)
 }
 
 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)
 {
     int x, y, i, channel;
@@ -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 0000000..8e37ca3
Binary files /dev/null and b/test/reference/coverage-abutting.ref.png differ


More information about the cairo-commit mailing list