summaryrefslogtreecommitdiff
path: root/test/a1-mask.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/a1-mask.c
parent8457972d40088cda165f31fdd7bd9b4c19c6e095 (diff)
[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/a1-mask.c')
-rw-r--r--test/a1-mask.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/test/a1-mask.c b/test/a1-mask.c
index e4638fee..0be1d07b 100644
--- a/test/a1-mask.c
+++ b/test/a1-mask.c
@@ -27,8 +27,6 @@
#include "cairo-test.h"
-static cairo_test_draw_function_t draw;
-
#define MASK_WIDTH 10
#define MASK_HEIGHT 8
@@ -48,14 +46,6 @@ static unsigned char mask[(MASK_WIDTH + 7) / 8 * MASK_HEIGHT] = {
MASK,
};
-static const cairo_test_t test = {
- "a1-mask",
- "test masks of CAIRO_FORMAT_A1",
- MASK_WIDTH, MASK_HEIGHT,
- draw
-};
-
-
static cairo_test_status_t
check_status (const cairo_test_context_t *ctx,
cairo_status_t status,
@@ -148,20 +138,17 @@ draw (cairo_t *cr, int dst_width, int dst_height)
return CAIRO_TEST_SUCCESS;
}
-int
-main (void)
+static cairo_test_status_t
+preamble (cairo_test_context_t *ctx)
{
- cairo_test_context_t ctx;
+ cairo_test_status_t status = CAIRO_TEST_SUCCESS;
int test_width;
- cairo_test_init (&ctx, "a1-mask");
-
/* first check the API strictness */
for (test_width = 0; test_width < 40; test_width++) {
int test_stride = (test_width + 7) / 8;
int stride = cairo_format_stride_for_width (CAIRO_FORMAT_A1,
test_width);
- cairo_test_status_t status;
cairo_status_t expected;
/* First create a surface using the width as the stride,
@@ -170,14 +157,14 @@ main (void)
expected = (stride == test_stride) ?
CAIRO_STATUS_SUCCESS : CAIRO_STATUS_INVALID_STRIDE;
- status = test_surface_with_width_and_stride (&ctx,
+ status = test_surface_with_width_and_stride (ctx,
test_width,
test_stride,
expected);
if (status)
return status;
- status = test_surface_with_width_and_stride (&ctx,
+ status = test_surface_with_width_and_stride (ctx,
test_width,
-test_stride,
expected);
@@ -188,14 +175,14 @@ main (void)
/* Then create a surface using the correct stride,
* (should always succeed).
*/
- status = test_surface_with_width_and_stride (&ctx,
+ status = test_surface_with_width_and_stride (ctx,
test_width,
stride,
CAIRO_STATUS_SUCCESS);
if (status)
return status;
- status = test_surface_with_width_and_stride (&ctx,
+ status = test_surface_with_width_and_stride (ctx,
test_width,
-stride,
CAIRO_STATUS_SUCCESS);
@@ -203,7 +190,12 @@ main (void)
return status;
}
- cairo_test_fini (&ctx);
-
- return cairo_test (&test);
+ return status;
}
+
+CAIRO_TEST (a1_mask,
+ "test masks of CAIRO_FORMAT_A1",
+ "alpha, mask", /* keywords */
+ NULL, /* requirements */
+ MASK_WIDTH, MASK_HEIGHT,
+ preamble, draw)