[cairo-commit] cairo/test Makefile.am, 1.95, 1.96 a8-mask-rgb24-ref.png, NONE, 1.1 cairo-test.c, 1.58, 1.59 caps-joins-ps-rgb24-ref.png, NONE, 1.1 caps-joins-rgb24-ref.png, NONE, 1.1 caps-sub-paths-rgb24-ref.png, NONE, 1.1 clip-all-rgb24-ref.png, NONE, 1.1 clip-nesting-ps-rgb24-ref.png, NONE, 1.1 clip-nesting-rgb24-ref.png, NONE, 1.1 clip-operator-rgb24-ref.png, NONE, 1.1 clip-twice-ps-rgb24-ref.png, NONE, 1.1 clip-twice-rgb24-ref.png, NONE, 1.1 composite-integer-translate-over-repeat-rgb24-ref.png, NONE, 1.1 composite-integer-translate-over-rgb24-ref.png, NONE, 1.1 composite-integer-translate-source-rgb24-ref.png, NONE, 1.1 create-from-png-rgb24-ref.png, NONE, 1.1 create-from-png-stream-rgb24-ref.png, NONE, 1.1 dash-caps-joins-rgb24-ref.png, NONE, 1.1 dash-offset-negative-rgb24-ref.png, NONE, 1.1 fill-and-stroke-rgb24-ref.png, NONE, 1.1 fill-rule-rgb24-ref.png, NONE, 1.1 filter-nearest-offset-rgb24-ref.png, NONE, 1.1 gradient-alpha-rgb24-ref.png, NONE, 1.1 leaky-polygon-rgb24-ref.png, NONE, 1.1 line-width-rgb24-ref.png, NONE, 1.1 linear-gradient-rgb24-ref.png, NONE, 1.1 mask-ctm-rgb24-ref.png, NONE, 1.1 mask-rgb24-ref.png, NONE, 1.1 mask-surface-ctm-rgb24-ref.png, NONE, 1.1 move-to-show-surface-rgb24-ref.png, NONE, 1.1 nil-surface-rgb24-ref.png, NONE, 1.1 operator-clear-rgb24-ref.png, NONE, 1.1 operator-source-rgb24-ref.png, NONE, 1.1 paint-rgb24-ref.png, NONE, 1.1 paint-with-alpha-rgb24-ref.png, NONE, 1.1 path-data-rgb24-ref.png, NONE, 1.1 pixman-rotate-rgb24-ref.png, NONE, 1.1 rectangle-rounding-error-rgb24-ref.png, NONE, 1.1 rel-path-rgb24-ref.png, NONE, 1.1 scale-source-surface-paint-rgb24-ref.png, NONE, 1.1 self-copy-rgb24-ref.png, NONE, 1.1 self-intersecting-rgb24-ref.png, NONE, 1.1 set-source-rgb24-ref.png, NONE, 1.1 show-text-current-point-rgb24-ref.png, NONE, 1.1 source-clip-rgb24-ref.png, NONE, 1.1 source-surface-scale-paint-rgb24-ref.png, NONE, 1.1 surface-pattern-rgb24-ref.png, NONE, 1.1 text-antialias-gray-rgb24-ref.png, NONE, 1.1 text-antialias-none-rgb24-ref.png, NONE, 1.1 text-antialias-subpixel-rgb24-ref.png, NONE, 1.1 text-pattern-rgb24-ref.png, NONE, 1.1 text-rotate-rgb24-ref.png, NONE, 1.1 transforms-rgb24-ref.png, NONE, 1.1 translate-show-surface-rgb24-ref.png, NONE, 1.1 trap-clip-rgb24-ref.png, NONE, 1.1 unantialiased-shapes-ps-rgb24-ref.png, NONE, 1.1 unantialiased-shapes-rgb24-ref.png, NONE, 1.1 unbounded-operator-rgb24-ref.png, NONE, 1.1

