[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.
This commit is contained in:
Vladimir Vukicevic 2006-09-09 23:54:40 -07:00 committed by U-CYCLONE\Vladimir Vukicevic
parent 00d5a2ed48
commit e1a8a8b65a
2 changed files with 18 additions and 0 deletions

7
test/cairo-test.c Normal file → Executable file
View file

@ -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;:,");

11
test/path-data.c Normal file → Executable file
View file

@ -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 */