summaryrefslogtreecommitdiff
path: root/test/solid-pattern-cache-stress.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-03-22 19:00:04 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2009-03-24 07:50:58 +0000
commitb5a4a2c4b1b1bab25e2ff0842e3c27205ec73d51 (patch)
tree5016b842dd2e04e1408c47824d1dcb6f3b78ab3e /test/solid-pattern-cache-stress.c
parent1a7b94f934f8c9a25e60d9466651b0b7fb919656 (diff)
downloadcairo-b5a4a2c4b1b1bab25e2ff0842e3c27205ec73d51.tar.gz
[test] Early test for memfault.
Check the error status within after each iteration in solid-pattern-cache-stress.
Diffstat (limited to 'test/solid-pattern-cache-stress.c')
-rw-r--r--test/solid-pattern-cache-stress.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/test/solid-pattern-cache-stress.c b/test/solid-pattern-cache-stress.c
index ec183fde7..285275e1d 100644
--- a/test/solid-pattern-cache-stress.c
+++ b/test/solid-pattern-cache-stress.c
@@ -108,6 +108,9 @@ use_similar (cairo_t *cr,
{
cairo_t *cr2;
+ if (cairo_status (cr))
+ return;
+
cr2 = _cairo_create_similar (cr, 1, 1);
_draw (cr2, red, green, blue);
@@ -125,6 +128,9 @@ use_image (cairo_t *cr,
{
cairo_t *cr2;
+ if (cairo_status (cr))
+ return;
+
cr2 = _cairo_create_image (cr, format, 1, 1);
_draw (cr2, red, green, blue);
@@ -153,23 +159,36 @@ use_solid (cairo_t *cr,
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- int loop;
- int i;
+ const cairo_test_context_t *ctx = cairo_test_get_context (cr);
+ cairo_status_t status;
+ const double colors[8][3] = {
+ { 1.0, 0.0, 0.0 }, /* red */
+ { 0.0, 1.0, 0.0 }, /* green */
+ { 1.0, 1.0, 0.0 }, /* yellow */
+ { 0.0, 0.0, 1.0 }, /* blue */
+ { 1.0, 0.0, 1.0 }, /* magenta */
+ { 0.0, 1.0, 1.0 }, /* cyan */
+ { 1.0, 1.0, 1.0 }, /* white */
+ { 0.0, 0.0, 0.0 }, /* black */
+ };
+ int i, j, loop;
for (loop = 0; loop < LOOPS; loop++) {
for (i = 0; i < LOOPS; i++) {
- use_solid (cr, 0.0, 0.0, 0.0); /* black */
- use_solid (cr, 1.0, 0.0, 0.0); /* red */
- use_solid (cr, 0.0, 1.0, 0.0); /* green */
- use_solid (cr, 1.0, 1.0, 0.0); /* yellow */
- use_solid (cr, 0.0, 0.0, 1.0); /* blue */
- use_solid (cr, 1.0, 0.0, 1.0); /* magenta */
- use_solid (cr, 0.0, 1.0, 1.0); /* cyan */
- use_solid (cr, 1.0, 1.0, 1.0); /* white */
+ for (j = 0; j < 8; j++) {
+ use_solid (cr, colors[j][0], colors[j][1], colors[j][2]);
+ status = cairo_status (cr);
+ if (status)
+ return cairo_test_status_from_status (ctx, status);
+ }
}
- for (i = 0; i < NRAND; i++)
+ for (i = 0; i < NRAND; i++) {
use_solid (cr, drand48 (), drand48 (), drand48 ());
+ status = cairo_status (cr);
+ if (status)
+ return cairo_test_status_from_status (ctx, status);
+ }
}
/* stress test only, so clear the surface before comparing */