diff options
author | Carl Worth <cworth@cworth.org> | 2007-03-02 11:31:13 -0800 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2007-03-02 11:31:13 -0800 |
commit | b52dda62fea0745cc28d6149dc4688ade524b4df (patch) | |
tree | e39fea2b93b977ad0b232b8cda4f732c3d972764 /test/xlib-surface.c | |
parent | 7d6e21c7e298e1795f36fdf021d61ef4ed0ca0fa (diff) | |
download | cairo-b52dda62fea0745cc28d6149dc4688ade524b4df.tar.gz |
Augment cairo_test_init with cairo_test_fini to avoid leak
Without this, any tests that were using cairo_test_init rather than
cairo_test would end up leaking a FILE* for the log file. So this
keeps valgrind much more happy with the test suite.
Diffstat (limited to 'test/xlib-surface.c')
-rw-r--r-- | test/xlib-surface.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/test/xlib-surface.c b/test/xlib-surface.c index 44bea9275..3b6d1b503 100644 --- a/test/xlib-surface.c +++ b/test/xlib-surface.c @@ -38,7 +38,6 @@ #define OFFSCREEN_OFFSET 50 cairo_bool_t result = 0; -FILE *log_file = NULL; static void draw_pattern (cairo_surface_t *surface) @@ -177,14 +176,14 @@ do_test (Display *dpy, &result); } - fprintf (log_file, "xlib-surface: %s, %s, %s%s: %s\n", - use_render ? " render" : "no-render", - set_size ? " size" : "no-size", - use_pixmap ? "pixmap" : "window", - use_pixmap ? - " " : - (offscreen ? ", offscreen" : ", onscreen"), - result.pixels_changed ? "FAIL" : "PASS"); + cairo_test_log ("xlib-surface: %s, %s, %s%s: %s\n", + use_render ? " render" : "no-render", + set_size ? " size" : "no-size", + use_pixmap ? "pixmap" : "window", + use_pixmap ? + " " : + (offscreen ? ", offscreen" : ", onscreen"), + result.pixels_changed ? "FAIL" : "PASS"); if (result.pixels_changed) return CAIRO_TEST_FAILURE; @@ -222,22 +221,17 @@ main (void) cairo_test_status_t status, result = CAIRO_TEST_SUCCESS; cairo_test_init ("xlib-surface"); - log_file = fopen ("xlib-surface.log", "w"); - if (log_file == NULL) { - fprintf (stderr, "Error opening log file: %s\n", "xlib-surface.log"); - log_file = stderr; - } dpy = XOpenDisplay (NULL); if (!dpy) { - fprintf (log_file, "xlib-surface: Cannot open display, skipping\n"); - fclose (log_file); + cairo_test_log ("xlib-surface: Cannot open display, skipping\n"); + cairo_test_fini (); return 0; } if (!check_visual (dpy)) { - fprintf (log_file, "xlib-surface: default visual is not RGB24 or BGR24, skipping\n"); - fclose (log_file); + cairo_test_log ("xlib-surface: default visual is not RGB24 or BGR24, skipping\n"); + cairo_test_fini (); return 0; } @@ -283,7 +277,7 @@ main (void) cairo_debug_reset_static_data (); - fclose (log_file); + cairo_test_fini (); return result; } |