diff --git a/test/Makefile.am b/test/Makefile.am index 304eca7..086734f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -44,6 +44,7 @@ get-clip \ get-group-target \ get-path-extents \ gradient-alpha \ +huge-path \ infinite-join \ leaky-dash \ leaky-polygon \ diff --git a/test/cairo-test.c b/test/cairo-test.c index ea8f2ac..c4292b6 100755 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -380,6 +380,7 @@ cairo_test_expecting (cairo_test_t *test const char *tname; #ifdef HAVE_SIGNAL_H void (*old_segfault_handler)(int); + void (*old_sigpipe_handler)(int); #endif volatile cairo_test_status_t status, ret; cairo_boilerplate_target_t ** volatile targets_to_test; @@ -473,6 +474,7 @@ #endif #ifdef HAVE_SIGNAL_H /* Set up a checkpoint to get back to in case of segfaults. */ old_segfault_handler = signal (SIGSEGV, segfault_handler); + old_sigpipe_handler = signal (SIGPIPE, segfault_handler); if (0 == setjmp (jmpbuf)) #endif status = cairo_test_for_target (test, target, dev_offset); @@ -480,6 +482,7 @@ #ifdef HAVE_SIGNAL_H else status = CAIRO_TEST_CRASHED; signal (SIGSEGV, old_segfault_handler); + signal (SIGPIPE, old_sigpipe_handler); #endif cairo_test_log ("TEST: %s TARGET: %s FORMAT: %s OFFSET: %d RESULT: ", --- /dev/null 2006-10-16 09:26:21.899932725 +0200 +++ test/huge-path.c 2006-10-20 18:38:47.000000000 +0200 @@ -0,0 +1,44 @@ +#include +#include "cairo-test.h" +#include + +static cairo_test_draw_function_t draw; + +#define SIZE 64 +/* this number is important, with 1026 it works */ +#define N_POINTS 1027 + +cairo_test_t test = { + "huge-path", + "Test huge paths" + "\nHuge paths are known to kill applications with SIGPIPE on X", + SIZE, SIZE, + draw +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + int i; + + cairo_set_source_rgb (cr, 1, 1, 0); + cairo_move_to (cr, 0.0, 0.0); + for (i = 0; i < N_POINTS; i++) { + cairo_rel_line_to (cr, (double) SIZE / N_POINTS, i & 1 ? -16 : 16); + } + cairo_rel_line_to (cr, 0, 48); + for (i = 0; i < N_POINTS; i++) { + cairo_rel_line_to (cr, - (double) SIZE * i / N_POINTS, i & 1 ? -16 : 16); + } + cairo_close_path (cr); + + cairo_fill (cr); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test); +}