mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 18:08:03 +02:00
test: Add a new test variant to api-special-cases test
This variant tests a (hopefully) inert error surface.
This commit is contained in:
parent
9de25a0297
commit
72878d70ea
1 changed files with 35 additions and 0 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue