[cairo-commit] test/a8-mask.c test/bitmap-font.c test/cairo-test.c test/cairo-test.h test/caps-joins-alpha.c test/caps-joins.c test/caps-sub-paths.c test/clip-all.c test/clip-fill-rule.c test/clip-fill-rule-pixel-aligned.c test/clip-nesting.c test/clip-operator.c test/clip-twice.c test/composite-integer-translate-over.c test/composite-integer-translate-over-repeat.c test/composite-integer-translate-source.c test/create-for-stream.c test/create-from-png.c test/create-from-png-stream.c test/dash-caps-joins.c test/dash-offset-negative.c test/dash-scale.c test/dash-zero-length.c test/degenerate-path.c test/device-offset.c test/device-offset-positive.c test/extend-reflect.c test/fallback-resolution.c test/fill-and-stroke-alpha-add.c test/fill-and-stroke-alpha.c test/fill-and-stroke.c test/fill-rule.c test/filter-nearest-offset.c test/ft-font-create-for-ft-face.c test/ft-text-antialias-none.c test/ft-text-vertical-layout.c test/get-and-set.c test/get-group-target.c test/.gitignore test/glyph-cache-pressure.c test/gradient-alpha.c test/leaky-dash.c test/leaky-polygon.c test/linear-gradient.c test/line-width.c test/line-width-scale.c test/Makefile.am test/mask.c test/mask-ctm.c test/mask-surface-ctm.c test/move-to-show-surface.c test/multi-page.c test/new-sub-path.c test/nil-surface.c test/operator-clear.c test/operator-source.c test/paint.c test/paint-source-alpha.c test/paint-with-alpha.c test/path-data.c test/pdf-features.c test/pixman-rotate.c test/ps-features.c test/push-group.c test/README test/rectangle-rounding-error.c test/rel-path.c test/scale-source-surface-paint.c test/select-font-face.c test/select-font-no-show-text.c test/self-copy.c test/self-intersecting.c test/set-source.c test/show-glyphs-many.c test/show-text-current-point.c test/source-clip.c test/source-surface-scale-paint.c test/surface-finish-twice.c test/surface-pattern.c test/svg-clip.c test/svg-surface.c test/text-antialias-gray.c test/text-antialias-none.c test/text-antialias-subpixel.c test/text-cache-crash.c test/text-pattern.c test/text-rotate.c test/transforms.c test/translate-show-surface.c test/trap-clip.c test/unantialiased-shapes.c test/unbounded-operator.c test/xlib-surface.c test/zero-alpha.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Jul 11 19:19:51 PDT 2006


 test/.gitignore                                |    1 
 test/Makefile.am                               |    9 ++
 test/README                                    |    6 -
 test/a8-mask.c                                 |    9 +-
 test/bitmap-font.c                             |    5 -
 test/cairo-test.c                              |   98 +++++++++++++++++--------
 test/cairo-test.h                              |   24 ++----
 test/caps-joins-alpha.c                        |    5 -
 test/caps-joins.c                              |    5 -
 test/caps-sub-paths.c                          |    5 -
 test/clip-all.c                                |    5 -
 test/clip-fill-rule-pixel-aligned.c            |    5 -
 test/clip-fill-rule.c                          |    5 -
 test/clip-nesting.c                            |    5 -
 test/clip-operator.c                           |    7 +
 test/clip-twice.c                              |    5 -
 test/composite-integer-translate-over-repeat.c |    5 -
 test/composite-integer-translate-over.c        |    5 -
 test/composite-integer-translate-source.c      |    5 -
 test/create-for-stream.c                       |   29 ++++---
 test/create-from-png-stream.c                  |    5 -
 test/create-from-png.c                         |    5 -
 test/dash-caps-joins.c                         |    5 -
 test/dash-offset-negative.c                    |    5 -
 test/dash-scale.c                              |    5 -
 test/dash-zero-length.c                        |    5 -
 test/degenerate-path.c                         |    5 -
 test/device-offset-positive.c                  |    5 -
 test/device-offset.c                           |    5 -
 test/extend-reflect.c                          |    9 +-
 test/fallback-resolution.c                     |    6 -
 test/fill-and-stroke-alpha-add.c               |    5 -
 test/fill-and-stroke-alpha.c                   |    5 -
 test/fill-and-stroke.c                         |    5 -
 test/fill-rule.c                               |    5 -
 test/filter-nearest-offset.c                   |    9 +-
 test/ft-font-create-for-ft-face.c              |    5 -
 test/ft-text-antialias-none.c                  |    5 -
 test/ft-text-vertical-layout.c                 |    5 -
 test/get-and-set.c                             |    7 +
 test/get-group-target.c                        |    5 -
 test/glyph-cache-pressure.c                    |    5 -
 test/gradient-alpha.c                          |    5 -
 test/leaky-dash.c                              |    9 +-
 test/leaky-polygon.c                           |    5 -
 test/line-width-scale.c                        |    5 -
 test/line-width.c                              |    5 -
 test/linear-gradient.c                         |    5 -
 test/mask-ctm.c                                |    5 -
 test/mask-surface-ctm.c                        |    5 -
 test/mask.c                                    |    7 +
 test/move-to-show-surface.c                    |    5 -
 test/multi-page.c                              |    8 +-
 test/new-sub-path.c                            |    5 -
 test/nil-surface.c                             |    5 -
 test/operator-clear.c                          |    7 +
 test/operator-source.c                         |    7 +
 test/paint-source-alpha.c                      |    5 -
 test/paint-with-alpha.c                        |    5 -
 test/paint.c                                   |    5 -
 test/path-data.c                               |    5 -
 test/pdf-features.c                            |    2 
 test/pixman-rotate.c                           |    5 -
 test/ps-features.c                             |    2 
 test/push-group.c                              |    5 -
 test/rectangle-rounding-error.c                |    5 -
 test/rel-path.c                                |    5 -
 test/scale-source-surface-paint.c              |    5 -
 test/select-font-face.c                        |    5 -
 test/select-font-no-show-text.c                |    7 +
 test/self-copy.c                               |    5 -
 test/self-intersecting.c                       |    9 +-
 test/set-source.c                              |    5 -
 test/show-glyphs-many.c                        |    5 -
 test/show-text-current-point.c                 |    5 -
 test/source-clip.c                             |    5 -
 test/source-surface-scale-paint.c              |    5 -
 test/surface-finish-twice.c                    |    5 -
 test/surface-pattern.c                         |    5 -
 test/svg-clip.c                                |    2 
 test/svg-surface.c                             |   10 +-
 test/text-antialias-gray.c                     |    5 -
 test/text-antialias-none.c                     |    5 -
 test/text-antialias-subpixel.c                 |    5 -
 test/text-cache-crash.c                        |    7 -
 test/text-pattern.c                            |    5 -
 test/text-rotate.c                             |    9 +-
 test/transforms.c                              |    5 -
 test/translate-show-surface.c                  |    5 -
 test/trap-clip.c                               |    7 +
 test/unantialiased-shapes.c                    |    5 -
 test/unbounded-operator.c                      |    7 +
 test/xlib-surface.c                            |    2 
 test/zero-alpha.c                              |    5 -
 94 files changed, 386 insertions(+), 260 deletions(-)

New commits:
diff-tree 973d3a3d1466830dcaa94e9fe39fa6fdf510fbbc (from 94bdbc15f79308269f1bcd74b3d8899f8458babc)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Jul 11 22:19:39 2006 -0400

    More test suite infrastructure improvements:
    - Remove cairo_test_expect_failure.  cairo-test.c now checks
      env var CAIRO_XFAIL_TESTS to see if the running test is
      expected to fail.  The reason for expected failure is
      appended to the test description.
    - Test description is written out.
    - Failed/crashed tests also write a line out to stderr (in red),
      so one can now redirect stdout to /dev/null to only see failures.
    - cairo_test() has been changed to not take the draw function
      anymore, instead, draw function is now part of the test struct.
    - "make check" doesn't allow limiting backends to test using env
      var anymore.  To limit backends to test, one should use the
      TARGETS variable on the make command line.
    - "make check-valgrind" now writes its log to valgrind-log instead
      of valgrind.log, to not interfere with test log file processing.

diff --git a/test/.gitignore b/test/.gitignore
index a6865b9..a0255e7 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -114,6 +114,7 @@ unbounded-operator
 user-data
 xlib-surface
 zero-alpha
+valgrind-log
 *-out.pdf
 *-out.png
 *-out.ps
