summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-04-07 10:42:57 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-04-08 07:52:46 +0100
commitd0672e85ef120a4e3cd0dfcbdb717afbf9526f17 (patch)
tree4b9a25295e9519b51a4b8d88cd4237c430558849
parent056d3c853e6660db31ee4a50d0e990a6013aa703 (diff)
[test/surface-source] Skip tests if we cannot create the source surface.
Check that the test environment supports the desired source and avoid triggering asserts in the test routines.
-rw-r--r--test/glitz-surface-source.c15
-rw-r--r--test/surface-source.c8
2 files changed, 18 insertions, 5 deletions
diff --git a/test/glitz-surface-source.c b/test/glitz-surface-source.c
index d70940a12..2dfa7355a 100644
--- a/test/glitz-surface-source.c
+++ b/test/glitz-surface-source.c
@@ -28,8 +28,6 @@
#include <cairo-xlib.h>
#include <cairo-xlib-xrender.h>
-#include <assert.h>
-
#define NAME "glitz"
#include "surface-source.c"
@@ -174,18 +172,25 @@ static cairo_surface_t *
create_source_surface (int size)
{
struct closure *closure;
- glitz_surface_t * glitz_surface;
+ glitz_surface_t *glitz_surface;
cairo_surface_t *surface;
closure = xcalloc (1, sizeof (struct closure));
closure->dpy = XOpenDisplay (getenv("CAIRO_TEST_GLITZ_DISPLAY"));
- assert (closure->dpy);
+ if (closure->dpy == NULL) {
+ free (closure);
+ return NULL;
+ }
glitz_surface = _glitz_glx_create_surface (GLITZ_STANDARD_ARGB32,
size, size,
closure);
- assert (glitz_surface != NULL);
+ if (glitz_surface == NULL) {
+ XCloseDisplay (closure->dpy);
+ free (closure);
+ return NULL;
+ }
surface = cairo_glitz_surface_create (glitz_surface);
diff --git a/test/surface-source.c b/test/surface-source.c
index c7f333469..5a034ad09 100644
--- a/test/surface-source.c
+++ b/test/surface-source.c
@@ -89,5 +89,13 @@ draw (cairo_t *cr, int width, int height)
int
main (void)
{
+ cairo_surface_t *surface;
+
+ surface = create_source_surface (SIZE);
+ if (surface == NULL) /* can't create the source so skip the test */
+ return CAIRO_TEST_SUCCESS;
+
+ cairo_surface_destroy (surface);
+
return cairo_test (&test);
}