Don't consider a test to fail if it can't create a surface at all (eg. no X server is available). Instead mark this backend as untested and only consider the overall test a success if all tested backend are successful.

This commit is contained in:
Carl Worth 2005-07-14 12:20:42 +00:00
parent 0c3ee348f8
commit 456e3ffc4d
3 changed files with 36 additions and 6 deletions

View file

@ -1,3 +1,11 @@
2005-07-14 Carl Worth <cworth@cworth.org>
* test/cairo-test.c: (cairo_test_for_target), (cairo_test_real):
* test/cairo-test.h: Don't consider a test to fail if it can't
create a surface at all (eg. no X server is available). Instead
mark this backend as untested and only consider the overall test a
success if all tested backend are successful.
2005-07-14 Carl Worth <cworth@cworth.org>
* src/cairo-ps-surface.c: (pattern_is_translucent): Add missing

View file

@ -421,7 +421,7 @@ cairo_test_for_target (cairo_test_t *test,
&target->closure);
if (surface == NULL) {
cairo_test_log ("Error: Failed to set %s target\n", target->name);
ret = CAIRO_TEST_FAILURE;
ret = CAIRO_TEST_UNTESTED;
goto UNWIND_STRINGS;
}
@ -517,19 +517,40 @@ cairo_test_real (cairo_test_t *test, cairo_test_draw_function_t draw)
}
free (log_name);
ret = CAIRO_TEST_SUCCESS;
/* The intended logic here is that we return overall SUCCESS
* iff. all tested backends return SUCCESS. In other words:
*
* if any backend FAILURE
* -> FAILURE
* else if all backends UNTESTED
* -> FAILURE
* else (== some backend SUCCESS)
* -> SUCCESS
*/
ret = CAIRO_TEST_UNTESTED;
for (i=0; i < sizeof(targets)/sizeof(targets[0]); i++) {
cairo_test_target_t *target = &targets[i];
cairo_test_log ("Testing %s with %s target\n", test->name, target->name);
printf ("%s-%s:\t", test->name, target->name);
status = cairo_test_for_target (test, draw, target);
if (status) {
switch (status) {
case CAIRO_TEST_SUCCESS:
printf ("PASS\n");
if (ret == CAIRO_TEST_UNTESTED)
ret = CAIRO_TEST_SUCCESS;
break;
case CAIRO_TEST_UNTESTED:
printf ("UNTESTED\n");
break;
default:
case CAIRO_TEST_FAILURE:
printf ("FAIL\n");
ret = status;
} else {
printf ("PASS\n");
break;
}
}
if (ret == CAIRO_TEST_UNTESTED)
ret = CAIRO_TEST_FAILURE;
fclose (cairo_test_log_file);

View file

@ -31,7 +31,8 @@
typedef enum cairo_test_status {
CAIRO_TEST_SUCCESS = 0,
CAIRO_TEST_FAILURE
CAIRO_TEST_FAILURE,
CAIRO_TEST_UNTESTED
} cairo_test_status_t;
typedef struct cairo_test {