diff --git a/test/Makefile.am b/test/Makefile.am
index 75ab81c..c96f7a7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -451,6 +451,13 @@ endif
 
 EXTRA_PROGRAMS = $(TESTS) $(SUPPORT_PROGS)
 
+# Emptying TARGET makes sure that user's environment variable doesn't
+# affect tested targets in test suite.  To limit tested targets, one
+# has to set TARGETS=target,list on the make command line
+TARGETS =
+
+TESTS_ENVIRONMENT = CAIRO_XFAIL_TESTS="$(XFAIL_TESTS)" CAIRO_TEST_TARGET="$(TARGETS)"
+
 CLEANFILES =					\
 	*.ps					\
 	*.pdf					\
@@ -472,7 +479,7 @@ CLEANFILES =					\
 # Check tests under valgrind
 # Saves log to valgrind-log
 check-valgrind:
-	TESTS_ENVIRONMENT="$(top_srcdir)/libtool --mode=execute valgrind --tool=memcheck --suppressions=./.valgrind-suppressions --leak-check=yes --show-reachable=yes" $(MAKE) check 2>&1 | tee valgrind-log
+	$(MAKE) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_srcdir)/libtool --mode=execute valgrind --tool=memcheck --suppressions=./.valgrind-suppressions --leak-check=yes --show-reachable=yes' 2>&1 | tee valgrind-log
 
 # Re-checks all failed tests, i.e. tests with a log file that has a failure
 recheck:
diff --git a/test/README b/test/README
index 0fb7f72..468ff4a 100644
--- a/test/README
+++ b/test/README
@@ -22,12 +22,12 @@ These come very handy when doing develop
 to circumvent the "pass" requirements listed below.
 
 To limit the backends that the tests are run against, use the
-CAIRO_TEST_TARGET environment variable, that can also be passed to make.
+TARGETS make variable, that can also be passed to make.
 It should contain a (space-, comma-, etc-separate) list of backends to test.
-To limit the tests run, use the make TESTS variable, which should be a
+To limit the tests run, use the TESTS make variable, which should be a
 space-separated list of tests to run.  For example:
 
-  make check CAIRO_TEST_TARGET=image,ps TESTS="zero-alpha"
+  make check TARGETS=image,ps TESTS="zero-alpha"
 
 
 Before committing
diff --git a/test/a8-mask.c b/test/a8-mask.c
index e547ecc..b619025 100644
--- a/test/a8-mask.c
+++ b/test/a8-mask.c
@@ -27,8 +27,10 @@
 
 cairo_test_t test = {
     "a8-mask",
-    "test masks of CAIRO_FORMAT_A8",
-    8, 8
+    "test masks of CAIRO_FORMAT_A8"
+    "\nimage backend fails because libpixman only handles (stride % sizeof(pixman_bits) == 0)",
+    8, 8,
+    draw
 };
 
 static unsigned char mask[] = {
@@ -67,6 +69,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test_expect_failure (&test, draw,
-	    "image backend fails because libpixman only handles (stride % sizeof(pixman_bits) == 0)");
+    return cairo_test (&test);
 }
diff --git a/test/bitmap-font.c b/test/bitmap-font.c
index 6351a3f..3707a35 100644
--- a/test/bitmap-font.c
+++ b/test/bitmap-font.c
@@ -38,7 +38,8 @@
 cairo_test_t test = {
     "bitmap-font",
     "Test drawing with a font consisting only of bitmaps",
-    246 + 1, TEXT_SIZE
+    246 + 1, TEXT_SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -102,5 +103,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/cairo-test.c b/test/cairo-test.c
index bea87f4..8b4ae11 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -118,6 +118,8 @@ cairo_test_init (const char *test_name)
 	cairo_test_log_file = stderr;
     }
     free (log_name);
+
+    printf ("\nTESTING %s\n", test_name);
 }
 
 void
