diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-09-03 16:38:03 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-31 12:30:11 +0000 |
commit | e90073f7ddc6f461a935bc360c409b04f1fe9f74 (patch) | |
tree | efda94d1ecd13143cdad23f14552661165e7601e /test/pdf-features.c | |
parent | 8457972d40088cda165f31fdd7bd9b4c19c6e095 (diff) | |
download | cairo-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/pdf-features.c')
-rw-r--r-- | test/pdf-features.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/test/pdf-features.c b/test/pdf-features.c index e8616850d..dbfa33205 100644 --- a/test/pdf-features.c +++ b/test/pdf-features.c @@ -42,7 +42,7 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) -struct { +static struct { const char *page_size; const char *page_size_alias; const char *orientation; @@ -83,23 +83,17 @@ struct { MM_TO_POINTS(37), MM_TO_POINTS(26)} }; -int -main (void) +static cairo_test_status_t +preamble (cairo_test_context_t *ctx) { - cairo_test_context_t ctx; + const char *filename = "pdf-features-out.pdf"; cairo_surface_t *surface; cairo_t *cr; cairo_status_t status; - const char *filename; size_t i; - cairo_test_init (&ctx, "pdf-features"); - if (! cairo_test_is_target_enabled (&ctx, "pdf")) { - cairo_test_fini (&ctx); + if (! cairo_test_is_target_enabled (ctx, "pdf")) return CAIRO_TEST_UNTESTED; - } - - filename = "pdf-features.pdf"; /* The initial size passed here is the default size that will be * inheritable by each page. That is, any page for which this @@ -116,8 +110,7 @@ main (void) CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size (cr, TEXT_SIZE); - for (i=0; i < ARRAY_SIZE(pages); i++) - { + for (i = 0; i < ARRAY_SIZE (pages); i++) { cairo_pdf_surface_set_size (surface, pages[i].width_in_points, pages[i].height_in_points); @@ -135,14 +128,18 @@ main (void) cairo_surface_destroy (surface); if (status) { - cairo_test_log (&ctx, "Failed to create pdf surface for file %s: %s\n", + cairo_test_log (ctx, "Failed to create pdf surface for file %s: %s\n", filename, cairo_status_to_string (status)); return CAIRO_TEST_FAILURE; } printf ("pdf-features: Please check %s to ensure it looks/prints correctly.\n", filename); - - cairo_test_fini (&ctx); - return CAIRO_TEST_SUCCESS; } + +CAIRO_TEST (pdf_features, + "Check PDF specific API", + "pdf", /* keywords */ + NULL, /* requirements */ + 0, 0, + preamble, NULL) |