summaryrefslogtreecommitdiff
path: root/test/cairo-test.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-06-13 10:22:37 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-06-13 10:25:49 +0100
commit0693af2328606a4c7e4c888d2a1cd346e6bef405 (patch)
tree11fb81e417b5f667f1cd46b0ff5e6560c0c9290e /test/cairo-test.c
parentffc3a39c95e918fa2fcd14c1b1063b9a9acceebf (diff)
downloadcairo-0693af2328606a4c7e4c888d2a1cd346e6bef405.tar.gz
test: Move all output below test/output/
make distcheck complains of remanents being left under test/ after a clean, notably the files used to check the capabilities of a similar surface and the fallback-resolution output.
Diffstat (limited to 'test/cairo-test.c')
-rw-r--r--test/cairo-test.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/test/cairo-test.c b/test/cairo-test.c
index af4487a57..5b80ba13e 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -436,6 +436,24 @@ done:
return ref_name;
}
+static cairo_bool_t
+_cairo_test_mkdir (const char *path)
+{
+#if ! HAVE_MKDIR
+ return FALSE;
+#elif HAVE_MKDIR == 1
+ if (mkdir (path) == 0)
+ return TRUE;
+#elif HAVE_MKDIR == 2
+ if (mkdir (path, 0770) == 0)
+ return TRUE;
+#else
+#error Bad value for HAVE_MKDIR
+#endif
+
+ return errno == EEXIST;
+}
+
cairo_bool_t
cairo_test_target_has_similar (const cairo_test_context_t *ctx,
const cairo_boilerplate_target_t *target)
@@ -446,6 +464,7 @@ cairo_test_target_has_similar (const cairo_test_context_t *ctx,
cairo_surface_t *similar;
cairo_status_t status;
void *closure;
+ char *path;
/* ignore image intermediate targets */
if (target->expected_type == CAIRO_SURFACE_TYPE_IMAGE)
@@ -454,9 +473,14 @@ cairo_test_target_has_similar (const cairo_test_context_t *ctx,
if (getenv ("CAIRO_TEST_IGNORE_SIMILAR"))
return FALSE;
+ xasprintf (&path, "%s/%s",
+ _cairo_test_mkdir (CAIRO_TEST_OUTPUT_DIR) ? CAIRO_TEST_OUTPUT_DIR : ".",
+ ctx->test_name);
+
+ has_similar = FALSE;
do {
do {
- surface = (target->create_surface) (ctx->test->name,
+ surface = (target->create_surface) (path,
target->content,
ctx->test->width,
ctx->test->height,
@@ -466,12 +490,11 @@ cairo_test_target_has_similar (const cairo_test_context_t *ctx,
0,
&closure);
if (surface == NULL)
- return FALSE;
+ goto out;
} while (cairo_test_malloc_failure (ctx, cairo_surface_status (surface)));
if (cairo_surface_status (surface))
- return FALSE;
-
+ goto out;
cr = cairo_create (surface);
cairo_push_group_with_content (cr,
@@ -486,7 +509,9 @@ cairo_test_target_has_similar (const cairo_test_context_t *ctx,
if (target->cleanup)
target->cleanup (closure);
- } while (cairo_test_malloc_failure (ctx, status));
+ } while (! has_similar && cairo_test_malloc_failure (ctx, status));
+out:
+ free (path);
return has_similar;
}
@@ -655,24 +680,6 @@ cairo_test_copy_file (const char *src_filename,
return TRUE;
}
-static cairo_bool_t
-_cairo_test_mkdir (const char *path)
-{
-#if ! HAVE_MKDIR
- return FALSE;
-#elif HAVE_MKDIR == 1
- if (mkdir (path) == 0)
- return TRUE;
-#elif HAVE_MKDIR == 2
- if (mkdir (path, 0770) == 0)
- return TRUE;
-#else
-#error Bad value for HAVE_MKDIR
-#endif
-
- return errno == EEXIST;
-}
-
static cairo_test_status_t
cairo_test_for_target (cairo_test_context_t *ctx,
const cairo_boilerplate_target_t *target,