summaryrefslogtreecommitdiff
path: root/test/api-special-cases.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-07-05 20:47:19 +0200
committerBenjamin Otte <otte@redhat.com>2010-07-05 21:01:56 +0200
commit72878d70ea75be03f47fa9d53f8305e76162054e (patch)
treeda50c2cf544822b2d3beb17a14164598e04f884e /test/api-special-cases.c
parent9de25a0297c141a0776835920168afaa3ca77a87 (diff)
downloadcairo-72878d70ea75be03f47fa9d53f8305e76162054e.tar.gz
test: Add a new test variant to api-special-cases test
This variant tests a (hopefully) inert error surface.
Diffstat (limited to 'test/api-special-cases.c')
-rw-r--r--test/api-special-cases.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/api-special-cases.c b/test/api-special-cases.c
index ebac5c500..d1eaff8b5 100644
--- a/test/api-special-cases.c
+++ b/test/api-special-cases.c
@@ -27,6 +27,7 @@
#include "config.h"
#endif
+#include <assert.h>
#include <limits.h>
#include "cairo-test.h"
@@ -304,6 +305,39 @@ struct {
static cairo_test_status_t
preamble (cairo_test_context_t *ctx)
{
+ cairo_surface_t *surface;
+ cairo_test_status_t test_status;
+ cairo_status_t status_before, status_after;
+ unsigned int i;
+
+ /* Test an error surface */
+ for (i = 0; i < ARRAY_LENGTH (tests); i++) {
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, INT_MAX, INT_MAX);
+ status_before = cairo_surface_status (surface);
+ assert (status_before);
+
+ test_status = tests[i].func (surface);
+
+ status_after = cairo_surface_status (surface);
+ cairo_surface_destroy (surface);
+
+ if (test_status != CAIRO_TEST_SUCCESS) {
+ cairo_test_log (ctx,
+ "Failed test %s with %d\n",
+ tests[i].name, (int) test_status);
+ return test_status;
+ }
+
+ if (status_before != status_after) {
+ cairo_test_log (ctx,
+ "Failed test %s: Modified surface status from %u (%s) to %u (%s)\n",
+ tests[i].name,
+ status_before, cairo_status_to_string (status_before),
+ status_after, cairo_status_to_string (status_after));
+ return CAIRO_TEST_ERROR;
+ }
+ }
+
return CAIRO_TEST_SUCCESS;
}
@@ -318,6 +352,7 @@ draw (cairo_t *cr, int width, int height)
target = cairo_get_target (cr);
+ /* Test a finished similar surface */
for (i = 0; i < ARRAY_LENGTH (tests); i++) {
similar = cairo_surface_create_similar (target,
cairo_surface_get_content (target),