Keith Packard commit at pdx.freedesktop.org
Thu Sep 29 14:31:11 PDT 2005


Committed by: keithp

Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv31729/test

Modified Files:
	Makefile.am cairo-test.c 
Added Files:
	a8-mask-rgb24-ref.png caps-joins-ps-rgb24-ref.png 
	caps-joins-rgb24-ref.png caps-sub-paths-rgb24-ref.png 
	clip-all-rgb24-ref.png clip-nesting-ps-rgb24-ref.png 
	clip-nesting-rgb24-ref.png clip-operator-rgb24-ref.png 
	clip-twice-ps-rgb24-ref.png clip-twice-rgb24-ref.png 
	composite-integer-translate-over-repeat-rgb24-ref.png 
	composite-integer-translate-over-rgb24-ref.png 
	composite-integer-translate-source-rgb24-ref.png 
	create-from-png-rgb24-ref.png 
	create-from-png-stream-rgb24-ref.png 
	dash-caps-joins-rgb24-ref.png 
	dash-offset-negative-rgb24-ref.png 
	fill-and-stroke-rgb24-ref.png fill-rule-rgb24-ref.png 
	filter-nearest-offset-rgb24-ref.png 
	gradient-alpha-rgb24-ref.png leaky-polygon-rgb24-ref.png 
	line-width-rgb24-ref.png linear-gradient-rgb24-ref.png 
	mask-ctm-rgb24-ref.png mask-rgb24-ref.png 
	mask-surface-ctm-rgb24-ref.png 
	move-to-show-surface-rgb24-ref.png nil-surface-rgb24-ref.png 
	operator-clear-rgb24-ref.png operator-source-rgb24-ref.png 
	paint-rgb24-ref.png paint-with-alpha-rgb24-ref.png 
	path-data-rgb24-ref.png pixman-rotate-rgb24-ref.png 
	rectangle-rounding-error-rgb24-ref.png rel-path-rgb24-ref.png 
	scale-source-surface-paint-rgb24-ref.png 
	self-copy-rgb24-ref.png self-intersecting-rgb24-ref.png 
	set-source-rgb24-ref.png show-text-current-point-rgb24-ref.png 
	source-clip-rgb24-ref.png 
	source-surface-scale-paint-rgb24-ref.png 
	surface-pattern-rgb24-ref.png 
	text-antialias-gray-rgb24-ref.png 
	text-antialias-none-rgb24-ref.png 
	text-antialias-subpixel-rgb24-ref.png 
	text-pattern-rgb24-ref.png text-rotate-rgb24-ref.png 
	transforms-rgb24-ref.png translate-show-surface-rgb24-ref.png 
	trap-clip-rgb24-ref.png unantialiased-shapes-ps-rgb24-ref.png 
	unantialiased-shapes-rgb24-ref.png 
	unbounded-operator-rgb24-ref.png 
