From c4e6f74f2944e20dbf04794f167a3da1b817235a Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 17 Oct 2011 16:07:05 +0100 Subject: [PATCH] interactive/pixmap: Make sure to work only on the X11 backend Even if the test has been successfully compiled against the X11 backend, we need to ensure that it is actually running against it, otherwise bad things will happen. --- tests/interactive/test-pixmap.c | 48 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/tests/interactive/test-pixmap.c b/tests/interactive/test-pixmap.c index 9bdf950..5a40cad 100644 --- a/tests/interactive/test-pixmap.c +++ b/tests/interactive/test-pixmap.c @@ -1,24 +1,23 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include +#include + +#ifdef CAIRO_HAS_XLIB_SURFACE +#include +#endif + #undef CLUTTER_DISABLE_DEPRECATED #include #ifdef CLUTTER_WINDOWING_X11 +#include +#include -# include -# include - -# include -# include - -# include -# include +#include +#include +#endif #define IMAGE TESTS_DATADIR G_DIR_SEPARATOR_S "redhand.png" @@ -127,6 +126,7 @@ stage_button_press_cb (ClutterActor *actor, gpointer data) { draw_arc ((Pixmap)data); + return FALSE; } @@ -172,9 +172,12 @@ create_pixmap (guint *width, guint *height, guint *depth) cairo_paint (cr); cairo_surface_destroy (image); - if (width) *width = w; - if (height) *height = h; - if (depth) *depth = 32; + if (width) + *width = w; + if (height) + *height = h; + if (depth) + *depth = 32; return pixmap; } @@ -210,6 +213,11 @@ test_pixmap_main (int argc, char **argv) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; +#ifdef CLUTTER_WINDOWING_X11 + if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11)) + g_error ("test-pixmap requires the X11 Clutter backend."); +#endif + xdpy = clutter_x11_get_default_display (); XSynchronize (xdpy, True); @@ -308,13 +316,3 @@ test_pixmap_main (int argc, char **argv) return EXIT_SUCCESS; } - -#else - -int -test_pixmap_main (int argc, char **argv) -{ - return EXIT_SUCCESS; -}; - -#endif /* CLUTTER_WINDOWING_X11 */ -- 2.7.4