diff options
Diffstat (limited to 'test/create-from-png-stream.c')
-rw-r--r-- | test/create-from-png-stream.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/create-from-png-stream.c b/test/create-from-png-stream.c index 4e8a29d8a..4fe05794d 100644 --- a/test/create-from-png-stream.c +++ b/test/create-from-png-stream.c @@ -33,7 +33,7 @@ static cairo_test_draw_function_t draw; -cairo_test_t test = { +static const cairo_test_t test = { "create-from-png-stream", "Tests the creation of an image surface from a PNG using a FILE *", WIDTH, HEIGHT, @@ -56,17 +56,17 @@ read_png_from_file (void *closure, unsigned char *data, unsigned int length) static cairo_test_status_t draw (cairo_t *cr, int width, int height) { - char *srcdir = getenv ("srcdir"); + const cairo_test_context_t *ctx = cairo_test_get_context (cr); char *filename; FILE *file; cairo_surface_t *surface; - xasprintf (&filename, "%s/%s", srcdir ? srcdir : ".", + xasprintf (&filename, "%s/%s", ctx->srcdir, "create-from-png-stream-ref.png"); file = fopen (filename, "rb"); if (file == NULL) { - cairo_test_log ("Error: failed to open file: %s\n", filename); + cairo_test_log (ctx, "Error: failed to open file: %s\n", filename); return CAIRO_TEST_FAILURE; } @@ -76,7 +76,9 @@ draw (cairo_t *cr, int width, int height) fclose (file); if (surface == NULL) { - cairo_test_log ("Error: failed to create surface from PNG: %s\n", filename); + cairo_test_log (ctx, + "Error: failed to create surface from PNG: %s\n", + filename); free (filename); return CAIRO_TEST_FAILURE; } |