[cairo-commit] 2 commits - test/cairo-test.c test/large-twin-antialias-mixed.c test/twin-antialias-gray.c test/twin-antialias-mixed.c test/twin-antialias-none.c test/twin-antialias-subpixel.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Sep 9 06:01:06 PDT 2009


 test/cairo-test.c                 |   46 ++++++++++++++++++++++++++++++++++++++
 test/large-twin-antialias-mixed.c |    2 -
 test/twin-antialias-gray.c        |    2 -
 test/twin-antialias-mixed.c       |    2 -
 test/twin-antialias-none.c        |    2 -
 test/twin-antialias-subpixel.c    |    2 -
 6 files changed, 51 insertions(+), 5 deletions(-)

New commits:
commit f5ee785144a8ddb6056b21f6c28bc4a9f4870b32
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Sep 9 13:59:50 2009 +0100

    [test] Disable the antialias testing for the vector surfaces.
    
    Only the raster bckends obey the font anti-alias options.

diff --git a/test/large-twin-antialias-mixed.c b/test/large-twin-antialias-mixed.c
index 57aa5d7..9626a9d 100644
--- a/test/large-twin-antialias-mixed.c
+++ b/test/large-twin-antialias-mixed.c
@@ -92,6 +92,6 @@ draw (cairo_t *cr, int width, int height)
 CAIRO_TEST (large_twin_antialias_mixed,
 	    "Tests the internal font (with intermixed antialiasing)",
 	    "twin, font", /* keywords */
-	    NULL, /* requirements */
+	    "target=raster", /* requirements */
 	    524, 240,
 	    NULL, draw)
diff --git a/test/twin-antialias-gray.c b/test/twin-antialias-gray.c
index d62efcd..8e00370 100644
--- a/test/twin-antialias-gray.c
+++ b/test/twin-antialias-gray.c
@@ -66,6 +66,6 @@ draw (cairo_t *cr, int width, int height)
 CAIRO_TEST (twin_antialias_gray,
 	    "Tests the internal font (with antialiasing reduced)",
 	    "twin, font", /* keywords */
-	    NULL, /* requirements */
+	    "target=raster", /* requirements */
 	    140, 60,
 	    NULL, draw)
diff --git a/test/twin-antialias-mixed.c b/test/twin-antialias-mixed.c
index 43f58ce..da4121a 100644
--- a/test/twin-antialias-mixed.c
+++ b/test/twin-antialias-mixed.c
@@ -92,6 +92,6 @@ draw (cairo_t *cr, int width, int height)
 CAIRO_TEST (twin_antialias_mixed,
 	    "Tests the internal font (with intermixed antialiasing)",
 	    "twin, font", /* keywords */
-	    NULL, /* requirements */
+	    "target=raster", /* requirements */
 	    140, 60,
 	    NULL, draw)
diff --git a/test/twin-antialias-none.c b/test/twin-antialias-none.c
index eaf8657..a5b713d 100644
--- a/test/twin-antialias-none.c
+++ b/test/twin-antialias-none.c
@@ -66,6 +66,6 @@ draw (cairo_t *cr, int width, int height)
 CAIRO_TEST (twin_antialias_none,
 	    "Tests the internal font (with antialiasing disabled)",
 	    "twin, font", /* keywords */
-	    NULL, /* requirements */
+	    "target=raster", /* requirements */
 	    140, 60,
 	    NULL, draw)
diff --git a/test/twin-antialias-subpixel.c b/test/twin-antialias-subpixel.c
index 8ecc0fc..e026286 100644
--- a/test/twin-antialias-subpixel.c
+++ b/test/twin-antialias-subpixel.c
@@ -66,6 +66,6 @@ draw (cairo_t *cr, int width, int height)
 CAIRO_TEST (twin_antialias_subpixel,
 	    "Tests the internal font (with subpixel antialiasing)",
 	    "twin, font", /* keywords */
-	    NULL, /* requirements */
+	    "target=raster", /* requirements */
 	    140, 60,
 	    NULL, draw)
commit abaef9bfbe11302beb6481547632b44be9d5be8d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Sep 9 13:57:06 2009 +0100

    [test] Compare a failure against the image output
    
    If a backend fails in exactly the same way as the image, then we can
    safely assume that the failure is systematic and not an error in the
    backend, so change the result to XFAIL.

diff --git a/test/cairo-test.c b/test/cairo-test.c
index 55e28dc..1f495af 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1369,6 +1369,52 @@ REPEAT:
 	    cairo_test_copy_file (test_filename, pass_filename);
 	}
 
+	/* If failed, compare against the current image output,
+	 * and attempt to detect systematic failures.
+	 */
+	if (ret == CAIRO_TEST_FAILURE) {
+	    char *image_out_path;
+
+	    image_out_path =
+		cairo_test_reference_filename (ctx,
+					       base_name,
+					       ctx->test_name,
+					       "image",
+					       "image",
+					       format,
+					       CAIRO_TEST_OUT_SUFFIX,
+					       CAIRO_TEST_PNG_EXTENSION);
+	    if (image_out_path != NULL) {
+		if (cairo_test_files_equal (out_png_path,
+					    image_out_path))
+		{
+		    ret = CAIRO_TEST_XFAILURE;
+		}
+		else
+		{
+		    ref_image =
+			cairo_image_surface_create_from_png (image_out_path);
+		    if (cairo_surface_status (ref_image) == CAIRO_STATUS_SUCCESS)
+		    {
+			diff_status = image_diff (ctx,
+						  test_image, ref_image,
+						  diff_image,
+						  &result);
+			if (diff_status == CAIRO_STATUS_SUCCESS &&
+			    (result.pixels_changed == 0 ||
+			     result.max_diff > target->error_tolerance))
+			{
+			    ret = CAIRO_TEST_XFAILURE;
+			}
+
+			cairo_surface_destroy (ref_image);
+		    }
+		}
+
+		free (image_out_path);
+	    }
+	}
+
 	cairo_surface_destroy (test_image);
 	cairo_surface_destroy (diff_image);
     }


More information about the cairo-commit mailing list