[cairo] [PATCH v3 4/7] test: concat CAIRO_TEST_OUTPUT_DIR at point of use instead of BASENAME

Bryce W. Harrington b.harrington at samsung.com
Thu Aug 15 11:08:37 PDT 2013


Signed-off-by: Bryce Harrington <b.harrington at samsung.com>
---
 test/create-for-stream.c  |    8 ++++----
 test/multi-page.c         |    6 +++---
 test/pdf-features.c       |    4 ++--
 test/pdf-mime-data.c      |   10 +++++-----
 test/pdf-surface-source.c |    4 ++--
 test/png.c                |    4 ++--
 test/ps-features.c        |    4 ++--
 test/ps-surface-source.c  |    4 ++--
 test/svg-clip.c           |    4 ++--
 test/svg-surface-source.c |    4 ++--
 test/svg-surface.c        |    4 ++--
 11 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/test/create-for-stream.c b/test/create-for-stream.c
index 403f947..e999795 100644
--- a/test/create-for-stream.c
+++ b/test/create-for-stream.c
@@ -57,7 +57,7 @@
 #define WIDTH_IN_POINTS  (WIDTH_IN_INCHES  * 72.0)
 #define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72.0)
 
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/create-for-stream.out"
+#define BASENAME "create-for-stream.out"
 
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
@@ -247,7 +247,7 @@ preamble (cairo_test_context_t *ctx)
 	if (status == CAIRO_TEST_UNTESTED)
 	    status = CAIRO_TEST_SUCCESS;
 
