summaryrefslogtreecommitdiff
path: root/test/ps-features.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/ps-features.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/ps-features.c')
-rw-r--r--test/ps-features.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/test/ps-features.c b/test/ps-features.c
index 64b5c6034..80088ffcc 100644
--- a/test/ps-features.c
+++ b/test/ps-features.c
@@ -45,7 +45,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;
@@ -86,10 +86,9 @@ 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;
cairo_surface_t *surface;
cairo_t *cr;
cairo_status_t status;
@@ -97,15 +96,13 @@ main (void)
size_t i;
char dsc[255];
- cairo_test_init (&ctx, "ps-features");
- if (! (cairo_test_is_target_enabled (&ctx, "ps2") ||
- cairo_test_is_target_enabled (&ctx, "ps3")))
+ if (! (cairo_test_is_target_enabled (ctx, "ps2") ||
+ cairo_test_is_target_enabled (ctx, "ps3")))
{
- cairo_test_fini (&ctx);
return CAIRO_TEST_UNTESTED;
}
- filename = "ps-features.ps";
+ filename = "ps-features-out.ps";
/* We demonstrate that the initial size doesn't matter (we're
* passing 0,0), if we use cairo_ps_surface_set_size on the first
@@ -126,7 +123,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_ps_surface_set_size (surface,
pages[i].width_in_points,
pages[i].height_in_points);
@@ -151,14 +148,18 @@ main (void)
cairo_surface_destroy (surface);
if (status) {
- cairo_test_log (&ctx, "Failed to create ps surface for file %s: %s\n",
+ cairo_test_log (ctx, "Failed to create ps surface for file %s: %s\n",
filename, cairo_status_to_string (status));
return CAIRO_TEST_FAILURE;
}
printf ("ps-features: Please check %s to ensure it looks/prints correctly.\n", filename);
-
- cairo_test_fini (&ctx);
-
return CAIRO_TEST_SUCCESS;
}
+
+CAIRO_TEST (ps_features,
+ "Check PS specific API",
+ "ps, api", /* keywords */
+ NULL, /* requirements */
+ 0, 0,
+ preamble, NULL)