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.
This commit is contained in:
Behdad Esfahbod 2006-07-11 22:19:39 -04:00
parent 94bdbc15f7
commit 973d3a3d14
94 changed files with 386 additions and 260 deletions

1
test/.gitignore vendored
View file

@ -114,6 +114,7 @@ unbounded-operator
user-data
xlib-surface
zero-alpha
valgrind-log
*-out.pdf
*-out.png
*-out.ps

View file

@ -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:

View file

@ -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

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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 *

View file

@ -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

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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",

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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) {

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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";

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -95,7 +95,7 @@ main (void)
char *filename;
int i;
printf("\n");
cairo_test_init ("pdf-features");
filename = "pdf-features.pdf";

View file

@ -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);
}

View file

@ -99,7 +99,7 @@ main (void)
int i;
char dsc[255];
printf("\n");
cairo_test_init ("ps-features");
filename = "ps-features.ps";

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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");

View file

@ -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);
}