[cairo-commit] cairo/test nil-surface.c,1.1,1.2
Carl Worth
commit at pdx.freedesktop.org
Sat Aug 20 00:39:50 EST 2005
Committed by: cworth
Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv7831/test
Modified Files:
nil-surface.c
Log Message:
2005-08-19 Carl Worth <cworth at cworth.org>
Fix for bug #3915:
* src/cairo-pattern.c: (_cairo_pattern_nil_for_status): Add new
NULL_POINTER nil pattern.
* src/cairo-pattern.c: (cairo_pattern_create_for_surface): Check
for surface == NULL and return a nil pattern.
* test/nil-surface.c: (draw): Verify that the above fix works.
Index: nil-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/test/nil-surface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- nil-surface.c 19 Aug 2005 06:10:42 -0000 1.1
+++ nil-surface.c 19 Aug 2005 14:39:48 -0000 1.2
@@ -26,7 +26,11 @@
#include "cairo-test.h"
#include <cairo-ft.h>
-/* Test case for: https://bugs.freedesktop.org/show_bug.cgi?id=4088 */
+/* Test to verify fixes for the following similar bugs:
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=4088
+ * https://bugs.freedesktop.org/show_bug.cgi?id=3915
+ */
cairo_test_t test = {
"nil-surface",
@@ -41,6 +45,10 @@
cairo_pattern_t *pattern;
cairo_t *cr2;
+ /*
+ * 1. Test file-not-found from surface->pattern->cairo_t
+ */
+
/* Make a custom context to not interfere with the one passed in. */
cr2 = cairo_create (cairo_get_target (cr));
@@ -58,8 +66,36 @@
cairo_surface_destroy (surface);
/* Check that the error made it all that way. */
- if (cairo_status (cr2) != CAIRO_STATUS_FILE_NOT_FOUND)
+ if (cairo_status (cr2) != CAIRO_STATUS_FILE_NOT_FOUND) {
+ cairo_test_log ("Error: Received status of \"%s\" rather than expected \"%s\"\n",
+ cairo_status_to_string (cairo_status (cr2)),
+ cairo_status_to_string (CAIRO_STATUS_FILE_NOT_FOUND));
+ return CAIRO_TEST_FAILURE;
+ }
+
+ cairo_destroy (cr2);
+
+ /*
+ * 2. Test NULL pointer pattern->cairo_t
+ */
+ cr2 = cairo_create (cairo_get_target (cr));
+
+ /* First, trigger the NULL pointer status. */
+ pattern = cairo_pattern_create_for_surface (NULL);
+
+ /* Then let it propagate into the cairo_t. */
+ cairo_set_source (cr2, pattern);
+ cairo_paint (cr2);
+
+ cairo_pattern_destroy (pattern);
+
+ /* Check that the error made it all that way. */
+ if (cairo_status (cr2) != CAIRO_STATUS_NULL_POINTER) {
+ cairo_test_log ("Error: Received status of \"%s\" rather than expected \"%s\"\n",
+ cairo_status_to_string (cairo_status (cr2)),
+ cairo_status_to_string (CAIRO_STATUS_NULL_POINTER));
return CAIRO_TEST_FAILURE;
+ }
cairo_destroy (cr2);
More information about the cairo-commit
mailing list