[cairo-commit]
cairo/test cairo_test.c, 1.10, 1.11 cairo_test.h, 1.3,
1.4 clip_twice.c, 1.1, 1.2 coverage.c, 1.2, 1.3 fill_rule.c,
1.2, 1.3 leaky_polygon.c, 1.1, 1.2 line_width.c, 1.1,
1.2 linear_gradient.c, 1.1, 1.2 move_to_show_surface.c, 1.1,
1.2 pixman_rotate.c, 1.2, 1.3 text_cache_crash.c, 1.4,
1.5 text_rotate.c, 1.3, 1.4
Carl Worth
commit at pdx.freedesktop.org
Wed Mar 9 13:58:22 PST 2005
Committed by: cworth
Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv6001/test
Modified Files:
cairo_test.c cairo_test.h clip_twice.c coverage.c fill_rule.c
leaky_polygon.c line_width.c linear_gradient.c
move_to_show_surface.c pixman_rotate.c text_cache_crash.c
text_rotate.c
Log Message:
* test/cairo_test.c: (cairo_test):
* test/cairo_test.h:
* test/clip_twice.c: (draw):
* test/coverage.c: (draw):
* test/fill_rule.c: (draw):
* test/leaky_polygon.c: (draw):
* test/line_width.c: (draw):
* test/linear_gradient.c: (draw):
* test/move_to_show_surface.c: (draw):
* test/pixman_rotate.c: (draw):
* test/text_cache_crash.c: (draw):
* test/text_rotate.c: (draw): Change the draw function under test
to return a cairo_test_status_t so that it can indicate test
failure even if there is no result image.
Index: cairo_test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo_test.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cairo_test.c 9 Mar 2005 03:25:39 -0000 1.10
+++ cairo_test.c 9 Mar 2005 21:58:20 -0000 1.11
@@ -98,6 +98,7 @@
cairo_test_status_t
cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw)
{
+ cairo_test_status_t status;
cairo_t *cr;
int stride;
unsigned char *png_buf, *ref_buf, *diff_buf;
@@ -110,6 +111,8 @@
FILE *png_file;
FILE *log_file;
+ xunlink (log_name);
+
/* The cairo part of the test is the easiest part */
cr = cairo_create ();
@@ -121,7 +124,20 @@
cairo_set_target_image (cr, png_buf, CAIRO_FORMAT_ARGB32,
test->width, test->height, stride);
- (draw) (cr, test->width, test->height);
+ status = (draw) (cr, test->width, test->height);
+ if (status) {
+ log_file = fopen (log_name, "a");
+ fprintf (log_file, "Error: Function under test failed\n");
+ fclose (log_file);
+ return status;
+ }
+
+ if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
+ log_file = fopen (log_name, "a");
+ fprintf (log_file, "Error: Function under test left cairo status in an error state: %s\n", cairo_status_string (cr));
+ fclose (log_file);
+ return CAIRO_TEST_FAILURE;
+ }
cairo_destroy (cr);
@@ -145,8 +161,6 @@
write_png_argb32 (png_buf, png_file, test->width, test->height, stride);
fclose (png_file);
- xunlink (log_name);
-
ref_buf = NULL;
png_status = (read_png_argb32 (ref_name, &ref_buf, &ref_width, &ref_height, &ref_stride));
if (png_status) {
Index: cairo_test.h
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo_test.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo_test.h 26 Jan 2005 21:41:55 -0000 1.3
+++ cairo_test.h 9 Mar 2005 21:58:20 -0000 1.4
@@ -41,7 +41,7 @@
int height;
} cairo_test_t;
-typedef void (*cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
+typedef cairo_test_status_t (*cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
/* cairo_test.c */
cairo_test_status_t
Index: clip_twice.c
===================================================================
RCS file: /cvs/cairo/cairo/test/clip_twice.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- clip_twice.c 27 Jan 2005 05:46:01 -0000 1.1
+++ clip_twice.c 9 Mar 2005 21:58:20 -0000 1.2
@@ -34,7 +34,7 @@
WIDTH, HEIGHT
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_set_alpha (cr, 1.0);
@@ -63,6 +63,8 @@
cairo_line_to (cr, WIDTH / 2, HEIGHT / 4);
cairo_close_path (cr);
cairo_fill (cr);
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: coverage.c
===================================================================
RCS file: /cvs/cairo/cairo/test/coverage.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- coverage.c 26 Jan 2005 22:21:53 -0000 1.2
+++ coverage.c 9 Mar 2005 21:58:20 -0000 1.3
@@ -129,7 +129,7 @@
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
/* TODO: pattern fill, gradient fill, clipping, gradient clipping,
@@ -173,6 +173,8 @@
}
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: fill_rule.c
===================================================================
RCS file: /cvs/cairo/cairo/test/fill_rule.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fill_rule.c 12 Jan 2005 22:38:22 -0000 1.2
+++ fill_rule.c 9 Mar 2005 21:58:20 -0000 1.3
@@ -97,7 +97,7 @@
}
/* Fill the same path twice, once with each fill rule */
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_set_rgb_color (cr, 1, 0, 0);
@@ -121,6 +121,8 @@
big_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill (cr);
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: leaky_polygon.c
===================================================================
RCS file: /cvs/cairo/cairo/test/leaky_polygon.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- leaky_polygon.c 13 Jan 2005 22:50:35 -0000 1.1
+++ leaky_polygon.c 9 Mar 2005 21:58:20 -0000 1.2
@@ -62,7 +62,7 @@
WIDTH, HEIGHT
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_scale (cr, 1.0/(1<<16), 1.0/(1<<16));
@@ -73,6 +73,8 @@
cairo_close_path (cr);
cairo_fill (cr);
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: line_width.c
===================================================================
RCS file: /cvs/cairo/cairo/test/line_width.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- line_width.c 26 Oct 2004 21:38:43 -0000 1.1
+++ line_width.c 9 Mar 2005 21:58:20 -0000 1.2
@@ -36,7 +36,7 @@
IMAGE_WIDTH, IMAGE_HEIGHT
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i;
@@ -54,6 +54,8 @@
cairo_stroke (cr);
cairo_translate (cr, 0, i+3);
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: linear_gradient.c
===================================================================
RCS file: /cvs/cairo/cairo/test/linear_gradient.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- linear_gradient.c 6 Mar 2005 20:05:23 -0000 1.1
+++ linear_gradient.c 9 Mar 2005 21:58:20 -0000 1.2
@@ -108,7 +108,7 @@
cairo_fill (cr);
}
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i, j, k;
@@ -132,6 +132,8 @@
n_stops[k]);
cairo_restore (cr);
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: move_to_show_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/test/move_to_show_surface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- move_to_show_surface.c 26 Oct 2004 21:38:43 -0000 1.1
+++ move_to_show_surface.c 9 Mar 2005 21:58:20 -0000 1.2
@@ -43,7 +43,7 @@
2, 2
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
@@ -60,6 +60,8 @@
cairo_show_surface (cr, surface, 1, 1);
cairo_surface_destroy (surface);
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: pixman_rotate.c
===================================================================
RCS file: /cvs/cairo/cairo/test/pixman_rotate.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pixman_rotate.c 9 Mar 2005 20:35:36 -0000 1.2
+++ pixman_rotate.c 9 Mar 2005 21:58:20 -0000 1.3
@@ -22,7 +22,7 @@
};
/* Draw the word cairo at NUM_TEXT different angles */
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *target, *stamp;
@@ -69,6 +69,8 @@
cairo_surface_destroy (stamp);
cairo_surface_destroy (target);
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: text_cache_crash.c
===================================================================
RCS file: /cvs/cairo/cairo/test/text_cache_crash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- text_cache_crash.c 20 Dec 2004 16:08:29 -0000 1.4
+++ text_cache_crash.c 9 Mar 2005 21:58:20 -0000 1.5
@@ -69,7 +69,7 @@
};
#include <cairo.h>
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
/* Once there was a bug that choked when selecting the same font twice. */
@@ -105,6 +105,8 @@
cairo_scale_font (cr, 500);
cairo_show_text (cr, "hello");
*/
+
+ return CAIRO_TEST_SUCCESS;
}
int
Index: text_rotate.c
===================================================================
RCS file: /cvs/cairo/cairo/test/text_rotate.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- text_rotate.c 9 Nov 2004 22:27:32 -0000 1.3
+++ text_rotate.c 9 Mar 2005 21:58:20 -0000 1.4
@@ -71,7 +71,7 @@
};
/* Draw the word cairo at NUM_TEXT different angles */
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i, x_off, y_off;
@@ -108,6 +108,8 @@
cairo_show_text (cr, "cairo");
cairo_restore (cr);
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
More information about the cairo-commit
mailing list