Log Message:
2005-09-29  Keith Packard  <keithp at keithp.com>

	reviewed by: cworth

	* test/Makefile.am:
	* test/a8-mask-rgb24-ref.png:
	* test/cairo-test.c: (cairo_target_format_name),
	(create_argb_image_surface), (create_rgb_image_surface),
	(create_xlib_surface), (create_ps_surface),
	(ps_surface_write_to_png), (cleanup_ps), (cairo_test_for_target),
	(cairo_test_expecting):
	* test/caps-joins-ps-rgb24-ref.png:
	* test/caps-joins-rgb24-ref.png:
	* test/caps-sub-paths-rgb24-ref.png:
	* test/clip-all-rgb24-ref.png:
	* test/clip-nesting-ps-rgb24-ref.png:
	* test/clip-nesting-rgb24-ref.png:
	* test/clip-operator-rgb24-ref.png:
	* test/clip-twice-ps-rgb24-ref.png:
	* test/clip-twice-rgb24-ref.png:
	* test/composite-integer-translate-over-repeat-rgb24-ref.png:
	* test/composite-integer-translate-over-rgb24-ref.png:
	* test/composite-integer-translate-source-rgb24-ref.png:
	* test/create-from-png-rgb24-ref.png:
	* test/create-from-png-stream-rgb24-ref.png:
	* test/dash-caps-joins-rgb24-ref.png:
	* test/dash-offset-negative-rgb24-ref.png:
	* test/fill-and-stroke-rgb24-ref.png:
	* test/fill-rule-rgb24-ref.png:
	* test/filter-nearest-offset-rgb24-ref.png:
	* test/gradient-alpha-rgb24-ref.png:
	* test/leaky-polygon-rgb24-ref.png:
	* test/line-width-rgb24-ref.png:
	* test/linear-gradient-rgb24-ref.png:
	* test/mask-ctm-rgb24-ref.png:
	* test/mask-rgb24-ref.png:
	* test/mask-surface-ctm-rgb24-ref.png:
	* test/move-to-show-surface-rgb24-ref.png:
	* test/nil-surface-rgb24-ref.png:
	* test/operator-clear-rgb24-ref.png:
	* test/operator-source-rgb24-ref.png:
	* test/paint-rgb24-ref.png:
	* test/paint-with-alpha-rgb24-ref.png:
	* test/path-data-rgb24-ref.png:
	* test/pixman-rotate-rgb24-ref.png:
	* test/rectangle-rounding-error-rgb24-ref.png:
	* test/rel-path-rgb24-ref.png:
	* test/scale-source-surface-paint-rgb24-ref.png:
	* test/self-copy-rgb24-ref.png:
	* test/self-intersecting-rgb24-ref.png:
	* test/set-source-rgb24-ref.png:
	* test/show-text-current-point-rgb24-ref.png:
	* test/source-clip-rgb24-ref.png:
	* test/source-surface-scale-paint-rgb24-ref.png:
	* test/surface-pattern-rgb24-ref.png:
	* test/text-antialias-gray-rgb24-ref.png:
	* test/text-antialias-none-rgb24-ref.png:
	* test/text-antialias-subpixel-rgb24-ref.png:
	* test/text-pattern-rgb24-ref.png:
	* test/text-rotate-rgb24-ref.png:
	* test/transforms-rgb24-ref.png:
	* test/translate-show-surface-rgb24-ref.png:
	* test/trap-clip-rgb24-ref.png:
	* test/unantialiased-shapes-ps-rgb24-ref.png:
	* test/unantialiased-shapes-rgb24-ref.png:
	* test/unbounded-operator-rgb24-ref.png:
	Add rgb24 surface tests, support per-target reference
	images and support PS surface testing


Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo/test/Makefile.am,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- Makefile.am	27 Sep 2005 19:44:32 -0000	1.95
+++ Makefile.am	29 Sep 2005 21:31:08 -0000	1.96
@@ -81,59 +81,115 @@
 # All tests which have a reference image go here.
 # I really don't like having to repeat this list. Anyone know a good
 # way to avoid it? Can I use a wildcard here?
-EXTRA_DIST =				\
-a8-mask-ref.png				\
-caps-joins-ref.png			\
-caps-sub-paths-ref.png			\
-clip-all-ref.png			\
-clip-nesting-ref.png			\
-clip-operator-ref.png			\
-clip-twice-ref.png			\
-composite-integer-translate-source-ref.png		\
+EXTRA_DIST =						\
+a8-mask-ref.png						\
+a8-mask-rgb24-ref.png					\
+caps-joins-ps-rgb24-ref.png				\
+caps-joins-ref.png					\
+caps-joins-rgb24-ref.png				\
+caps-sub-paths-ref.png					\
+caps-sub-paths-rgb24-ref.png				\
+clip-all-ref.png					\
+clip-all-rgb24-ref.png					\
+clip-nesting-ps-rgb24-ref.png				\
+clip-nesting-ref.png					\
+clip-nesting-rgb24-ref.png				\
+clip-operator-ref.png					\
+clip-operator-rgb24-ref.png				\
+clip-twice-ps-rgb24-ref.png				\
+clip-twice-ref.png					\
+clip-twice-rgb24-ref.png				\
 composite-integer-translate-over-ref.png		\
 composite-integer-translate-over-repeat-ref.png		\
-create-from-png-ref.png			\
-create-from-png-stream-ref.png		\
-dash-caps-joins-ref.png			\
-dash-offset-negative-ref.png		\
-fill-and-stroke-ref.png			\
-fill-rule-ref.png			\
-filter-nearest-offset-ref.png		\
-gradient-alpha-ref.png			\
-leaky-polygon-ref.png			\
-line-width-ref.png			\
-linear-gradient-ref.png			\
-mask-ref.png				\
-mask-ctm-ref.png			\
-mask-surface-ctm-ref.png		\
-move-to-show-surface-ref.png		\
-nil-surface-ref.png			\
-operator-clear-ref.png			\
-operator-source-ref.png			\
-paint-ref.png				\
-paint-with-alpha-ref.png		\
-path-data-ref.png			\
-pixman-rotate-ref.png			\
-rectangle-rounding-error-ref.png	\
-romedalen.png				\
-self-copy-ref.png			\
-self-intersecting-ref.png		\
-scale-source-surface-paint-ref.png	\
-set-source-ref.png			\
-show-text-current-point-ref.png		\
-source-clip-ref.png			\
-source-surface-scale-paint-ref.png	\
-surface-pattern-ref.png			\
-text-antialias-gray-ref.png		\
-text-antialias-none-ref.png		\
-text-antialias-subpixel-ref.png		\
-text-pattern-ref.png			\
-transforms-ref.png			\
-translate-show-surface-ref.png		\
-trap-clip-ref.png			\
-unantialiased-shapes-ref.png		\
-unbounded-operator-ref.png		\
-rel-path-ref.png
+composite-integer-translate-over-repeat-rgb24-ref.png	\
+composite-integer-translate-over-rgb24-ref.png		\
+composite-integer-translate-source-ref.png		\
+composite-integer-translate-source-rgb24-ref.png	\
+create-from-png-ref.png					\
+create-from-png-rgb24-ref.png				\
+create-from-png-stream-ref.png				\
+create-from-png-stream-rgb24-ref.png			\
+dash-caps-joins-ref.png					\
+dash-caps-joins-rgb24-ref.png				\
+dash-offset-negative-ref.png				\
+dash-offset-negative-rgb24-ref.png			\
+fill-and-stroke-ref.png					\
+fill-and-stroke-rgb24-ref.png				\
+fill-rule-ref.png					\
+fill-rule-rgb24-ref.png					\
+filter-nearest-offset-ref.png				\
+filter-nearest-offset-rgb24-ref.png			\
+gradient-alpha-ref.png					\
+gradient-alpha-rgb24-ref.png				\
+leaky-polygon-ref.png					\
+leaky-polygon-rgb24-ref.png				\
+linear-gradient-ref.png					\
+linear-gradient-rgb24-ref.png				\
+line-width-ref.png					\
+line-width-rgb24-ref.png				\
+mask-ctm-ref.png					\
+mask-ctm-rgb24-ref.png					\
+mask-ref.png						\
+mask-rgb24-ref.png					\
+mask-surface-ctm-ref.png				\
+mask-surface-ctm-rgb24-ref.png				\
+move-to-show-surface-ref.png				\
+move-to-show-surface-rgb24-ref.png			\
+nil-surface-ref.png					\
+nil-surface-rgb24-ref.png				\
+operator-clear-ref.png					\
+operator-clear-rgb24-ref.png				\
+operator-source-ref.png					\
+operator-source-rgb24-ref.png				\
+paint-ref.png						\
+paint-rgb24-ref.png					\
+paint-with-alpha-ref.png				\
+paint-with-alpha-rgb24-ref.png				\
+path-data-ref.png					\
+path-data-rgb24-ref.png					\
+pixman-rotate-ref.png					\
+pixman-rotate-rgb24-ref.png				\
+rectangle-rounding-error-ref.png			\
+rectangle-rounding-error-rgb24-ref.png			\
+rel-path-ref.png					\
+rel-path-rgb24-ref.png					\
+romedalen.png						\
+scale-source-surface-paint-ref.png			\
+scale-source-surface-paint-rgb24-ref.png		\
+self-copy-ref.png					\
+self-copy-rgb24-ref.png					\
+self-intersecting-ref.png				\
+self-intersecting-rgb24-ref.png				\
+set-source-ref.png					\
+set-source-rgb24-ref.png				\
+show-text-current-point-ref.png				\
+show-text-current-point-rgb24-ref.png			\
+source-clip-ref.png					\
+source-clip-rgb24-ref.png				\
+source-surface-scale-paint-ref.png			\
+source-surface-scale-paint-rgb24-ref.png		\
+surface-pattern-ref.png					\
+surface-pattern-rgb24-ref.png				\
+text-antialias-gray-ref.png				\
+text-antialias-gray-rgb24-ref.png			\
+text-antialias-none-ref.png				\
+text-antialias-none-rgb24-ref.png			\
+text-antialias-subpixel-ref.png				\
+text-antialias-subpixel-rgb24-ref.png			\
+text-pattern-ref.png					\
+text-pattern-rgb24-ref.png				\
+text-rotate-rgb24-ref.png				\
+transforms-ref.png					\
+transforms-rgb24-ref.png				\
+translate-show-surface-ref.png				\
+translate-show-surface-rgb24-ref.png			\
+trap-clip-ref.png					\
+trap-clip-rgb24-ref.png					\
+unantialiased-shapes-ps-rgb24-ref.png			\
+unantialiased-shapes-ref.png				\
+unantialiased-shapes-rgb24-ref.png			\
+unbounded-operator-ref.png				\
+unbounded-operator-rgb24-ref.png
 
 # Any test for which the code committed to CVS is expected to fail
 # should be listed here.
@@ -260,6 +316,7 @@
 imagediff_LDADD = $(LDADDS)
 
 CLEANFILES =					\
+	*.ps					\
 	*-out.png				\
 	*-diff.png				\
 	*.log					\

--- NEW FILE: a8-mask-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

Index: cairo-test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- cairo-test.c	13 Sep 2005 19:11:32 -0000	1.58
+++ cairo-test.c	29 Sep 2005 21:31:08 -0000	1.59
@@ -56,6 +56,7 @@
 #define CAIRO_TEST_LOG_SUFFIX ".log"
 #define CAIRO_TEST_PNG_SUFFIX "-out.png"
 #define CAIRO_TEST_REF_SUFFIX "-ref.png"
+#define CAIRO_TEST_RGB24_REF_SUFFIX "-rgb24-ref.png"
 #define CAIRO_TEST_DIFF_SUFFIX "-diff.png"
 
 /* Static data is messy, but we're coding for tests here, not a
@@ -143,7 +144,10 @@
 }
 
 typedef cairo_surface_t *
-(*cairo_test_create_target_surface_t) (int width, int height, void **closure);
+(*cairo_test_create_target_surface_t) (cairo_test_t *test, void **closure);
+
+typedef cairo_status_t
+(*cairo_test_write_to_png_t) (cairo_surface_t *surface, const char *filename);
 
 typedef void
 (*cairo_test_cleanup_target_t) (void *closure);
@@ -151,22 +155,49 @@
 typedef struct _cairo_test_target
 {
     const char		       	       *name;
+    cairo_format_t			reference_format;
     cairo_test_create_target_surface_t	create_target_surface;
+    cairo_test_write_to_png_t		write_to_png;
     cairo_test_cleanup_target_t		cleanup_target;
     void		       	       *closure;
 } cairo_test_target_t;
 
+static char *
+cairo_target_format_name (const cairo_test_target_t *target)
+{
+    char *format;
+
+    if (target->reference_format == CAIRO_FORMAT_RGB24)
+	format = "rgb24";
+    else
+	format = "argb32";
+    return format;
+}
+
 static cairo_surface_t *
-create_image_surface (int width, int height, void **closure)
+create_argb_image_surface (cairo_test_t *test, void **closure)
 {
-    int stride = 4 * width;
+    int stride = 4 * test->width;
     unsigned char *buf;
 
-    *closure = buf = xcalloc (stride * height, 1);
+    *closure = buf = xcalloc (stride * test->height, 1);
 
     return cairo_image_surface_create_for_data (buf,
 						CAIRO_FORMAT_ARGB32,
-						width, height, stride);
+						test->width, test->height, stride);
+}
+
+static cairo_surface_t *
+create_rgb_image_surface (cairo_test_t *test, void **closure)
+{
+    int stride = 4 * test->width;
+    unsigned char *buf;
+
+    *closure = buf = xcalloc (stride * test->height, 1);
+
+    return cairo_image_surface_create_for_data (buf,
+						CAIRO_FORMAT_RGB24,
+						test->width, test->height, stride);
 }
 
 static void
@@ -383,8 +414,10 @@
 } xlib_target_closure_t;
 
 static cairo_surface_t *
-create_xlib_surface (int width, int height, void **closure)
+create_xlib_surface (cairo_test_t *test, void **closure)
 {
+    int width = test->width;
+    int height = test->height;
     xlib_target_closure_t *xtc;
     cairo_surface_t *surface;
     Display *dpy;
@@ -440,6 +473,64 @@
 }
 #endif
 
+#if CAIRO_HAS_PS_SURFACE
+#include "cairo-ps.h"
+
+cairo_user_data_key_t	ps_closure_key;
+
+typedef struct _ps_target_closure
+{
+    char    *filename;
+    int	    width, height;
+} ps_target_closure_t;
+
+static cairo_surface_t *
+create_ps_surface (cairo_test_t *test, void **closure)
+{
+    int width = test->width;
+    int height = test->height;
+    ps_target_closure_t	*ptc;
+    cairo_surface_t *surface;
+
+    *closure = ptc = xmalloc (sizeof (ps_target_closure_t));
+
+    ptc->width = width;
+    ptc->height = height;
+    
+    xasprintf (&ptc->filename, "%s-%s%s", test->name, "ps", ".ps");
+    surface = cairo_ps_surface_create (ptc->filename, width, height);
+    if (!surface) {
+	free (ptc);
+	return NULL;
+    }
+    cairo_ps_surface_set_dpi (surface, 72., 72.);
+    cairo_surface_set_user_data (surface, &ps_closure_key, ptc, NULL);
+    return surface;
+}
+
+static cairo_status_t
+ps_surface_write_to_png (cairo_surface_t *surface, const char *filename)
+{
+    ps_target_closure_t *ptc = cairo_surface_get_user_data (surface, &ps_closure_key);
+    char    command[4096];
+
+    cairo_surface_finish (surface);
+    sprintf (command, "gs -q -r72 -g%dx%d -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pngalpha -sOutputFile=%s %s",
+	     ptc->width, ptc->height, filename, ptc->filename);
+    if (system (command) == 0)
+	return CAIRO_STATUS_SUCCESS;
+    return CAIRO_STATUS_WRITE_ERROR;
+}
+
+static void
+cleanup_ps (void *closure)
+{
+    ps_target_closure_t *ptc = closure;
+    free (ptc);
+}
+
+#endif
+
 static cairo_test_status_t
 cairo_test_for_target (cairo_test_t *test,
 		       cairo_test_draw_function_t draw,
@@ -450,22 +541,35 @@
     cairo_t *cr;
     char *png_name, *ref_name, *diff_name;
     char *srcdir;
+    char *format;
     cairo_test_status_t ret;
 
     /* Get the strings ready that we'll need. */
     srcdir = getenv ("srcdir");
     if (!srcdir)
 	srcdir = ".";
-    xasprintf (&png_name, "%s-%s%s", test->name,
-	       target->name, CAIRO_TEST_PNG_SUFFIX);
-    xasprintf (&ref_name, "%s/%s%s", srcdir, test->name,
-	       CAIRO_TEST_REF_SUFFIX);
-    xasprintf (&diff_name, "%s-%s%s", test->name,
-	       target->name, CAIRO_TEST_DIFF_SUFFIX);
+    format = cairo_target_format_name (target);
+    
+    xasprintf (&png_name, "%s-%s-%s%s", test->name,
+	       target->name, format, CAIRO_TEST_PNG_SUFFIX);
+    xasprintf (&ref_name, "%s/%s-%s-%s%s", srcdir, test->name,
+	       target->name, format, CAIRO_TEST_REF_SUFFIX);
+    if (access (ref_name, F_OK) != 0) {
+	char	*ref_suffix;
+	free (ref_name);
+
+	if (target->reference_format == CAIRO_FORMAT_RGB24)
+	    ref_suffix = CAIRO_TEST_RGB24_REF_SUFFIX;
+	else
+	    ref_suffix = CAIRO_TEST_REF_SUFFIX;
+	xasprintf (&ref_name, "%s/%s%s", srcdir, test->name,
+		   ref_suffix);
+    }
+    xasprintf (&diff_name, "%s-%s-%s%s", test->name,
+	       target->name, format, CAIRO_TEST_DIFF_SUFFIX);
 
     /* Run the actual drawing code. */
-    surface = (target->create_target_surface) (test->width, test->height,
-					       &target->closure);
+    surface = (target->create_target_surface) (test, &target->closure);
     if (surface == NULL) {
 	cairo_test_log ("Error: Failed to set %s target\n", target->name);
 	ret = CAIRO_TEST_UNTESTED;
@@ -475,7 +579,10 @@
     cr = cairo_create (surface);
 
     cairo_save (cr);
-    cairo_set_source_rgba (cr, 0, 0, 0, 0);
+    if (target->reference_format == CAIRO_FORMAT_RGB24)
+	cairo_set_source_rgba (cr, 1, 1, 1, 1);
+    else
+	cairo_set_source_rgba (cr, 0, 0, 0, 0);
     cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
     cairo_paint (cr);
     cairo_restore (cr);
@@ -489,6 +596,8 @@
 	goto UNWIND_CAIRO;
     }
 
+    cairo_show_page (cr);
+
     if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
 	cairo_test_log ("Error: Function under test left cairo status in an error state: %s\n",
 			cairo_status_to_string (cairo_status (cr)));
@@ -499,7 +608,7 @@
     /* Skip image check for tests with no image (width,height == 0,0) */
     if (test->width != 0 && test->height != 0) {
 	int pixels_changed;
-	cairo_surface_write_to_png (surface, png_name);
+	(target->write_to_png) (surface, png_name);
 	pixels_changed = image_diff (png_name, ref_name, diff_name);
 	if (pixels_changed) {
 	    if (pixels_changed > 0)
@@ -536,21 +645,42 @@
     cairo_test_status_t status, ret;
     cairo_test_target_t targets[] = 
 	{
-	    { "image", create_image_surface, cleanup_image}, 
+	    { "image", CAIRO_FORMAT_ARGB32,
+		create_argb_image_surface, cairo_surface_write_to_png, 
+		cleanup_image }, 
+	    { "image", CAIRO_FORMAT_RGB24, 
+		create_rgb_image_surface, cairo_surface_write_to_png,
+		cleanup_image }, 
 #if 0 /* #ifdef CAIRO_HAS_GLITZ_SURFACE */
-	    { "glitz", create_glitz_surface, cleanup_glitz}, 
+	    { "glitz", CAIRO_FORMAT_ARGB32, 
+		create_glitz_surface, cairo_surface_write_to_png, 
+		cleanup_glitz }, 
 #endif
 #if 0 && CAIRO_HAS_QUARTZ_SURFACE
-	    { "quartz", create_quartz_surface, cleanup_quartz},
+	    { "quartz", CAIRO_FORMAT_RGB24,
+		create_quartz_surface, cairo_surface_write_to_png,
+		cleanup_quartz },
 #endif
 #if 0 && CAIRO_HAS_WIN32_SURFACE
-	    { "win32", create_win32_surface, cleanup_win32},
+	    { "win32", CAIRO_FORMAT_RGB24,
+		create_win32_surface, cairo_surface_write_to_png,
+		cleanup_win32 },
 #endif
 #if CAIRO_HAS_XCB_SURFACE
-	    { "xcb", create_xcb_surface, cleanup_xcb},
+	    { "xcb", CAIRO_FORMAT_ARGB32,
+		create_xcb_surface, cairo_surface_write_to_png, cleanup_xcb},
 #endif
 #if CAIRO_HAS_XLIB_SURFACE
-	    { "xlib", create_xlib_surface, cleanup_xlib},
+	    { "xlib", CAIRO_FORMAT_ARGB32, 
+		create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib},
+#endif
+#if CAIRO_HAS_PS_SURFACE
+	    { "ps", CAIRO_FORMAT_RGB24, 
+		create_ps_surface, ps_surface_write_to_png, cleanup_ps },
+#endif
+#if 0 && CAIRO_HAS_PDF_SURFACE
+	    { "pdf", CAIRO_FORMAT_RGB24, 
+		create_pdf_surface, pdf_surface_write_to_png, cleanup_pdf },
 #endif
 	};
 
@@ -571,7 +701,7 @@
     for (i=0; i < sizeof(targets)/sizeof(targets[0]); i++) {
 	cairo_test_target_t *target = &targets[i];
 	cairo_test_log ("Testing %s with %s target\n", test->name, target->name);
-	printf ("%s-%s:\t", test->name, target->name);
+	printf ("%s-%s-%s:\t", test->name, target->name, cairo_target_format_name(target));
 	status = cairo_test_for_target (test, draw, target);
 	switch (status) {
 	case CAIRO_TEST_SUCCESS:

--- NEW FILE: caps-joins-ps-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: caps-joins-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: caps-sub-paths-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: clip-all-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: clip-nesting-ps-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: clip-nesting-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: clip-operator-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: clip-twice-ps-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: clip-twice-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: composite-integer-translate-over-repeat-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: composite-integer-translate-over-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: composite-integer-translate-source-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: create-from-png-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: create-from-png-stream-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: dash-caps-joins-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: dash-offset-negative-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: fill-and-stroke-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: fill-rule-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: filter-nearest-offset-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: gradient-alpha-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: leaky-polygon-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: line-width-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: linear-gradient-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: mask-ctm-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: mask-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: mask-surface-ctm-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: move-to-show-surface-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: nil-surface-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: operator-clear-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: operator-source-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: paint-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: paint-with-alpha-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: path-data-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: pixman-rotate-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: rectangle-rounding-error-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: rel-path-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: scale-source-surface-paint-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: self-copy-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: self-intersecting-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: set-source-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: show-text-current-point-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: source-clip-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: source-surface-scale-paint-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: surface-pattern-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: text-antialias-gray-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: text-antialias-none-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: text-antialias-subpixel-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: text-pattern-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: text-rotate-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: transforms-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: translate-show-surface-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: trap-clip-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: unantialiased-shapes-ps-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: unantialiased-shapes-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: unbounded-operator-rgb24-ref.png ---
(This appears to be a binary file; contents omitted.)



More information about the cairo-commit mailing list