-	test_status = test_surface (ctx, "ps", BASENAME ".ps",
+	test_status = test_surface (ctx, "ps",  CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".ps",
 				    cairo_ps_surface_create,
 				    cairo_ps_surface_create_for_stream);
 	cairo_test_log (ctx, "TEST: %s TARGET: %s RESULT: %s\n",
@@ -263,7 +263,7 @@ preamble (cairo_test_context_t *ctx)
 	if (status == CAIRO_TEST_UNTESTED)
 	    status = CAIRO_TEST_SUCCESS;
 
-	test_status = test_surface (ctx, "pdf", BASENAME ".pdf",
+	test_status = test_surface (ctx, "pdf", CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".pdf",
 				    cairo_pdf_surface_create,
 				    cairo_pdf_surface_create_for_stream);
 	cairo_test_log (ctx, "TEST: %s TARGET: %s RESULT: %s\n",
@@ -281,7 +281,7 @@ preamble (cairo_test_context_t *ctx)
 	if (status == CAIRO_TEST_UNTESTED)
 	    status = CAIRO_TEST_SUCCESS;
 
-	test_status = test_surface (ctx, "svg", BASENAME ".svg",
+	test_status = test_surface (ctx, "svg", CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".svg",
 				    cairo_svg_surface_create,
 				    cairo_svg_surface_create_for_stream);
 	cairo_test_log (ctx, "TEST: %s TARGET: %s RESULT: %s\n",
diff --git a/test/multi-page.c b/test/multi-page.c
index 7894a33..dea3b42 100644
--- a/test/multi-page.c
+++ b/test/multi-page.c
@@ -51,7 +51,7 @@
 #define HEIGHT_IN_INCHES 3
 #define WIDTH_IN_POINTS  (WIDTH_IN_INCHES  * 72.0)
 #define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72.0)
-#define BASENAME         CAIRO_TEST_OUTPUT_DIR "/multi-page.out"
+#define BASENAME         "multi-page.out"
 
 static void
 draw_smiley (cairo_t *cr, double width, double height, double smile_ratio)
@@ -143,7 +143,7 @@ preamble (cairo_test_context_t *ctx)
 	if (result == CAIRO_TEST_UNTESTED)
 	    result = CAIRO_TEST_SUCCESS;
 
-	filename = BASENAME ".ps";
+	filename = CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".ps";
 	surface = cairo_ps_surface_create (filename,
 					   WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
 	status = cairo_surface_status (surface);
@@ -166,7 +166,7 @@ preamble (cairo_test_context_t *ctx)
 	if (result == CAIRO_TEST_UNTESTED)
 	    result = CAIRO_TEST_SUCCESS;
 
-	filename = BASENAME ".pdf";
+	filename = CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".pdf";
 	surface = cairo_pdf_surface_create (filename,
 					    WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
 	status = cairo_surface_status (surface);
diff --git a/test/pdf-features.c b/test/pdf-features.c
index 669d2ce..c5f6bea 100644
--- a/test/pdf-features.c
+++ b/test/pdf-features.c
@@ -39,7 +39,7 @@
 #define INCHES_TO_POINTS(in) ((in) * 72.0)
 #define MM_TO_POINTS(mm) ((mm) / 25.4 * 72.0)
 #define TEXT_SIZE 12
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/pdf-features.out"
+#define BASENAME "pdf-features.out"
 
 static struct {
     const char *page_size;
@@ -85,11 +85,11 @@ static struct {
 static cairo_test_status_t
 preamble (cairo_test_context_t *ctx)
 {
-    const char *filename = BASENAME ".pdf";
     cairo_surface_t *surface;
     cairo_t *cr;
     cairo_status_t status;
     size_t i;
+    const char *filename = CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".pdf";
 
     if (! cairo_test_is_target_enabled (ctx, "pdf"))
 	return CAIRO_TEST_UNTESTED;
diff --git a/test/pdf-mime-data.c b/test/pdf-mime-data.c
index bbe1a15..e4fbaa2 100644
--- a/test/pdf-mime-data.c
+++ b/test/pdf-mime-data.c
@@ -39,7 +39,7 @@
  * are not using a jpeg library */
 #define IMAGE_FILE "romedalen"
 
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/pdf-mime-data.out"
+#define BASENAME "pdf-mime-data.out"
 
 static cairo_test_status_t
 read_file (const cairo_test_context_t *ctx,
@@ -84,7 +84,7 @@ read_file (const cairo_test_context_t *ctx,
 static cairo_test_status_t
 preamble (cairo_test_context_t *ctx)
 {
-    const char *filename = BASENAME ".pdf";
+    const char *filename = CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".pdf";
     cairo_surface_t *image;
     cairo_surface_t *surface;
     cairo_t *cr;
@@ -135,7 +135,7 @@ preamble (cairo_test_context_t *ctx)
 
     printf ("pdf-mime-data: Please check %s to ensure it looks/prints correctly.\n", filename);
 
-    sprintf (command, "pdfimages -j %s %s", filename, BASENAME);
+    sprintf (command, "pdfimages -j %s %s", filename, CAIRO_TEST_OUTPUT_DIR "/" BASENAME);
     exit_status = system (command);
     if (exit_status) {
 	cairo_test_log (ctx, "pdfimages failed with exit status %d\n", exit_status);
@@ -148,12 +148,12 @@ preamble (cairo_test_context_t *ctx)
 	return test_status;
     }
 
-    test_status = read_file (ctx, BASENAME "-000.jpg", &out_data, &out_len);
+    test_status = read_file (ctx, CAIRO_TEST_OUTPUT_DIR "/" BASENAME "-000.jpg", &out_data, &out_len);
     if (test_status) {
 	free (data);
 	cairo_test_log (ctx,
 			"Could not read input jpeg file %s\n",
-			BASENAME "-000.jpg");
+			CAIRO_TEST_OUTPUT_DIR "/" BASENAME "-000.jpg");
 	return test_status;
     }
 
diff --git a/test/pdf-surface-source.c b/test/pdf-surface-source.c
index 52f97af..6307271 100644
--- a/test/pdf-surface-source.c
+++ b/test/pdf-surface-source.c
@@ -28,14 +28,14 @@
 
 #include "surface-source.c"
 
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/pdf-surface-source.out"
+#define BASENAME "pdf-surface-source.out"
 
 static cairo_surface_t *
 create_source_surface (int size)
 {
     cairo_surface_t *surface;
 
-    surface = cairo_pdf_surface_create (BASENAME ".pdf", size, size);
+    surface = cairo_pdf_surface_create (CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".pdf", size, size);
     cairo_surface_set_fallback_resolution (surface, 72., 72.);
 
     return surface;
diff --git a/test/png.c b/test/png.c
index 32460fc..1dfc793 100644
--- a/test/png.c
+++ b/test/png.c
@@ -30,7 +30,7 @@
 /* Test the idempotency of write_png->read_png */
 
 #define RGB_MASK 0x00ffffff
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/png.out"
+#define BASENAME "png.out"
 
 static cairo_bool_t
 image_surface_equals (cairo_surface_t *A, cairo_surface_t *B)
@@ -78,7 +78,7 @@ print_surface (const cairo_test_context_t *ctx, cairo_surface_t *surface)
 static cairo_test_status_t
 preamble (cairo_test_context_t *ctx)
 {
-    const char *filename = BASENAME ".png";
+    const char *filename = CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".png";
     cairo_surface_t *surface0, *surface1;
     cairo_status_t status;
     uint32_t argb32 = 0xdeadbede;
diff --git a/test/ps-features.c b/test/ps-features.c
index ea19e93..2eb9ace 100644
--- a/test/ps-features.c
+++ b/test/ps-features.c
@@ -42,7 +42,7 @@
 #define INCHES_TO_POINTS(in) ((in) * 72.0)
 #define MM_TO_POINTS(mm) ((mm) / 25.4 * 72.0)
 #define TEXT_SIZE 12
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/ps-features.out"
+#define BASENAME "ps-features.out"
 
 static struct {
     const char *page_size;
@@ -101,7 +101,7 @@ preamble (cairo_test_context_t *ctx)
 	return CAIRO_TEST_UNTESTED;
     }
 
-    filename = BASENAME ".ps";
+    filename = CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".ps";
 
     /* We demonstrate that the initial size doesn't matter (we're
      * passing 0,0), if we use cairo_ps_surface_set_size on the first
diff --git a/test/ps-surface-source.c b/test/ps-surface-source.c
index dfb371e..3573cb2 100644
--- a/test/ps-surface-source.c
+++ b/test/ps-surface-source.c
@@ -28,14 +28,14 @@
 
 #include "surface-source.c"
 
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/ps-surface-source.out"
+#define BASENAME "ps-surface-source.out"
 
 static cairo_surface_t *
 create_source_surface (int size)
 {
     cairo_surface_t *surface;
 
-    surface = cairo_ps_surface_create (BASENAME ".ps", size, size);
+    surface = cairo_ps_surface_create (CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".ps", size, size);
     cairo_surface_set_fallback_resolution (surface, 72., 72.);
 
     return surface;
diff --git a/test/svg-clip.c b/test/svg-clip.c
index 51f099f..149033b 100644
--- a/test/svg-clip.c
+++ b/test/svg-clip.c
@@ -32,7 +32,7 @@
 
 #define WIDTH_IN_POINTS 600
 #define HEIGHT_IN_POINTS 600
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/svg-clip.out"
+#define BASENAME "svg-clip.out"
 
 static void
 test_clip (cairo_t *cr, double width, double height)
@@ -108,7 +108,7 @@ static cairo_test_status_t
 preamble (cairo_test_context_t *ctx)
 {
     cairo_t *cr;
-    const char *filename = BASENAME ".svg";
+    const char *filename = CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".svg";
     cairo_surface_t *surface;
 
     if (! cairo_test_is_target_enabled (ctx, "svg11") &&
diff --git a/test/svg-surface-source.c b/test/svg-surface-source.c
index 6ef5400..2c33980 100644
--- a/test/svg-surface-source.c
+++ b/test/svg-surface-source.c
@@ -28,14 +28,14 @@
 
 #include "surface-source.c"
 
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/svg-surface-source.out"
+#define BASENAME "svg-surface-source.out"
 
 static cairo_surface_t *
 create_source_surface (int size)
 {
     cairo_surface_t *surface;
 
-    surface = cairo_svg_surface_create (BASENAME ".svg",
+    surface = cairo_svg_surface_create (CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".svg",
 					size, size);
     cairo_surface_set_fallback_resolution (surface, 72., 72.);
 
diff --git a/test/svg-surface.c b/test/svg-surface.c
index 3216069..30cf994 100644
--- a/test/svg-surface.c
+++ b/test/svg-surface.c
@@ -37,7 +37,7 @@
 #define HEIGHT_IN_INCHES 3
 #define WIDTH_IN_POINTS  (WIDTH_IN_INCHES  * 72)
 #define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72)
-#define BASENAME CAIRO_TEST_OUTPUT_DIR "/svg-surface.out"
+#define BASENAME "svg-surface.out"
 
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
@@ -91,7 +91,7 @@ static cairo_test_status_t
 preamble (cairo_test_context_t *ctx)
 {
     cairo_t *cr;
-    const char *filename = BASENAME ".svg";
+    const char *filename = CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".svg";
     cairo_surface_t *surface;
 
     if (! cairo_test_is_target_enabled (ctx, "svg11") &&
-- 
1.7.9.5


More information about the cairo mailing list