summaryrefslogtreecommitdiff
path: root/test/copy-path.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-10-04 09:08:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2007-10-04 09:18:36 +0100
commitef5f460eb1f86a73e016c1150723ae1e70b3b037 (patch)
tree917c10c05e7b97deca027789695e4e2559b15e7d /test/copy-path.c
parent8ad56b308ae8bbecfe9873c21551a6d4b2302420 (diff)
[cairo-path] Check for an empty path in cairo_append_path().
As we now generate empty paths, we must be able to handle empty paths in the user facing API. cairo_append_path() has an explicit check, and raises an error, for a NULL path->data, so we need to check the path->num_data first for empty paths.
Diffstat (limited to 'test/copy-path.c')
-rw-r--r--test/copy-path.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/copy-path.c b/test/copy-path.c
index 256f46123..362bb34d3 100644
--- a/test/copy-path.c
+++ b/test/copy-path.c
@@ -141,7 +141,13 @@ draw (cairo_t *cr, int width, int height)
cairo_path_destroy (path);
return CAIRO_TEST_FAILURE;
}
+ cairo_append_path (cr, path);
cairo_path_destroy (path);
+ if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
+ cairo_test_log ("Error: cairo_append_path failed with a copy of an empty path, returned status of %s\n",
+ cairo_status_to_string (cairo_status (cr)));
+ return CAIRO_TEST_FAILURE;
+ }
/* We draw in the default black, so paint white first. */
cairo_save (cr);
@@ -224,6 +230,15 @@ main (void)
path.num_data = 0;
path.status = CAIRO_STATUS_SUCCESS;
cairo_append_path (cr, &path);
+ if (cairo_status (cr) != CAIRO_STATUS_SUCCESS)
+ return 1;
+ cairo_destroy (cr);
+
+ cr = cairo_create (surface);
+ path.data = NULL;
+ path.num_data = 1;
+ path.status = CAIRO_STATUS_SUCCESS;
+ cairo_append_path (cr, &path);
if (cairo_status (cr) != CAIRO_STATUS_NULL_POINTER)
return 1;
cairo_destroy (cr);