summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2006-04-25 09:03:26 -0400
committerBehdad Esfahbod <behdad@behdad.org>2006-04-25 09:03:26 -0400
commit9668b6592f805b6e05f9e75354956e4119483b6a (patch)
treed6529cf154cb9286739b5c19528285846a041883
parent6723547f0035e6c41abee165ebefb7406e40b7d8 (diff)
Set background color to red for test failures printing on a terminal.
-rw-r--r--test/cairo-test.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/cairo-test.c b/test/cairo-test.c
index c61cb0e4c..8484808d6 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -71,6 +71,8 @@ typedef enum cairo_internal_surface_type {
static void
xunlink (const char *pathname);
+static const char *fail_face = "", *normal_face = "";
+
#define CAIRO_TEST_LOG_SUFFIX ".log"
#define CAIRO_TEST_PNG_SUFFIX "-out.png"
#define CAIRO_TEST_REF_SUFFIX "-ref.png"
@@ -1726,7 +1728,7 @@ cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw,
printf ("XFAIL\n");
cairo_test_log ("XFAIL\n");
} else {
- printf ("FAIL\n");
+ printf ("%sFAIL%s\n", fail_face, normal_face);
cairo_test_log ("FAIL\n");
}
ret = status;
@@ -1759,6 +1761,12 @@ cairo_test_expect_failure (cairo_test_t *test,
cairo_test_status_t
cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw)
{
+#ifdef HAVE_UNISTD_H
+ if (isatty (1)) {
+ fail_face = "\033[41m";
+ normal_face = "\033[m";
+ }
+#endif
printf ("\n");
return cairo_test_expecting (test, draw, CAIRO_TEST_SUCCESS);
}