From 82cccb26723697492504f395fed33afba28d84ba Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 14 Apr 2009 11:01:39 +0100 Subject: [PATCH] [test] Handle memfaults during surface-finish-twice Check and report memory allocation failures. --- test/surface-finish-twice.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/surface-finish-twice.c b/test/surface-finish-twice.c index 5154e99e7..f63b50175 100644 --- a/test/surface-finish-twice.c +++ b/test/surface-finish-twice.c @@ -45,21 +45,26 @@ static cairo_test_status_t draw (cairo_t *cr, int width, int height) { + const cairo_test_context_t *ctx = cairo_test_get_context (cr); cairo_surface_t *surface; + cairo_status_t status; surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1); cairo_surface_finish (surface); - if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) - return CAIRO_TEST_FAILURE; + status = cairo_surface_status (surface); + if (status != CAIRO_STATUS_SUCCESS) + return cairo_test_status_from_status (ctx, status); cairo_surface_finish (surface); - if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) - return CAIRO_TEST_FAILURE; + status = cairo_surface_status (surface); + if (status != CAIRO_STATUS_SUCCESS) + return cairo_test_status_from_status (ctx, status); cairo_surface_finish (surface); - if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) - return CAIRO_TEST_FAILURE; + status = cairo_surface_status (surface); + if (status != CAIRO_STATUS_SUCCESS) + return cairo_test_status_from_status (ctx, status); cairo_surface_destroy (surface);