diff --git a/test/.gitignore b/test/.gitignore index a6865b97c..a0255e7c9 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 75ab81c85..c96f7a70e 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 0fb7f7254..468ff4a0e 100644 --- a/test/README +++ b/test/README @@ -22,12 +22,12 @@ These come very handy when doing development, but should not be used 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 e547ecce2..b619025bb 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 6351a3fa5..3707a35aa 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 bea87f495..8b4ae1172 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 *test, 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, cairo_test_draw_function_t draw, }; #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, cairo_test_draw_function_t draw, 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, cairo_test_draw_function_t draw, } 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, cairo_test_draw_function_t draw, 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, cairo_test_draw_function_t draw, 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, cairo_test_draw_function_t draw, /* 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_draw_function_t draw, 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, cairo_test_draw_function_t draw, 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_draw_function_t draw, } 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 f33ea1e4f..fbcbf29ef 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_test_draw_function_t) (cairo_t *cr, int wid * 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 c28482dac..969a9a536 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 d42414562..9b2055a94 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 edb499b8a..c42c7cd04 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 d4320309b..404607374 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 1b2f49068..07b9efed9 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 74722ce88..84619d741 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 1f27c8ffa..66c277b87 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 10df2b358..44ea6f46f 100644 --- a/test/clip-operator.c +++ b/test/clip-operator.c @@ -130,10 +130,11 @@ static void (*draw_funcs[])(cairo_t *cr, int x, int y) = { #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 446447c68..d63458125 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 61a0ea71a..17eafa138 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 52b4a6c47..84c7a04b2 100644 --- a/test/composite-integer-translate-over.c +++ b/test/composite-integer-translate-over.c @@ -10,7 +10,8 @@ const char png_filename[] = "romedalen.png"; 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 d2f39a351..f2b808694 100644 --- a/test/composite-integer-translate-source.c +++ b/test/composite-integer-translate-source.c @@ -10,7 +10,8 @@ const char png_filename[] = "romedalen.png"; 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 7995e1051..b2137cec6 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 e4bcda80d..2eaeb9f4f 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 a7937bf2b..da03a1199 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 68023806d..4dd9868ec 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 dd99d58e4..a2d0269bb 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 3d8a2f774..36ac818b4 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 2014c07e6..1c9361e2b 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 1329bdfe4..c4272cc52 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 e4a6ae835..3d4773d84 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 b796ba670..1b92c8a23 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 62fe51dd6..1d53af9bb 100644 --- a/test/extend-reflect.c +++ b/test/extend-reflect.c @@ -8,8 +8,10 @@ const char png_filename[] = "romedalen.png"; 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 37c37f546..3d4b4921c 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 2e59cb814..9b672d7cf 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 3b444155a..170fafea9 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 c3e295d0c..382e9f741 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 103208cab..f31c70dcd 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 1c608a4d9..01db5e8b7 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 0bb3b8c0d..196bacc53 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 8aaaf054f..4294f28eb 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 5a2877879..3502b6c13 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 a4faa8fa2..5589b304d 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_t *b) } 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 height) 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 d0a516463..009087bd7 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 bcc525036..3661fa310 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 6ae06aacd..1ec155990 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 44f04f0a9..961c62086 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 f34904446..69884e65b 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 c733262a5..b06e982b9 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 67f92bc22..6d112c99b 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 8d09df381..fd8da6801 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 1196e4db4..8c5d4bd68 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 182bdc2c1..ea807f95a 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 33e7eadc1..faaecd629 100644 --- a/test/mask.c +++ b/test/mask.c @@ -179,10 +179,11 @@ static void (*clip_funcs[])(cairo_t *cr, int x, int y) = { #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 74cf3a019..2b5cc401f 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 f6780b493..05230c795 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 *surface) #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 90e0c7308..bff3a7634 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 ba2a59744..5819cb0b5 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 6bd5298c5..89fdd3e96 100644 --- a/test/operator-clear.c +++ b/test/operator-clear.c @@ -146,10 +146,11 @@ static void (*draw_funcs[])(cairo_t *cr, int x, int y) = { #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 fd9ad5bf9..17c045729 100644 --- a/test/operator-source.c +++ b/test/operator-source.c @@ -185,10 +185,11 @@ static void (*draw_funcs[])(cairo_t *cr, int x, int y) = { #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 8971939a0..afef33314 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 b204b0865..81e2138af 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 126becc9c..e76a5451c 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 13b5fcc51..9868205d7 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 4488084ae..a46500f09 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 9c3a0fb20..e02d91824 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 d8a5b6eb8..331aa539d 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 58294e19d..f77778661 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 c18363420..4d0d35ebf 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 3083cda95..d82e62a63 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 c2b76d3b0..d98b260a3 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 3e3848fc1..20ade007d 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 b99dfeaef..74bc1e9ea 100644 --- a/test/select-font-no-show-text.c +++ b/test/select-font-no-show-text.c @@ -41,10 +41,11 @@ #include #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 b0f043259..c872f7f86 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 2dfd79681..77547cb41 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 08e9e3e2e..87953b6ac 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 3c444114d..95cca92fe 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 4595a8e91..d551ea42c 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 c0f4172bd..e8f6dea90 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 472630cad..f1da8c533 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 30103bdc3..9a6a02857 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 3dbdf83c4..3124d76ec 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 d4d98dbc5..dcdf02818 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 08daaac1f..305227c52 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 2b6f80ca7..1a044ebc8 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 32a93f4ea..4d9d6560f 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 e4a6d06f5..b78007c2b 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 a1d73e6e9..2b78813f2 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 @@ -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 a641234c9..7c6c7e724 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 c71a3e394..39e868a6c 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 ade26e245..c0d0c3460 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 cc0cb0700..574a419f6 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 2e9cbc64c..3adeb344e 100644 --- a/test/trap-clip.c +++ b/test/trap-clip.c @@ -164,10 +164,11 @@ static void (*clip_funcs[])(cairo_t *cr, int x, int y) = { #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 eaadf417a..b6799970f 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 74c95373d..1b14268e4 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 559c19ad6..e20b6ebfc 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 0dbad58b9..c67c382d8 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); }