From d5535c993b5cde5df29a7a29339aa500992128bf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 19 Apr 2007 20:36:14 -0400 Subject: [PATCH] [boilerplate/test] Move vector_ignored_tests from boilerplate/ to test/ --- boilerplate/cairo-boilerplate.c | 28 --------------- test/cairo-test.c | 62 ++++++++++++++++++++++++--------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index 1eda4b8a7..cd86fef21 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -72,22 +72,6 @@ typedef enum cairo_internal_surface_type { CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED } cairo_internal_surface_type_t; -static const char *vector_ignored_tests[] = { - /* We can't match the results of tests that depend on - * CAIRO_ANTIALIAS_NONE/SUBPIXEL for vector backends - * (nor do we care). */ - "ft-text-antialias-none", - "rectangle-rounding-error", - "text-antialias-gray", - "text-antialias-none", - "text-antialias-subpixel", - "unantialiased-shapes", - - /* Nor do we care about rendering anomalies in external renderers. */ - "fill-degenerate-sort-order", - NULL -}; - const char * cairo_boilerplate_content_name (cairo_content_t content) { @@ -890,10 +874,6 @@ _cairo_boilerplate_ps_create_surface (const char *name, cairo_surface_t *surface; int i; - for (i = 0; vector_ignored_tests[i] != NULL; i++) - if (strcmp (name, vector_ignored_tests[i]) == 0) - return NULL; - /* Sanitize back to a real cairo_content_t value. */ if (content == CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED) content = CAIRO_CONTENT_COLOR_ALPHA; @@ -1007,10 +987,6 @@ _cairo_boilerplate_pdf_create_surface (const char *name, cairo_surface_t *surface; int i; - for (i = 0; vector_ignored_tests[i] != NULL; i++) - if (strcmp (name, vector_ignored_tests[i]) == 0) - return NULL; - /* Sanitize back to a real cairo_content_t value. */ if (content == CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED) content = CAIRO_CONTENT_COLOR_ALPHA; @@ -1117,10 +1093,6 @@ _cairo_boilerplate_svg_create_surface (const char *name, svg_target_closure_t *ptc; cairo_surface_t *surface; - for (i = 0; vector_ignored_tests[i] != NULL; i++) - if (strcmp (name, vector_ignored_tests[i]) == 0) - return NULL; - *closure = ptc = xmalloc (sizeof (svg_target_closure_t)); ptc->width = width; diff --git a/test/cairo-test.c b/test/cairo-test.c index 1582d9348..7bc5dd65f 100755 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -75,6 +75,22 @@ static const char *fail_face = "", *normal_face = ""; #define NUM_DEVICE_OFFSETS 2 +static const char *vector_ignored_tests[] = { + /* We can't match the results of tests that depend on + * CAIRO_ANTIALIAS_NONE/SUBPIXEL for vector backends + * (nor do we care). */ + "ft-text-antialias-none", + "rectangle-rounding-error", + "text-antialias-gray", + "text-antialias-none", + "text-antialias-subpixel", + "unantialiased-shapes", + + /* Nor do we care about rendering anomalies in external renderers. */ + "fill-degenerate-sort-order", + NULL +}; + /* Static data is messy, but we're coding for tests here, not a * general-purpose library, and it keeps the tests cleaner to avoid a * context object there, (though not a whole lot). */ @@ -194,10 +210,10 @@ cairo_test_for_target (cairo_test_t *test, int dev_offset) { cairo_test_status_t status; - cairo_surface_t *surface; + cairo_surface_t *surface = NULL; cairo_t *cr; char *png_name, *ref_name, *diff_name, *offset_str; - cairo_test_status_t ret; + cairo_test_status_t ret = CAIRO_TEST_SUCCESS; cairo_content_t expected_content; cairo_font_options_t *font_options; const char *format; @@ -221,22 +237,36 @@ cairo_test_for_target (cairo_test_t *test, format, offset_str, CAIRO_TEST_DIFF_SUFFIX); - /* Run the actual drawing code. */ - if (test->width && test->height) { - test->width += dev_offset; - test->height += dev_offset; + if (target->is_vector) { + int i; + + for (i = 0; vector_ignored_tests[i] != NULL; i++) + if (strcmp (test->name, vector_ignored_tests[i]) == 0) { + cairo_test_log ("Error: Skipping for vector target %s\n", target->name); + ret = CAIRO_TEST_UNTESTED; + goto UNWIND_STRINGS; + } } - surface = (target->create_surface) (test->name, - target->content, - test->width, - test->height, - CAIRO_BOILERPLATE_MODE_TEST, - &target->closure); + if (ret == CAIRO_TEST_SUCCESS) { + /* Run the actual drawing code. */ - if (test->width && test->height) { - test->width -= dev_offset; - test->height -= dev_offset;; + if (test->width && test->height) { + test->width += dev_offset; + test->height += dev_offset; + } + + surface = (target->create_surface) (test->name, + target->content, + test->width, + test->height, + CAIRO_BOILERPLATE_MODE_TEST, + &target->closure); + + if (test->width && test->height) { + test->width -= dev_offset; + test->height -= dev_offset;; + } } if (surface == NULL) { @@ -342,8 +372,6 @@ cairo_test_for_target (cairo_test_t *test, } } - ret = CAIRO_TEST_SUCCESS; - UNWIND_CAIRO: cairo_destroy (cr); UNWIND_SURFACE: