diff options
author | Carl Worth <cworth@cworth.org> | 2005-08-19 07:39:47 +0000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2005-08-19 07:39:47 +0000 |
commit | b626dff5b9783ba8916365478c583551d7d97a23 (patch) | |
tree | 52b9b75b914b2f2afda829ff7b7a4005444f16e1 /test/nil-surface.c | |
parent | 435fb3c65f3edd7687a332f274545abf7e601965 (diff) | |
download | cairo-b626dff5b9783ba8916365478c583551d7d97a23.tar.gz |
Fix for bug #3915:
Add new NULL_POINTER nil pattern.
Check for surface == NULL and return a nil pattern.
Verify that the above fix works.
Diffstat (limited to 'test/nil-surface.c')
-rw-r--r-- | test/nil-surface.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/test/nil-surface.c b/test/nil-surface.c index 335cd45fa..b1e83d4b4 100644 --- a/test/nil-surface.c +++ b/test/nil-surface.c @@ -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 @@ draw (cairo_t *cr, int width, int height) 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 @@ draw (cairo_t *cr, int width, int height) 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); |