@@ -1469,7 +1471,6 @@ cleanup_svg (void *closure)
 
 static cairo_test_status_t
 cairo_test_for_target (cairo_test_t *test,
-		       cairo_test_draw_function_t draw,
 		       cairo_test_target_t	 *target,
 		       int			  dev_offset)
 {
@@ -1566,7 +1567,7 @@ cairo_test_for_target (cairo_test_t *tes
     cairo_paint (cr);
     cairo_restore (cr);
 
-    status = (draw) (cr, test->width, test->height);
+    status = (test->draw) (cr, test->width, test->height);
 
     /* Then, check all the different ways it could fail. */
     if (status) {
@@ -1630,14 +1631,17 @@ segfault_handler (int signal)
 }
 
 static cairo_test_status_t
-cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw,
+cairo_test_expecting (cairo_test_t *test,
 		      cairo_test_status_t expectation)
 {
+    /* we use volatile here to make sure values are not clobbered
+     * by longjmp */
     volatile int i, j, num_targets;
+    volatile limited_targets = 0;
     const char *tname;
     void (*old_segfault_handler)(int);
-    cairo_test_status_t status, ret;
-    cairo_test_target_t **targets_to_test;
+    volatile cairo_test_status_t status, ret;
+    volatile cairo_test_target_t **targets_to_test;
     cairo_test_target_t targets[] =
 	{
 	    { "image", CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR_ALPHA,
@@ -1769,7 +1773,7 @@ cairo_test_expecting (cairo_test_t *test
 	};
 
 #ifdef HAVE_UNISTD_H
-    if (isatty (1)) {
+    if (isatty (2)) {
 	fail_face = "\033[41m\033[37m\033[1m";
 	normal_face = "\033[m";
     }
@@ -1779,19 +1783,28 @@ cairo_test_expecting (cairo_test_t *test
     if (!srcdir)
 	srcdir = ".";
 
-    if ((tname = getenv ("CAIRO_TEST_TARGET")) != NULL) {
-	char *tname = getenv ("CAIRO_TEST_TARGET");
+    cairo_test_init (test->name);
+    printf ("%s\n", test->description);
+
+    if (expectation == CAIRO_TEST_FAILURE)
+    printf ("Expecting failure\n");
+
+
+    if ((tname = getenv ("CAIRO_TEST_TARGET")) != NULL && *tname) {
+
+	limited_targets = 1;
+
 	num_targets = 0;
 	targets_to_test = NULL;
 
 	while (*tname) {
 	    int found = 0;
-	    char *end = strpbrk (tname, " \t;:,");
+	    char *end = strpbrk (tname, " \t\r\n;:,");
 	    if (!end)
 	        end = tname + strlen (tname);
 
 	    for (i = 0; i < sizeof(targets)/sizeof(targets[0]); i++) {
-		if (strncmp (targets[i].name, tname, end - tname) == 0 &&
+		if (0 == strncmp (targets[i].name, tname, end - tname) &&
 		    !isalnum (targets[i].name[end - tname])) {
 		    /* realloc isn't exactly the best thing here, but meh. */
 		    targets_to_test = realloc (targets_to_test, sizeof(cairo_test_target_t *) * (num_targets+1));
@@ -1801,7 +1814,7 @@ cairo_test_expecting (cairo_test_t *test
 	    }
 
 	    if (!found) {
-		*end = '\n';
+		*end = '\0';
 		fprintf (stderr, "Cannot test target '%s'\n", tname);
 		exit(-1);
 	    }
@@ -1817,8 +1830,6 @@ cairo_test_expecting (cairo_test_t *test
 	    targets_to_test[i] = &targets[i];
     }
 
-    cairo_test_init (test->name);
-
     /* The intended logic here is that we return overall SUCCESS
      * iff. there is at least one tested backend and that all tested
      * backends return SUCCESS, OR, there's no backend to test at all.
@@ -1836,8 +1847,8 @@ cairo_test_expecting (cairo_test_t *test
     ret = CAIRO_TEST_UNTESTED;
     for (i = 0; i < num_targets; i++) {
 	for (j = 0; j < NUM_DEVICE_OFFSETS; j++) {
-	    cairo_test_target_t *target = targets_to_test[i];
-	    int dev_offset = j * 25;
+	    volatile cairo_test_target_t *target = targets_to_test[i];
+	    volatile int dev_offset = j * 25;
 
 	    cairo_test_log ("Testing %s with %s target (dev offset %d)\n", test->name, target->name, dev_offset);
 	    printf ("%s-%s-%s [%d]:\t", test->name, target->name,
@@ -1847,7 +1858,7 @@ cairo_test_expecting (cairo_test_t *test
 	    /* Set up a checkpoint to get back to in case of segfaults. */
 	    old_segfault_handler = signal (SIGSEGV, segfault_handler);
 	    if (0 == setjmp (jmpbuf))
-		status = cairo_test_for_target (test, draw, target, dev_offset);
+		status = cairo_test_for_target (test, target, dev_offset);
 	    else
 	        status = CAIRO_TEST_CRASHED;
 	    signal (SIGSEGV, old_segfault_handler);
@@ -1869,8 +1880,12 @@ cairo_test_expecting (cairo_test_t *test
 		cairo_test_log ("UNTESTED\n");
 		break;
 	    case CAIRO_TEST_CRASHED:
-		printf ("%s!!!CRASHED!!!%s\n", fail_face, normal_face);
+		printf ("CRASHED\n");
 		cairo_test_log ("CRASHED\n");
+		fprintf (stderr, "%s-%s-%s [%d]:\t%s!!!TEST-CASE CRASH!!!%s\n",
+			 test->name, target->name,
+			 _cairo_test_content_name (target->content), dev_offset,
+			 fail_face, normal_face);
 		ret = CAIRO_TEST_FAILURE;
 		break;
 	    default:
@@ -1879,17 +1894,32 @@ cairo_test_expecting (cairo_test_t *test
 		    printf ("XFAIL\n");
 		    cairo_test_log ("XFAIL\n");
 		} else {
-		    printf ("%sFAIL%s\n", fail_face, normal_face);
+		    printf ("FAIL\n");
 		    cairo_test_log ("FAIL\n");
+		    fprintf (stderr, "%s-%s-%s [%d]:\t%sUNEXPECTED FAILURE%s\n",
+			     test->name, target->name,
+			     _cairo_test_content_name (target->content), dev_offset,
+			     fail_face, normal_face);
 		}
 		ret = status;
 		break;
 	    }
 	}
     }
+
     if (ret == CAIRO_TEST_UNTESTED)
 	ret = num_targets ? CAIRO_TEST_FAILURE : CAIRO_TEST_SUCCESS;
 
+    /* if targets are limited using CAIRO_TEST_TARGET, and expecting failure,
+     * make it fail, such that we can pass test suite by limiting backends
+     * to test without triggering XPASS failures. */
+    if (limited_targets && expectation == CAIRO_TEST_FAILURE && ret == CAIRO_TEST_SUCCESS) {
+	printf ("All tested backends passed, but tested targets are manually limited\n"
+		"and the test suite expects this test to fail for at least one target.\n"
+		"Intentionally failing the test, to not fail the suite.\n");
+	ret = CAIRO_TEST_FAILURE;
+    }
+
     fclose (cairo_test_log_file);
 
     free (targets_to_test);
@@ -1902,19 +1932,29 @@ cairo_test_expecting (cairo_test_t *test
 }
 
 cairo_test_status_t
-cairo_test_expect_failure (cairo_test_t		      *test,
-			   cairo_test_draw_function_t  draw,
-			   const char		      *because)
+cairo_test (cairo_test_t *test)
 {
-    printf ("\n%s is expected to fail:\n\t%s\n", test->name, because);
-    return cairo_test_expecting (test, draw, CAIRO_TEST_FAILURE);
-}
+    cairo_test_status_t expectation = CAIRO_TEST_SUCCESS;
+    char *xfails;
 
-cairo_test_status_t
-cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw)
-{
-    printf ("\n");
-    return cairo_test_expecting (test, draw, CAIRO_TEST_SUCCESS);
+    if ((xfails = getenv ("CAIRO_XFAIL_TESTS")) != NULL) {
+	while (*xfails) {
+	    char *end = strpbrk (xfails, " \t\r\n;:,");
+	    if (!end)
+	        end = xfails + strlen (xfails);
+	    else
+		*end++ = '\0';
+
+	    if (0 == strcmp (test->name, xfails)) {
+		expectation = CAIRO_TEST_FAILURE;
+		break;
+	    }
+
+	    xfails = end;
+	}
+    }
+
+    return cairo_test_expecting (test, expectation);
 }
 
 cairo_surface_t *
diff --git a/test/cairo-test.h b/test/cairo-test.h
index f33ea1e..fbcbf29 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -71,18 +71,20 @@ typedef enum cairo_test_status {
     CAIRO_TEST_CRASHED
 } cairo_test_status_t;
 
-typedef struct cairo_test {
-    char *name;
-    char *description;
+typedef cairo_test_status_t  (cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
+static cairo_test_draw_function_t draw;
+
+typedef struct _cairo_test {
+    const char *name;
+    const char *description;
     int width;
     int height;
+    cairo_test_draw_function_t *draw;
 } cairo_test_t;
 
-typedef cairo_test_status_t  (*cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
-
 /* The standard test interface which works by examining result image.
  *
- * cairo_test() accepts a draw function which will be called once for
+ * cairo_test() accepts a test struct which will be called once for
  * each testable backend. The following checks will be performed for
  * each backend:
  *
@@ -103,15 +105,7 @@ typedef cairo_test_status_t  (*cairo_tes
  * to the four criteria above.
  */
 cairo_test_status_t
-cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw);
-
-/* Like cairo_test, but the text is expected to fail for the stated
- * reason. Any test calling this variant should be listed in the
- * XFAIL_TESTS list in Makefile.am. */
-cairo_test_status_t
-cairo_test_expect_failure (cairo_test_t		      *test,
-			   cairo_test_draw_function_t  draw,
-			   const char		      *reason);
+cairo_test (cairo_test_t *test);
 
 /* cairo_test_init() and cairo_test_log() exist to help in writing
  * tests for which cairo_test() is not appropriate for one reason or
diff --git a/test/caps-joins-alpha.c b/test/caps-joins-alpha.c
index c28482d..969a9a5 100644
--- a/test/caps-joins-alpha.c
+++ b/test/caps-joins-alpha.c
@@ -34,7 +34,8 @@ cairo_test_t test = {
     "caps-joins-alpha",
     "Test caps and joins with some source alpha",
     3 * (PAD + SIZE) + PAD,
-    PAD + SIZE + PAD
+    PAD + SIZE + PAD,
+    draw
 };
 
 static void
@@ -90,5 +91,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/caps-joins.c b/test/caps-joins.c
index d424145..9b2055a 100644
--- a/test/caps-joins.c
+++ b/test/caps-joins.c
@@ -33,7 +33,8 @@ cairo_test_t test = {
     "caps-joins",
     "Test caps and joins",
     3 * (PAD + SIZE) + PAD,
-    PAD + SIZE + PAD
+    PAD + SIZE + PAD,
+    draw
 };
 
 static void
@@ -87,5 +88,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/caps-sub-paths.c b/test/caps-sub-paths.c
index edb499b..c42c7cd 100644
--- a/test/caps-sub-paths.c
+++ b/test/caps-sub-paths.c
@@ -33,7 +33,8 @@
 cairo_test_t test = {
     "caps-sub-paths",
     "Test that sub-paths receive caps.",
-    20, 20
+    20, 20,
+    draw
 };
 
 static cairo_test_status_t
@@ -65,5 +66,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/clip-all.c b/test/clip-all.c
index d432030..4046073 100644
--- a/test/clip-all.c
+++ b/test/clip-all.c
@@ -31,7 +31,8 @@
 cairo_test_t test = {
     "clip-all",
     "Test clipping with everything clipped out",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -65,5 +66,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/clip-fill-rule-pixel-aligned.c b/test/clip-fill-rule-pixel-aligned.c
index 1b2f490..07b9efe 100644
--- a/test/clip-fill-rule-pixel-aligned.c
+++ b/test/clip-fill-rule-pixel-aligned.c
@@ -32,7 +32,8 @@ cairo_test_t test = {
     "clip-fill-rule-pixel-aligned",
     "Tests interaction of clipping and cairo_set_fill_rule with a pixel-aligned path",
     PAD + (SIZE*4) + PAD + (SIZE*4) + PAD,
-    PAD + (SIZE*4) + PAD
+    PAD + (SIZE*4) + PAD,
+    draw
 };
 
 static void
@@ -91,5 +92,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/clip-fill-rule.c b/test/clip-fill-rule.c
index 74722ce..84619d7 100644
--- a/test/clip-fill-rule.c
+++ b/test/clip-fill-rule.c
@@ -30,7 +30,8 @@
 cairo_test_t test = {
     "clip-fill-rule",
     "Tests interaction of clipping with cairo_set_fill_rule",
-    STAR_SIZE * 2 + 2, STAR_SIZE + 2
+    STAR_SIZE * 2 + 2, STAR_SIZE + 2,
+    draw
 };
 
 static void
@@ -75,5 +76,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/clip-nesting.c b/test/clip-nesting.c
index 1f27c8f..66c277b 100644
--- a/test/clip-nesting.c
+++ b/test/clip-nesting.c
@@ -34,7 +34,8 @@
 cairo_test_t test = {
     "clip-nesting",
     "Test clipping with multiple contexts for the same surface",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -94,5 +95,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/clip-operator.c b/test/clip-operator.c
index 10df2b3..44ea6f4 100644
--- a/test/clip-operator.c
+++ b/test/clip-operator.c
@@ -130,10 +130,11 @@ static void (*draw_funcs[])(cairo_t *cr,
 #define IMAGE_WIDTH (N_OPERATORS * (WIDTH + PAD) + PAD)
 #define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * (HEIGHT + PAD) + PAD)
 
-static cairo_test_t test = {
+cairo_test_t test = {
     "clip-operator",
     "Surface clipping with different operators",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -201,5 +202,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/clip-twice.c b/test/clip-twice.c
index 446447c..d634581 100644
--- a/test/clip-twice.c
+++ b/test/clip-twice.c
@@ -31,7 +31,8 @@
 cairo_test_t test = {
     "clip-twice",
     "Verifies that the clip mask is updated correctly when it constructed by setting the clip path twice.",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -75,5 +76,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/composite-integer-translate-over-repeat.c b/test/composite-integer-translate-over-repeat.c
index 61a0ea7..17eafa1 100644
--- a/test/composite-integer-translate-over-repeat.c
+++ b/test/composite-integer-translate-over-repeat.c
@@ -9,7 +9,8 @@
 cairo_test_t test = {
     "composite-integer-translate-over-repeat",
     "Test simple compositing: integer-translation 32->32 OVER, with repeat",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -58,5 +59,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/composite-integer-translate-over.c b/test/composite-integer-translate-over.c
index 52b4a6c..84c7a04 100644
--- a/test/composite-integer-translate-over.c
+++ b/test/composite-integer-translate-over.c
@@ -10,7 +10,8 @@ const char	png_filename[]	= "romedalen.p
 cairo_test_t test = {
     "composite-integer-translate-over",
     "Test simple compositing: integer-translation 32->32 OVER",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -38,5 +39,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/composite-integer-translate-source.c b/test/composite-integer-translate-source.c
index d2f39a3..f2b8086 100644
--- a/test/composite-integer-translate-source.c
+++ b/test/composite-integer-translate-source.c
@@ -10,7 +10,8 @@ const char	png_filename[]	= "romedalen.p
 cairo_test_t test = {
     "composite-integer-translate-source",
     "Test simple compositing: integer-translation 32->32 SOURCE",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -38,5 +39,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/create-for-stream.c b/test/create-for-stream.c
index 7995e10..b2137ce 100644
--- a/test/create-for-stream.c
+++ b/test/create-for-stream.c
@@ -57,20 +57,27 @@
 #define WIDTH_IN_POINTS  (WIDTH_IN_INCHES  * 72.0)
 #define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72.0)
 
-static void
-draw (cairo_surface_t *surface)
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
 {
-    cairo_t *cr;
-
     /* Just draw a rectangle. */
-    cr = cairo_create (surface);
 
-    cairo_rectangle (cr, WIDTH_IN_POINTS / 10, HEIGHT_IN_POINTS /10,
-		     WIDTH_IN_POINTS - 2 * WIDTH_IN_POINTS / 10,
-		     HEIGHT_IN_POINTS - 2 * HEIGHT_IN_POINTS /10);
+    cairo_rectangle (cr, width / 10., height /10.,
+		     width - 2 * width / 10.,
+		     height - 2 * height /10.);
     cairo_fill (cr);
 
     cairo_show_page (cr);
+}
+
+static void
+draw_to (cairo_surface_t *surface)
+{
+    cairo_t *cr;
+
+    cr = cairo_create (surface);
+
+    draw (cr, WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
 
     cairo_destroy (cr);
 }
@@ -135,7 +142,7 @@ test_surface (const char		 *filename,
 	return CAIRO_TEST_FAILURE;
     }
 
-    draw (surface);
+    draw_to (surface);
 
     cairo_surface_destroy (surface);
 
@@ -154,7 +161,7 @@ test_surface (const char		 *filename,
 	return CAIRO_TEST_FAILURE;
     }
 
-    draw (surface);
+    draw_to (surface);
 
     cairo_surface_destroy (surface);
 
@@ -188,7 +195,7 @@ main (void)
 {
     cairo_test_status_t status;
 
-    printf("\n");
+    cairo_test_init ("create-for-stream");
 
 #if CAIRO_HAS_PS_SURFACE
     status = test_surface ("create-for-stream.ps",
diff --git a/test/create-from-png-stream.c b/test/create-from-png-stream.c
index e4bcda8..2eaeb9f 100644
--- a/test/create-from-png-stream.c
+++ b/test/create-from-png-stream.c
@@ -34,7 +34,8 @@
 cairo_test_t test = {
     "create-from-png-stream",
     "Tests the creation of an image surface from a PNG using a FILE *",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_status_t
@@ -91,5 +92,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/create-from-png.c b/test/create-from-png.c
index a7937bf..da03a11 100644
--- a/test/create-from-png.c
+++ b/test/create-from-png.c
@@ -33,7 +33,8 @@
 cairo_test_t test = {
     "create-from-png",
     "Tests the creation of an image surface from a PNG file",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -76,5 +77,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/dash-caps-joins.c b/test/dash-caps-joins.c
index 6802380..4dd9868 100644
--- a/test/dash-caps-joins.c
+++ b/test/dash-caps-joins.c
@@ -39,7 +39,8 @@ cairo_test_t test = {
     "dash-caps-joins",
     "Test caps and joins when dashing",
     3 * (PAD + SIZE) + PAD,
-    PAD + SIZE + PAD
+    PAD + SIZE + PAD,
+    draw
 };
 
 static void
@@ -96,5 +97,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/dash-offset-negative.c b/test/dash-offset-negative.c
index dd99d58..a2d0269 100644
--- a/test/dash-offset-negative.c
+++ b/test/dash-offset-negative.c
@@ -37,7 +37,8 @@
 cairo_test_t test = {
     "dash-offset-negative",
     "Tests cairo_set_dash with a negative offset",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -101,5 +102,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/dash-scale.c b/test/dash-scale.c
index 3d8a2f7..36ac818 100644
--- a/test/dash-scale.c
+++ b/test/dash-scale.c
@@ -33,7 +33,8 @@ cairo_test_t test = {
     "dash-scale",
     "Test interactions of cairo_set_dash and cairo_scale, (in particular with a non-uniformly scaled pen)",
     3 * (PAD + SIZE) + PAD,
-    PAD + 5 * SIZE + 2 * (2 * PAD) + PAD
+    PAD + 5 * SIZE + 2 * (2 * PAD) + PAD,
+    draw
 };
 
 static void
@@ -121,5 +122,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/dash-zero-length.c b/test/dash-zero-length.c
index 2014c07..1c9361e 100644
--- a/test/dash-zero-length.c
+++ b/test/dash-zero-length.c
@@ -36,7 +36,8 @@
 cairo_test_t test = {
     "dash-zero-length",
     "Tests cairo_set_dash with zero length",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static void
@@ -111,5 +112,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/degenerate-path.c b/test/degenerate-path.c
index 1329bdf..c4272cc 100644
--- a/test/degenerate-path.c
+++ b/test/degenerate-path.c
@@ -31,7 +31,8 @@
 cairo_test_t test = {
     "degenerate-path",
     "Tests the behaviour of degenerate paths with different cap types",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
@@ -64,5 +65,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/device-offset-positive.c b/test/device-offset-positive.c
index e4a6ae8..3d4773d 100644
--- a/test/device-offset-positive.c
+++ b/test/device-offset-positive.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "device-offset-positive",
     "Simple test using a surface with a positive device-offset as a source.",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static void
@@ -84,5 +85,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/device-offset.c b/test/device-offset.c
index b796ba6..1b92c8a 100644
--- a/test/device-offset.c
+++ b/test/device-offset.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "device-offset",
     "Simple test using a surface with a negative device-offset as a source.",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static void
@@ -83,5 +84,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/extend-reflect.c b/test/extend-reflect.c
index 62fe51d..1d53af9 100644
--- a/test/extend-reflect.c
+++ b/test/extend-reflect.c
@@ -8,8 +8,10 @@ const char	png_filename[]	= "romedalen.p
 
 cairo_test_t test = {
     "extend-reflect",
-    "Test CAIRO_EXTEND_REFLECT for surface patterns",
-    SIZE, SIZE
+    "Test CAIRO_EXTEND_REFLECT for surface patterns"
+    "\nCAIRO_EXTEND_REFLECT code is broken and corrupts memory",
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -33,6 +35,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test_expect_failure (&test, draw,
-	   "CAIRO_EXTEND_REFLECT code is broken and corrupts memory.");
+    return cairo_test (&test);
 }
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 37c37f5..3d4b492 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -44,7 +44,7 @@
 #define SIZE INCHES_TO_POINTS(1)
 
 static void
-draw (cairo_t *cr, double width, double height, double ppi)
+draw_with_ppi (cairo_t *cr, double width, double height, double ppi)
 {
     char message[80];
 
@@ -94,7 +94,7 @@ main (void)
 
     num_pages = sizeof (ppi) / sizeof (ppi[0]);
 
-    printf("\n");
+    cairo_test_init ("fallback-resolution");
 
     for (backend=0; backend < NUM_BACKENDS; backend++) {
 
@@ -123,7 +123,7 @@ main (void)
 	{
 	    cairo_surface_set_fallback_resolution (surface, ppi[page], ppi[page]);
 
-	    draw (cr, SIZE, SIZE, ppi[page]);
+	    draw_with_ppi (cr, SIZE, SIZE, ppi[page]);
 
 	    /* Backend-specific means of "advancing a page" */
 	    switch (backend) {
diff --git a/test/fill-and-stroke-alpha-add.c b/test/fill-and-stroke-alpha-add.c
index 2e59cb8..9b672d7 100644
--- a/test/fill-and-stroke-alpha-add.c
+++ b/test/fill-and-stroke-alpha-add.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "fill-and-stroke-alpha-add",
     "Use a group to fill/stroke a path (each with different alpha) using DEST_OUT and ADD to combine",
-    2 * SIZE + 4 * PAD, SIZE + 2 * PAD
+    2 * SIZE + 4 * PAD, SIZE + 2 * PAD,
+    draw
 };
 
 typedef void (*path_func_t) (cairo_t *cr);
@@ -108,5 +109,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/fill-and-stroke-alpha.c b/test/fill-and-stroke-alpha.c
index 3b44415..170fafe 100644
--- a/test/fill-and-stroke-alpha.c
+++ b/test/fill-and-stroke-alpha.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "fill-and-stroke-alpha",
     "Use a group to fill/stroke a path then blend the result with alpha onto the destination",
-    2 * SIZE + 4 * PAD, SIZE + 2 * PAD
+    2 * SIZE + 4 * PAD, SIZE + 2 * PAD,
+    draw
 };
 
 typedef void (*path_func_t) (cairo_t *cr);
@@ -102,5 +103,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/fill-and-stroke.c b/test/fill-and-stroke.c
index c3e295d..382e9f7 100644
--- a/test/fill-and-stroke.c
+++ b/test/fill-and-stroke.c
@@ -31,7 +31,8 @@
 cairo_test_t test = {
     "fill-and-stroke",
     "Tests using cairo_fill_preserve/cairo_stroke to fill/stroke the same path",
-    2 * SIZE + 4 * PAD, SIZE + 2 * PAD
+    2 * SIZE + 4 * PAD, SIZE + 2 * PAD,
+    draw
 };
 
 static cairo_test_status_t
@@ -59,5 +60,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/fill-rule.c b/test/fill-rule.c
index 103208c..f31c70d 100644
--- a/test/fill-rule.c
+++ b/test/fill-rule.c
@@ -69,7 +69,8 @@
 cairo_test_t test = {
     "fill-rule",
     "Tests cairo_set_full_rule with some star shapes",
-    BIG_STAR_SIZE * 2 + 3, BIG_STAR_SIZE + LITTLE_STAR_SIZE + 3
+    BIG_STAR_SIZE * 2 + 3, BIG_STAR_SIZE + LITTLE_STAR_SIZE + 3,
+    draw
 };
 
 /* The SVG start trimmed down, but still showing the bug (originally) */
@@ -128,5 +129,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/filter-nearest-offset.c b/test/filter-nearest-offset.c
index 1c608a4..01db5e8 100644
--- a/test/filter-nearest-offset.c
+++ b/test/filter-nearest-offset.c
@@ -36,8 +36,10 @@
 
 cairo_test_t test = {
     "filter-nearest-offset",
-    "Test sampling offset of CAIRO_FILTER_NEAREST",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    "Test sampling offset of CAIRO_FILTER_NEAREST"
+    "\nwrong sampling location for nearest-neighbor filter in libpixman and Render",
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -102,6 +104,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test_expect_failure (&test, draw,
-				      "wrong sampling location for nearest-neighbor filter in libpixman and Render");
+    return cairo_test (&test);
 }
diff --git a/test/ft-font-create-for-ft-face.c b/test/ft-font-create-for-ft-face.c
index 0bb3b8c..196bacc 100644
--- a/test/ft-font-create-for-ft-face.c
+++ b/test/ft-font-create-for-ft-face.c
@@ -29,7 +29,8 @@
 cairo_test_t test = {
     "ft-font-create-for-ft-face",
     "Simple test to verify that cairo_ft_font_create_for_ft_face doesn't crash.",
-    0, 0
+    0, 0,
+    draw
 };
 
 static cairo_test_status_t
@@ -126,5 +127,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/ft-text-antialias-none.c b/test/ft-text-antialias-none.c
index 8aaaf05..4294f28 100644
--- a/test/ft-text-antialias-none.c
+++ b/test/ft-text-antialias-none.c
@@ -36,7 +36,8 @@
 cairo_test_t test = {
     "ft-text-antialias-none",
     "Tests text rendering with no antialiasing",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_scaled_font_t *
@@ -127,5 +128,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/ft-text-vertical-layout.c b/test/ft-text-vertical-layout.c
index 5a28778..3502b6c 100644
--- a/test/ft-text-vertical-layout.c
+++ b/test/ft-text-vertical-layout.c
@@ -36,7 +36,8 @@
 cairo_test_t test = {
     "ft-text-vertical-layout",
     "Tests text rendering for vertical layout",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_scaled_font_t *
@@ -132,5 +133,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/get-and-set.c b/test/get-and-set.c
index a4faa8f..5589b30 100644
--- a/test/get-and-set.c
+++ b/test/get-and-set.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "get-and-set",
     "Tests calls to the most trivial cairo_get and cairo_set functions",
-    0, 0
+    0, 0,
+    draw
 };
 
 typedef struct {
@@ -111,7 +112,7 @@ settings_equal (settings_t *a, settings_
 }
 
 static cairo_test_status_t
-get_and_set (cairo_t *cr, int width, int height)
+draw (cairo_t *cr, int width, int height)
 {
     settings_t check;
 
@@ -138,5 +139,5 @@ get_and_set (cairo_t *cr, int width, int
 int
 main (void)
 {
-    return cairo_test (&test, get_and_set);
+    return cairo_test (&test);
 }
diff --git a/test/get-group-target.c b/test/get-group-target.c
index d0a5164..009087b 100644
--- a/test/get-group-target.c
+++ b/test/get-group-target.c
@@ -31,7 +31,8 @@
 cairo_test_t test = {
     "get-group-target",
     "Test of both cairo_get_group_target and cairo_surface_get_device_offset",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -86,5 +87,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/glyph-cache-pressure.c b/test/glyph-cache-pressure.c
index bcc5250..3661fa3 100644
--- a/test/glyph-cache-pressure.c
+++ b/test/glyph-cache-pressure.c
@@ -52,7 +52,8 @@
 cairo_test_t test = {
     "glyph-cache-pressure",
     "Ensure that all backends behave well under artificial glyph cache pressure",
-    223, TEXT_SIZE + 4
+    223, TEXT_SIZE + 4,
+    draw
 };
 
 static cairo_test_status_t
@@ -92,5 +93,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/gradient-alpha.c b/test/gradient-alpha.c
index 6ae06aa..1ec1559 100644
--- a/test/gradient-alpha.c
+++ b/test/gradient-alpha.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "gradient-alpha",
     "Tests drawing of a gradient with various alpha values in the color stops",
-    10, 10
+    10, 10,
+    draw
 };
 
 static cairo_test_status_t
@@ -57,5 +58,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/leaky-dash.c b/test/leaky-dash.c
index 44f04f0..961c620 100644
--- a/test/leaky-dash.c
+++ b/test/leaky-dash.c
@@ -36,8 +36,10 @@
 
 cairo_test_t test = {
     "leaky-dash",
-    "Exercises bug #4863 in which a dashed stroke leaks into half the rectangle being filled",
-    WIDTH, HEIGHT
+    "Exercises bug #4863 in which a dashed stroke leaks into half the rectangle being filled"
+    "\nknown bug (#4863) which has existed since the 1.0 release",
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -64,6 +66,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test_expect_failure (&test, draw,
-				      "known bug (#4863) which has existed since the 1.0 release");
+    return cairo_test (&test);
 }
diff --git a/test/leaky-polygon.c b/test/leaky-polygon.c
index f349044..69884e6 100644
--- a/test/leaky-polygon.c
+++ b/test/leaky-polygon.c
@@ -59,7 +59,8 @@
 cairo_test_t test = {
     "leaky-polygon",
     "Exercises a corner case in the trapezoid rasterization in which pixels outside the trapezoids received a non-zero alpha",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -86,5 +87,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/line-width-scale.c b/test/line-width-scale.c
index c733262..b06e982 100644
--- a/test/line-width-scale.c
+++ b/test/line-width-scale.c
@@ -55,7 +55,8 @@
 cairo_test_t test = {
     "line-width-scale",
     "Tests interaction of cairo_set_line_width with cairo_scale",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static void
@@ -182,5 +183,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/line-width.c b/test/line-width.c
index 67f92bc..6d112c9 100644
--- a/test/line-width.c
+++ b/test/line-width.c
@@ -33,7 +33,8 @@
 cairo_test_t test = {
     "line-width",
     "Tests cairo_set_line_width",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -65,5 +66,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/linear-gradient.c b/test/linear-gradient.c
index 8d09df3..fd8da68 100644
--- a/test/linear-gradient.c
+++ b/test/linear-gradient.c
@@ -57,7 +57,8 @@ static const int n_stops[] = { 2, 3 };
 cairo_test_t test = {
     "linear-gradient",
     "Tests the drawing of linear gradients",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static void
@@ -133,5 +134,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/mask-ctm.c b/test/mask-ctm.c
index 1196e4d..8c5d4bd 100644
--- a/test/mask-ctm.c
+++ b/test/mask-ctm.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "mask-ctm",
     "Test that cairo_mask is affected properly by the CTM",
-    10, 10
+    10, 10,
+    draw
 };
 
 static cairo_test_status_t
@@ -78,5 +79,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/mask-surface-ctm.c b/test/mask-surface-ctm.c
index 182bdc2..ea807f9 100644
--- a/test/mask-surface-ctm.c
+++ b/test/mask-surface-ctm.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "mask-surface-ctm",
     "Test that cairo_mask_surface is affected properly by the CTM",
-    10, 10
+    10, 10,
+    draw
 };
 
 static cairo_test_status_t
@@ -71,5 +72,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/mask.c b/test/mask.c
index 33e7ead..faaecd6 100644
--- a/test/mask.c
+++ b/test/mask.c
@@ -179,10 +179,11 @@ static void (*clip_funcs[])(cairo_t *cr,
 #define IMAGE_WIDTH (ARRAY_SIZE (pattern_funcs) * (WIDTH + PAD) + PAD)
 #define IMAGE_HEIGHT (ARRAY_SIZE (mask_funcs) * ARRAY_SIZE (clip_funcs) * (HEIGHT + PAD) + PAD)
 
-static cairo_test_t test = {
+cairo_test_t test = {
     "mask",
     "Tests of cairo_mask",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -242,5 +243,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/move-to-show-surface.c b/test/move-to-show-surface.c
index 74cf3a0..2b5cc40 100644
--- a/test/move-to-show-surface.c
+++ b/test/move-to-show-surface.c
@@ -48,7 +48,8 @@
 cairo_test_t test = {
     "move-to-show-surface",
     "Tests calls to cairo_show_surface after cairo_move_to",
-    2, 2
+    2, 2,
+    draw
 };
 
 static cairo_test_status_t
@@ -77,5 +78,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/multi-page.c b/test/multi-page.c
index f6780b4..05230c7 100644
--- a/test/multi-page.c
+++ b/test/multi-page.c
@@ -53,7 +53,7 @@
 #define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72.0)
 
 static void
-draw (cairo_t *cr, double width, double height, double smile_ratio)
+draw_smiley (cairo_t *cr, double width, double height, double smile_ratio)
 {
 #define STROKE_WIDTH .04
     double size;
@@ -112,8 +112,8 @@ draw_some_pages (cairo_surface_t *surfac
 
 #define NUM_FRAMES 5
     for (i=0; i < NUM_FRAMES; i++) {
-	draw (cr, WIDTH_IN_POINTS, HEIGHT_IN_POINTS,
-	      (double) i / (NUM_FRAMES - 1));
+	draw_smiley (cr, WIDTH_IN_POINTS, HEIGHT_IN_POINTS,
+	             (double) i / (NUM_FRAMES - 1));
 
 	/* Duplicate the last frame onto another page. (This is just a
 	 * way to sneak cairo_copy_page into the test).
@@ -134,7 +134,7 @@ main (void)
     cairo_status_t status;
     char *filename;
 
-    printf("\n");
+    cairo_test_init ("multi-page");
 
 #if CAIRO_HAS_PS_SURFACE
     filename = "multi-page.ps";
diff --git a/test/new-sub-path.c b/test/new-sub-path.c
index 90e0c73..bff3a76 100644
--- a/test/new-sub-path.c
+++ b/test/new-sub-path.c
@@ -31,7 +31,8 @@ cairo_test_t test = {
     "new-sub-path",
     "Test the cairo_new_sub_path call",
     8 * SIZE,
-    3 * SIZE
+    3 * SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -75,5 +76,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/nil-surface.c b/test/nil-surface.c
index ba2a597..5819cb0 100644
--- a/test/nil-surface.c
+++ b/test/nil-surface.c
@@ -35,7 +35,8 @@
 cairo_test_t test = {
     "nil-surface",
     "Test that nil surfaces do not make cairo crash.",
-    1, 1
+    1, 1,
+    draw
 };
 
 static cairo_test_status_t
@@ -105,5 +106,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/operator-clear.c b/test/operator-clear.c
index 6bd5298..89fdd3e 100644
--- a/test/operator-clear.c
+++ b/test/operator-clear.c
@@ -146,10 +146,11 @@ static void (*draw_funcs[])(cairo_t *cr,
 #define IMAGE_WIDTH (ARRAY_SIZE (pattern_funcs) * (WIDTH + PAD) + PAD)
 #define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * (HEIGHT + PAD) + PAD)
 
-static cairo_test_t test = {
+cairo_test_t test = {
     "operator-clear",
     "Test of CAIRO_OPERATOR_CLEAR",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -210,5 +211,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/operator-source.c b/test/operator-source.c
index fd9ad5b..17c0457 100644
--- a/test/operator-source.c
+++ b/test/operator-source.c
@@ -185,10 +185,11 @@ static void (*draw_funcs[])(cairo_t *cr,
 #define IMAGE_WIDTH (ARRAY_SIZE (pattern_funcs) * (WIDTH + PAD) + PAD)
 #define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * (HEIGHT + PAD) + PAD)
 
-static cairo_test_t test = {
+cairo_test_t test = {
     "operator-source",
     "Test of CAIRO_OPERATOR_SOURCE",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -249,5 +250,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/paint-source-alpha.c b/test/paint-source-alpha.c
index 8971939..afef333 100644
--- a/test/paint-source-alpha.c
+++ b/test/paint-source-alpha.c
@@ -29,7 +29,8 @@
 cairo_test_t test = {
     "paint-source-alpha",
     "Simple test of cairo_paint with a source surface with non-opaque alpha",
-    32, 32
+    32, 32,
+    draw
 };
 
 static cairo_test_status_t
@@ -63,5 +64,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/paint-with-alpha.c b/test/paint-with-alpha.c
index b204b08..81e2138 100644
--- a/test/paint-with-alpha.c
+++ b/test/paint-with-alpha.c
@@ -29,7 +29,8 @@
 cairo_test_t test = {
     "paint-with-alpha",
     "Simple test of cairo_paint_with_alpha",
-    32, 32
+    32, 32,
+    draw
 };
 
 static cairo_test_status_t
@@ -63,5 +64,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/paint.c b/test/paint.c
index 126becc..e76a545 100644
--- a/test/paint.c
+++ b/test/paint.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "paint",
     "Test calls to cairo_paint",
-    8, 8
+    8, 8,
+    draw
 };
 
 static cairo_test_status_t
@@ -49,5 +50,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/path-data.c b/test/path-data.c
index 13b5fcc..9868205 100644
--- a/test/path-data.c
+++ b/test/path-data.c
@@ -29,7 +29,8 @@
 cairo_test_t test = {
     "path-data",
     "Tests calls to path_data functions: cairo_copy_path_data, cairo_copy_path_data_flat, and cairo_append_path_data",
-    45, 53
+    45, 53,
+    draw
 };
 
 static void
@@ -201,5 +202,5 @@ main (void)
 
     cairo_surface_destroy (surface);
 
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/pdf-features.c b/test/pdf-features.c
index 4488084..a46500f 100644
--- a/test/pdf-features.c
+++ b/test/pdf-features.c
@@ -95,7 +95,7 @@ main (void)
     char *filename;
     int i;
 
-    printf("\n");
+    cairo_test_init ("pdf-features");
 
     filename = "pdf-features.pdf";
 
diff --git a/test/pixman-rotate.c b/test/pixman-rotate.c
index 9c3a0fb..e02d918 100644
--- a/test/pixman-rotate.c
+++ b/test/pixman-rotate.c
@@ -16,7 +16,8 @@
 cairo_test_t test = {
     "pixman-rotate",
     "Exposes pixman off-by-one error when rotating",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 /* Draw the word cairo at NUM_TEXT different angles */
@@ -70,5 +71,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/ps-features.c b/test/ps-features.c
index d8a5b6e..331aa53 100644
--- a/test/ps-features.c
+++ b/test/ps-features.c
@@ -99,7 +99,7 @@ main (void)
     int i;
     char dsc[255];
 
-    printf("\n");
+    cairo_test_init ("ps-features");
 
     filename = "ps-features.ps";
 
diff --git a/test/push-group.c b/test/push-group.c
index 58294e1..f777786 100644
--- a/test/push-group.c
+++ b/test/push-group.c
@@ -35,7 +35,8 @@
 cairo_test_t test = {
     "push-group",
     "Verify that cairo_push_group works.",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -113,5 +114,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/rectangle-rounding-error.c b/test/rectangle-rounding-error.c
index c183634..4d0d35e 100644
--- a/test/rectangle-rounding-error.c
+++ b/test/rectangle-rounding-error.c
@@ -34,7 +34,8 @@ cairo_test_t test = {
     "rectangle-rounding-error",
     "This demonstrates (or not) a rounding error that causes a gap between "
     "two neighbouring rectangles.",
-    76, 76
+    76, 76,
+    draw
 };
 
 static cairo_test_status_t
@@ -65,5 +66,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/rel-path.c b/test/rel-path.c
index 3083cda..d82e62a 100644
--- a/test/rel-path.c
+++ b/test/rel-path.c
@@ -29,7 +29,8 @@
 cairo_test_t test = {
     "rel-path",
     "Tests calls to various relative path functions",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -52,5 +53,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/scale-source-surface-paint.c b/test/scale-source-surface-paint.c
index c2b76d3..d98b260 100644
--- a/test/scale-source-surface-paint.c
+++ b/test/scale-source-surface-paint.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "scale-source-surface-paint",
     "Test call sequence: cairo_scale; cairo_set_source_surface; cairo_paint",
-    12, 12
+    12, 12,
+    draw
 };
 
 static cairo_test_status_t
@@ -60,5 +61,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/select-font-face.c b/test/select-font-face.c
index 3e3848f..20ade00 100644
--- a/test/select-font-face.c
+++ b/test/select-font-face.c
@@ -30,7 +30,8 @@
 cairo_test_t test = {
     "select-font-face",
     "Tests using cairo_select_font_face to draw text in different faces",
-    192, TEXT_SIZE + 4
+    192, TEXT_SIZE + 4,
+    draw
 };
 
 static cairo_test_status_t
@@ -79,5 +80,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/select-font-no-show-text.c b/test/select-font-no-show-text.c
index b99dfea..74bc1e9 100644
--- a/test/select-font-no-show-text.c
+++ b/test/select-font-no-show-text.c
@@ -41,10 +41,11 @@
 #include <math.h>
 #include "cairo-test.h"
 
-static cairo_test_t test = {
+cairo_test_t test = {
     "select-font-no-show-text",
     "Test calling cairo_select_font_face but never drawing text.",
-    0, 0
+    0, 0,
+    draw
 };
 
 static cairo_test_status_t
@@ -60,5 +61,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/self-copy.c b/test/self-copy.c
index b0f0432..c872f7f 100644
--- a/test/self-copy.c
+++ b/test/self-copy.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "self-copy",
     "Test copying from a surface to itself with a clip",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -85,5 +86,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/self-intersecting.c b/test/self-intersecting.c
index 2dfd796..77547cb 100644
--- a/test/self-intersecting.c
+++ b/test/self-intersecting.c
@@ -46,8 +46,10 @@
 
 cairo_test_t test = {
     "self-intersecting",
-    "Test strokes of self-intersecting paths",
-    10, 20
+    "Test strokes of self-intersecting paths"
+    "\nSelf-intersecting strokes are wrong due to incremental trapezoidization.",
+    10, 20,
+    draw
 };
 
 static cairo_test_status_t
@@ -84,6 +86,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test_expect_failure (&test, draw,
-    "Self-intersecting strokes are wrong due to incremental trapezoidization.");
+    return cairo_test (&test);
 }
diff --git a/test/set-source.c b/test/set-source.c
index 08e9e3e..87953b6 100644
--- a/test/set-source.c
+++ b/test/set-source.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "set-source",
     "Tests calls to various set_source functions",
-    5, 5
+    5, 5,
+    draw
 };
 
 static cairo_test_status_t
@@ -83,5 +84,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/show-glyphs-many.c b/test/show-glyphs-many.c
index 3c44411..95cca92 100644
--- a/test/show-glyphs-many.c
+++ b/test/show-glyphs-many.c
@@ -81,7 +81,8 @@
 cairo_test_t test = {
     "show-glyphs-many",
     "Test that cairo_show_glyps works when handed 'many' glyphs",
-    9, 11
+    9, 11,
+    draw
 };
 
 static cairo_test_status_t
@@ -123,5 +124,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/show-text-current-point.c b/test/show-text-current-point.c
index 4595a8e..d551ea4 100644
--- a/test/show-text-current-point.c
+++ b/test/show-text-current-point.c
@@ -30,7 +30,8 @@
 cairo_test_t test = {
     "show-text-current-point",
     "Test that cairo_show_text adjusts the current point properly",
-    263, TEXT_SIZE + 4
+    263, TEXT_SIZE + 4,
+    draw
 };
 
 static cairo_test_status_t
@@ -70,5 +71,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/source-clip.c b/test/source-clip.c
index c0f4172..e8f6dea 100644
--- a/test/source-clip.c
+++ b/test/source-clip.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "source-clip",
     "Test using a surface with an active clip as a source",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -80,5 +81,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/source-surface-scale-paint.c b/test/source-surface-scale-paint.c
index 472630c..f1da8c5 100644
--- a/test/source-surface-scale-paint.c
+++ b/test/source-surface-scale-paint.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "source-surface-scale-paint",
     "Test call sequence: cairo_set_source_surface; cairo_scale; cairo_paint",
-    8, 8
+    8, 8,
+    draw
 };
 
 static cairo_test_status_t
@@ -59,5 +60,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/surface-finish-twice.c b/test/surface-finish-twice.c
index 30103bd..9a6a028 100644
--- a/test/surface-finish-twice.c
+++ b/test/surface-finish-twice.c
@@ -45,7 +45,8 @@
 cairo_test_t test = {
     "surface-finish-twice",
     "Test to exercise a crash when calling cairo_surface_finish twice on the same surface.",
-    0, 0
+    0, 0,
+    draw
 };
 
 static cairo_test_status_t
@@ -71,5 +72,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/surface-pattern.c b/test/surface-pattern.c
index 3dbdf83..3124d76 100644
--- a/test/surface-pattern.c
+++ b/test/surface-pattern.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "surface-pattern",
     "Tests use of a surface pattern",
-    36, 36
+    36, 36,
+    draw
 };
 
 static cairo_test_status_t
@@ -70,5 +71,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/svg-clip.c b/test/svg-clip.c
index d4d98db..dcdf028 100644
--- a/test/svg-clip.c
+++ b/test/svg-clip.c
@@ -110,7 +110,7 @@ main (void)
     const char *filename = "svg-clip.svg";
     cairo_surface_t *surface;
 
-    printf("\n");
+    cairo_test_init ("svg-clip");
 
     surface = cairo_svg_surface_create (filename,
 					WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
diff --git a/test/svg-surface.c b/test/svg-surface.c
index 08daaac..305227c 100644
--- a/test/svg-surface.c
+++ b/test/svg-surface.c
@@ -35,11 +35,11 @@
 
 #define WIDTH_IN_INCHES  3
 #define HEIGHT_IN_INCHES 3
-#define WIDTH_IN_POINTS  (WIDTH_IN_INCHES  * 72.0)
-#define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72.0)
+#define WIDTH_IN_POINTS  (WIDTH_IN_INCHES  * 72)
+#define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72)
 
-static void
-draw (cairo_t *cr, double width, double height)
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
 {
 #define STROKE_WIDTH .04
 
@@ -91,7 +91,7 @@ main (void)
     const char *filename = "svg-surface.svg";
     cairo_surface_t *surface;
 
-    printf("\n");
+    cairo_test_init ("svg-surface");
 
     surface = cairo_svg_surface_create (filename,
 					WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
diff --git a/test/text-antialias-gray.c b/test/text-antialias-gray.c
index 2b6f80c..1a044eb 100644
--- a/test/text-antialias-gray.c
+++ b/test/text-antialias-gray.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "text-antialias-gray",
     "Tests text rendering with grayscale antialiasing",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -78,5 +79,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/text-antialias-none.c b/test/text-antialias-none.c
index 32a93f4..4d9d656 100644
--- a/test/text-antialias-none.c
+++ b/test/text-antialias-none.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "text-antialias-none",
     "Tests text rendering with no antialiasing",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -78,5 +79,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/text-antialias-subpixel.c b/test/text-antialias-subpixel.c
index e4a6d06..b78007c 100644
--- a/test/text-antialias-subpixel.c
+++ b/test/text-antialias-subpixel.c
@@ -32,7 +32,8 @@
 cairo_test_t test = {
     "text-antialias-subpixel",
     "Tests text rendering with subpixel antialiasing",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -79,5 +80,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/text-cache-crash.c b/test/text-cache-crash.c
index a1d73e6..2b78813 100644
--- a/test/text-cache-crash.c
+++ b/test/text-cache-crash.c
@@ -66,6 +66,7 @@ cairo_test_t test = {
     "text-cache-crash",
     "Test case for bug causing an assertion failure in _cairo_cache_lookup",
     0, 0,
+    draw
 };
 #include <cairo.h>
 
@@ -114,9 +115,5 @@ Aborted
 int
 main (void)
 {
-    int ret;
-
-    ret = cairo_test (&test, draw);
-
-    return ret;
+    return cairo_test (&test);
 }
diff --git a/test/text-pattern.c b/test/text-pattern.c
index a641234..7c6c7e7 100644
--- a/test/text-pattern.c
+++ b/test/text-pattern.c
@@ -31,7 +31,8 @@
 cairo_test_t test = {
     "text-pattern",
     "Patterned Text",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -75,5 +76,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/text-rotate.c b/test/text-rotate.c
index c71a3e3..39e868a 100644
--- a/test/text-rotate.c
+++ b/test/text-rotate.c
@@ -86,8 +86,10 @@
 
 cairo_test_t test = {
     "text-rotate",
-    "Tests show_text under various rotations",
-    WIDTH, HEIGHT
+    "Tests show_text under various rotations"
+    "\nminor bugs in positioning rotated glyphs",
+    WIDTH, HEIGHT,
+    draw
 };
 
 /* Draw the word cairo at NUM_TEXT different angles */
@@ -150,6 +152,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test_expect_failure (&test, draw,
-				      "minor bugs in positioning rotated glyphs");
+    return cairo_test (&test);
 }
diff --git a/test/transforms.c b/test/transforms.c
index ade26e2..c0d0c34 100644
--- a/test/transforms.c
+++ b/test/transforms.c
@@ -31,7 +31,8 @@
 cairo_test_t test = {
     "transforms",
     "Test various transformations.",
-    WIDTH, HEIGHT
+    WIDTH, HEIGHT,
+    draw
 };
 
 static void
@@ -113,5 +114,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/translate-show-surface.c b/test/translate-show-surface.c
index cc0cb07..574a419 100644
--- a/test/translate-show-surface.c
+++ b/test/translate-show-surface.c
@@ -46,7 +46,8 @@
 cairo_test_t test = {
     "translate-show-surface",
     "Tests calls to cairo_show_surface after cairo_translate",
-    2, 2
+    2, 2,
+    draw
 };
 
 static cairo_test_status_t
@@ -79,5 +80,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/trap-clip.c b/test/trap-clip.c
index 2e9cbc6..3adeb34 100644
--- a/test/trap-clip.c
+++ b/test/trap-clip.c
@@ -164,10 +164,11 @@ static void (*clip_funcs[])(cairo_t *cr,
 #define IMAGE_WIDTH (ARRAY_SIZE (pattern_funcs) * (WIDTH + PAD) + PAD)
 #define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * ARRAY_SIZE (clip_funcs) * (HEIGHT + PAD) + PAD)
 
-static cairo_test_t test = {
+cairo_test_t test = {
     "trap-clip",
     "Trapezoid clipping",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -204,5 +205,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/unantialiased-shapes.c b/test/unantialiased-shapes.c
index eaadf41..b679997 100644
--- a/test/unantialiased-shapes.c
+++ b/test/unantialiased-shapes.c
@@ -28,7 +28,8 @@
 cairo_test_t test = {
     "unantialiased-shapes",
     "Test shape drawing without antialiasing",
-    320, 240
+    320, 240,
+    draw
 };
 
 /* The star shape from the SVG test suite, from the fill rule test */
@@ -99,5 +100,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/unbounded-operator.c b/test/unbounded-operator.c
index 74c9537..1b14268 100644
--- a/test/unbounded-operator.c
+++ b/test/unbounded-operator.c
@@ -132,10 +132,11 @@ static cairo_operator_t operators[] = {
 #define IMAGE_WIDTH (ARRAY_SIZE (operators) * (WIDTH + PAD) + PAD)
 #define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * (HEIGHT + PAD) + PAD)
 
-static cairo_test_t test = {
+cairo_test_t test = {
     "unbounded-operator",
     "Operators with an effect for transparent source/mask",
-    IMAGE_WIDTH, IMAGE_HEIGHT
+    IMAGE_WIDTH, IMAGE_HEIGHT,
+    draw
 };
 
 static cairo_test_status_t
@@ -197,5 +198,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }
diff --git a/test/xlib-surface.c b/test/xlib-surface.c
index 559c19a..e20b6eb 100644
--- a/test/xlib-surface.c
+++ b/test/xlib-surface.c
@@ -220,7 +220,7 @@ main (void)
     cairo_bool_t offscreen;
     result = 0;
 
-    printf("\n");
+    cairo_test_init ("xlib-surface");
     log_file = fopen ("xlib-surface.log", "w");
     if (log_file == NULL) {
 	fprintf (stderr, "Error opening log file: %s\n", "xlib-surface.log");
diff --git a/test/zero-alpha.c b/test/zero-alpha.c
index 0dbad58..c67c382 100644
--- a/test/zero-alpha.c
+++ b/test/zero-alpha.c
@@ -45,7 +45,8 @@
 cairo_test_t test = {
     "zero-alpha",
     "Testing that drawing with zero alpha has no effect",
-    SIZE, SIZE
+    SIZE, SIZE,
+    draw
 };
 
 static cairo_test_status_t
@@ -93,5 +94,5 @@ draw (cairo_t *cr, int width, int height
 int
 main (void)
 {
-    return cairo_test (&test, draw);
+    return cairo_test (&test);
 }


More information about the cairo-commit mailing list