[cairo-commit] test/cairo-test.c test/path-data.c

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Sat Sep 9 23:54:27 PDT 2006


 test/cairo-test.c |    7 +++++++
 test/path-data.c  |   11 +++++++++++
 2 files changed, 18 insertions(+)

New commits:
diff-tree e1a8a8b65a41691521d89fba7737c093dfdf7926 (from 00d5a2ed48d999a29708d4750c034bbf1b91de12)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Sat Sep 9 23:54:40 2006 -0700

    [win32] Set win32 assertion failure handlers for tests to stderr
    
    assert() will default to displaying a dialog box, which makes it hard
    to run tests automatically.  Set the reporting mode to only report
    to stderr in cairo_test(), and in path-data, since that triggers
    an early assert.

diff --git a/test/cairo-test.c b/test/cairo-test.c
old mode 100644
new mode 100755
index d95d150..ea8f2ac
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -51,6 +51,7 @@
 #include "xmalloc.h"
 
 #ifdef _MSC_VER
+#include <crtdbg.h>
 #define vsnprintf _vsnprintf
 #define access _access
 #define F_OK 0
@@ -572,6 +573,12 @@ cairo_test (cairo_test_t *test)
     cairo_test_status_t expectation = CAIRO_TEST_SUCCESS;
     const char *xfails;
 
+#ifdef _MSC_VER
+    /* We don't want an assert dialog, we want stderr */
+    _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
+    _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+#endif
+
     if ((xfails = getenv ("CAIRO_XFAIL_TESTS")) != NULL) {
 	while (*xfails) {
 	    const char *end = strpbrk (xfails, " \t\r\n;:,");
diff --git a/test/path-data.c b/test/path-data.c
old mode 100644
new mode 100755
index 903e92c..105e807
--- a/test/path-data.c
+++ b/test/path-data.c
@@ -143,6 +143,10 @@ draw (cairo_t *cr, int width, int height
     return CAIRO_TEST_SUCCESS;
 }
 
+#ifdef _MSC_VER
+#include <crtdbg.h>
+#endif
+
 int
 main (void)
 {
@@ -151,6 +155,13 @@ main (void)
     cairo_path_t path;
     cairo_surface_t *surface;
 
+#ifdef _MSC_VER
+    /* This test triggers an assert, and we don't want an assert dialog;
+     * have to do this here since the assert happens before cairo_test() */
+    _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
+    _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+#endif
+
     surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
 
     /* Test a few error cases for cairo_append_path_data */


More information about the cairo-commit mailing list