summaryrefslogtreecommitdiff
path: root/test/fallback-resolution.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-03 16:38:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-10-31 12:30:11 +0000
commite90073f7ddc6f461a935bc360c409b04f1fe9f74 (patch)
treeefda94d1ecd13143cdad23f14552661165e7601e /test/fallback-resolution.c
parent8457972d40088cda165f31fdd7bd9b4c19c6e095 (diff)
downloadcairo-e90073f7ddc6f461a935bc360c409b04f1fe9f74.tar.gz
[test] Build test suite into single binary.
Avoid calling libtool to link every single test case, by building just one binary from all the sources. This binary is then given the task of choosing tests to run (based on user selection and individual test requirement), forking each test into its own process and accumulating the results.
Diffstat (limited to 'test/fallback-resolution.c')
-rw-r--r--test/fallback-resolution.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 8b5842e2d..ab6a0edec 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -295,10 +295,9 @@ generate_reference (double ppi_x, double ppi_y, const char *filename)
}
#endif
-int
-main (void)
+static cairo_test_status_t
+preamble (cairo_test_context_t *ctx)
{
- cairo_test_context_t ctx;
cairo_t *cr;
cairo_test_status_t ret = CAIRO_TEST_UNTESTED;
double ppi[] = { 600., 300., 150., 75., 72, 37.5 };
@@ -307,8 +306,6 @@ main (void)
num_ppi = sizeof (ppi) / sizeof (ppi[0]);
- cairo_test_init (&ctx, "fallback-resolution");
-
#if GENERATE_REFERENCE
for (ppi_x = 0; ppi_x < num_ppi; ppi_x++) {
for (ppi_y = 0; ppi_y < num_ppi; ppi_y++) {
@@ -321,8 +318,8 @@ main (void)
}
#endif
- for (i = 0; i < ctx.num_targets; i++) {
- const cairo_boilerplate_target_t *target = ctx.targets_to_test[i];
+ for (i = 0; i < ctx->num_targets; i++) {
+ const cairo_boilerplate_target_t *target = ctx->targets_to_test[i];
cairo_surface_t *surface = NULL;
char *base_name;
void *closure;
@@ -381,7 +378,7 @@ main (void)
0,
&closure);
if (surface == NULL || cairo_surface_status (surface)) {
- cairo_test_log (&ctx, "Failed to generate surface: %s-%s\n",
+ cairo_test_log (ctx, "Failed to generate surface: %s-%s\n",
target->name,
format);
free (base_name);
@@ -389,7 +386,7 @@ main (void)
continue;
}
- cairo_test_log (&ctx,
+ cairo_test_log (ctx,
"Testing fallback-resolution %gx%g with %s target\n",
ppi[ppi_x], ppi[ppi_y], target->name);
printf ("%s:\t", base_name);
@@ -438,12 +435,12 @@ main (void)
pass = FALSE;
if (status) {
- cairo_test_log (&ctx, "Error: Failed to create target surface: %s\n",
+ cairo_test_log (ctx, "Error: Failed to create target surface: %s\n",
cairo_status_to_string (status));
ret = CAIRO_TEST_FAILURE;
} else {
/* extract the image and compare it to our reference */
- if (! check_result (&ctx, target, test_name, base_name, surface))
+ if (! check_result (ctx, target, test_name, base_name, surface))
ret = CAIRO_TEST_FAILURE;
else
pass = TRUE;
@@ -464,7 +461,12 @@ main (void)
}
}
- cairo_test_fini (&ctx);
-
return ret;
}
+
+CAIRO_TEST (fallback_resolution,
+ "Check handling of fallback resolutions",
+ "fallback", /* keywords */
+ NULL, /* requirements */
+ 0, 0,
+ preamble, NULL)