summaryrefslogtreecommitdiff
path: root/test/create-from-png.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-09-23 13:20:14 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-09-23 13:20:14 +0100
commit7e5e2dd5e184c73264dd2359ca151cc0689c63d6 (patch)
tree8c00d2508f024a27fac487ee61d407ef03e0897f /test/create-from-png.c
parentf162f7ebb47fe87ffadade15456699ef2b556fbf (diff)
downloadcairo-7e5e2dd5e184c73264dd2359ca151cc0689c63d6.tar.gz
test/create-from-png: Update to point to new reference/ images
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'test/create-from-png.c')
-rw-r--r--test/create-from-png.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/test/create-from-png.c b/test/create-from-png.c
index 585fac2c1..0112fafa5 100644
--- a/test/create-from-png.c
+++ b/test/create-from-png.c
@@ -49,8 +49,8 @@ draw (cairo_t *cr, int width, int height)
char *filename;
cairo_surface_t *surface;
- xasprintf (&filename, "%s/%s", ctx->srcdir,
- "create-from-png.ref.png");
+ xasprintf (&filename, "%s/reference/%s",
+ ctx->srcdir, "create-from-png.ref.png");
surface = cairo_image_surface_create_from_png (filename);
if (cairo_surface_status (surface)) {
@@ -82,6 +82,7 @@ static cairo_test_status_t
preamble (cairo_test_context_t *ctx)
{
char *filename;
+ char *path;
cairo_surface_t *surface;
cairo_status_t status;
cairo_test_status_t result = CAIRO_TEST_SUCCESS;
@@ -126,8 +127,8 @@ preamble (cairo_test_context_t *ctx)
return result;
/* cheekily test error propagation from the user write funcs as well ... */
- xasprintf (&filename, "%s/%s", ctx->srcdir,
- "create-from-png.ref.png");
+ xasprintf (&path, "%s/reference", ctx->srcdir);
+ xasprintf (&filename, "%s/%s", path, "create-from-png.ref.png");
surface = cairo_image_surface_create_from_png (filename);
if (cairo_surface_status (surface)) {
@@ -177,8 +178,7 @@ preamble (cairo_test_context_t *ctx)
return result;
/* check that loading alpha/opaque PNGs generate the correct surfaces */
- xasprintf (&filename, "%s/%s", ctx->srcdir,
- "create-from-png.alpha.ref.png");
+ xasprintf (&filename, "%s/%s", path, "create-from-png.alpha.ref.png");
surface = cairo_image_surface_create_from_png (filename);
if (cairo_surface_status (surface)) {
result = cairo_test_status_from_status (ctx,
@@ -198,8 +198,7 @@ preamble (cairo_test_context_t *ctx)
if (result != CAIRO_TEST_SUCCESS)
return result;
- xasprintf (&filename, "%s/%s", ctx->srcdir,
- "create-from-png.ref.png");
+ xasprintf (&filename, "%s/%s", path, "create-from-png.ref.png");
surface = cairo_image_surface_create_from_png (filename);
if (cairo_surface_status (surface)) {
result = cairo_test_status_from_status (ctx,
@@ -220,8 +219,7 @@ preamble (cairo_test_context_t *ctx)
return result;
/* check paletted PNGs */
- xasprintf (&filename, "%s/%s", ctx->srcdir,
- "create-from-png.indexed-alpha.ref.png");
+ xasprintf (&filename, "%s/%s", path, "create-from-png.indexed-alpha.ref.png");
surface = cairo_image_surface_create_from_png (filename);
if (cairo_surface_status (surface)) {
result = cairo_test_status_from_status (ctx,
@@ -241,8 +239,7 @@ preamble (cairo_test_context_t *ctx)
if (result != CAIRO_TEST_SUCCESS)
return result;
- xasprintf (&filename, "%s/%s", ctx->srcdir,
- "create-from-png.indexed.ref.png");
+ xasprintf (&filename, "%s/%s", path, "create-from-png.indexed.ref.png");
surface = cairo_image_surface_create_from_png (filename);
if (cairo_surface_status (surface)) {
result = cairo_test_status_from_status (ctx,
@@ -263,8 +260,7 @@ preamble (cairo_test_context_t *ctx)
return result;
/* check grayscale PNGs */
- xasprintf (&filename, "%s/%s", ctx->srcdir,
- "create-from-png.gray-alpha.ref.png");
+ xasprintf (&filename, "%s/%s", path, "create-from-png.gray-alpha.ref.png");
surface = cairo_image_surface_create_from_png (filename);
if (cairo_surface_status (surface)) {
result = cairo_test_status_from_status (ctx,
@@ -284,8 +280,7 @@ preamble (cairo_test_context_t *ctx)
if (result != CAIRO_TEST_SUCCESS)
return result;
- xasprintf (&filename, "%s/%s", ctx->srcdir,
- "create-from-png.gray.ref.png");
+ xasprintf (&filename, "%s/%s", path, "create-from-png.gray.ref.png");
surface = cairo_image_surface_create_from_png (filename);
if (cairo_surface_status (surface)) {
result = cairo_test_status_from_status (ctx,
@@ -303,6 +298,8 @@ preamble (cairo_test_context_t *ctx)
free (filename);
cairo_surface_destroy (surface);
+ free (path);
+
return result;
}