diff options
Diffstat (limited to 'test/a8-mask.c')
-rw-r--r-- | test/a8-mask.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/test/a8-mask.c b/test/a8-mask.c index fdf4fef0..47f9f5be 100644 --- a/test/a8-mask.c +++ b/test/a8-mask.c @@ -28,7 +28,7 @@ static cairo_test_draw_function_t draw; -cairo_test_t test = { +static const cairo_test_t test = { "a8-mask", "test masks of CAIRO_FORMAT_A8", 8, 8, @@ -50,12 +50,15 @@ static unsigned char mask[MASK_WIDTH * MASK_HEIGHT] = { }; static cairo_test_status_t -check_status (cairo_status_t status, cairo_status_t expected) +check_status (const cairo_test_context_t *ctx, + cairo_status_t status, + cairo_status_t expected) { if (status == expected) return CAIRO_TEST_SUCCESS; - cairo_test_log ("Error: Expected status value %d (%s), received %d (%s)\n", + cairo_test_log (ctx, + "Error: Expected status value %d (%s), received %d (%s)\n", expected, cairo_status_to_string (expected), status, @@ -64,7 +67,8 @@ check_status (cairo_status_t status, cairo_status_t expected) } static cairo_test_status_t -test_surface_with_width_and_stride (int width, int stride, +test_surface_with_width_and_stride (const cairo_test_context_t *ctx, + int width, int stride, cairo_status_t expected) { cairo_test_status_t status; @@ -73,7 +77,8 @@ test_surface_with_width_and_stride (int width, int stride, int len; unsigned char *data; - cairo_test_log ("Creating surface with width %d and stride %d\n", + cairo_test_log (ctx, + "Creating surface with width %d and stride %d\n", width, stride); len = stride; @@ -87,11 +92,11 @@ test_surface_with_width_and_stride (int width, int stride, cairo_paint (cr); - status = check_status (cairo_surface_status (surface), expected); + status = check_status (ctx, cairo_surface_status (surface), expected); if (status) goto BAIL; - status = check_status (cairo_status (cr), expected); + status = check_status (ctx, cairo_status (cr), expected); if (status) goto BAIL; @@ -147,9 +152,10 @@ draw (cairo_t *cr, int dst_width, int dst_height) int main (void) { + cairo_test_context_t ctx; int test_width; - cairo_test_init ("a8-mask"); + cairo_test_init (&ctx, "a8-mask"); for (test_width = 0; test_width < 40; test_width++) { int stride = cairo_format_stride_for_width (CAIRO_FORMAT_A8, @@ -163,13 +169,15 @@ main (void) expected = (stride == test_width) ? CAIRO_STATUS_SUCCESS : CAIRO_STATUS_INVALID_STRIDE; - status = test_surface_with_width_and_stride (test_width, + status = test_surface_with_width_and_stride (&ctx, + test_width, test_width, expected); if (status) return status; - status = test_surface_with_width_and_stride (test_width, + status = test_surface_with_width_and_stride (&ctx, + test_width, -test_width, expected); if (status) @@ -179,20 +187,22 @@ main (void) /* Then create a surface using the correct stride, * (should always succeed). */ - status = test_surface_with_width_and_stride (test_width, + 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 (test_width, + status = test_surface_with_width_and_stride (&ctx, + test_width, -stride, CAIRO_STATUS_SUCCESS); if (status) return status; } - cairo_test_fini (); + cairo_test_fini (&ctx); return cairo_test (&test); } |