summaryrefslogtreecommitdiff
path: root/test/get-xrender-format.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-03 16:38:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-10-31 12:30:11 +0000
commite90073f7ddc6f461a935bc360c409b04f1fe9f74 (patch)
treeefda94d1ecd13143cdad23f14552661165e7601e /test/get-xrender-format.c
parent8457972d40088cda165f31fdd7bd9b4c19c6e095 (diff)
downloadcairo-e90073f7ddc6f461a935bc360c409b04f1fe9f74.tar.gz
[test] Build test suite into single binary.
Avoid calling libtool to link every single test case, by building just one binary from all the sources. This binary is then given the task of choosing tests to run (based on user selection and individual test requirement), forking each test into its own process and accumulating the results.
Diffstat (limited to 'test/get-xrender-format.c')
-rw-r--r--test/get-xrender-format.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/test/get-xrender-format.c b/test/get-xrender-format.c
index 24f903525..8e99eb7c9 100644
--- a/test/get-xrender-format.c
+++ b/test/get-xrender-format.c
@@ -31,10 +31,9 @@
#include "cairo-boilerplate-xlib.h"
-int
-main (void)
+static cairo_test_status_t
+preamble (cairo_test_context_t *ctx)
{
- cairo_test_context_t ctx;
Display *dpy;
XRenderPictFormat *orig_format, *format;
cairo_surface_t *surface;
@@ -44,13 +43,12 @@ main (void)
result = CAIRO_TEST_UNTESTED;
- cairo_test_init (&ctx, "get-xrender-format");
- if (! cairo_test_is_target_enabled (&ctx, "xlib"))
+ if (! cairo_test_is_target_enabled (ctx, "xlib"))
goto CLEANUP_TEST;
dpy = XOpenDisplay (NULL);
if (! dpy) {
- cairo_test_log (&ctx, "Error: Cannot open display: %s, skipping.\n",
+ cairo_test_log (ctx, "Error: Cannot open display: %s, skipping.\n",
XDisplayName (NULL));
goto CLEANUP_TEST;
}
@@ -59,19 +57,19 @@ main (void)
screen = DefaultScreen (dpy);
- cairo_test_log (&ctx, "Testing with image surface.\n");
+ cairo_test_log (ctx, "Testing with image surface.\n");
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
format = cairo_xlib_surface_get_xrender_format (surface);
if (format != NULL) {
- cairo_test_log (&ctx, "Error: expected NULL for image surface\n");
+ cairo_test_log (ctx, "Error: expected NULL for image surface\n");
goto CLEANUP_SURFACE;
}
cairo_surface_destroy (surface);
- cairo_test_log (&ctx, "Testing with non-xrender xlib surface.\n");
+ cairo_test_log (ctx, "Testing with non-xrender xlib surface.\n");
pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy),
1, 1, DefaultDepth (dpy, screen));
@@ -81,13 +79,13 @@ main (void)
orig_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen));
format = cairo_xlib_surface_get_xrender_format (surface);
if (format != orig_format) {
- cairo_test_log (&ctx, "Error: did not receive the same format as XRenderFindVisualFormat\n");
+ cairo_test_log (ctx, "Error: did not receive the same format as XRenderFindVisualFormat\n");
goto CLEANUP_PIXMAP;
}
cairo_surface_destroy (surface);
XFreePixmap (dpy, pixmap);
- cairo_test_log (&ctx, "Testing with xlib xrender surface.\n");
+ cairo_test_log (ctx, "Testing with xlib xrender surface.\n");
orig_format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy),
@@ -99,17 +97,17 @@ main (void)
1, 1);
format = cairo_xlib_surface_get_xrender_format (surface);
if (format != orig_format) {
- cairo_test_log (&ctx, "Error: did not receive the same format originally set\n");
+ cairo_test_log (ctx, "Error: did not receive the same format originally set\n");
goto CLEANUP_PIXMAP;
}
- cairo_test_log (&ctx, "Testing without the X Render extension.\n");
+ cairo_test_log (ctx, "Testing without the X Render extension.\n");
cairo_boilerplate_xlib_surface_disable_render (surface);
format = cairo_xlib_surface_get_xrender_format (surface);
if (format != NULL) {
- cairo_test_log (&ctx, "Error: did not receive a NULL format as expected\n");
+ cairo_test_log (ctx, "Error: did not receive a NULL format as expected\n");
goto CLEANUP_PIXMAP;
}
@@ -123,7 +121,12 @@ main (void)
XCloseDisplay (dpy);
CLEANUP_TEST:
- cairo_test_fini (&ctx);
-
return result;
}
+
+CAIRO_TEST (get_xrender_format,
+ "Check XRender specific API",
+ "xrender, api", /* keywords */
+ NULL, /* requirements */
+ 0, 0,
+ preamble, NULL)