summaryrefslogtreecommitdiff
path: root/test/imagediff.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-08-31 04:01:10 -0700
committerCarl Worth <cworth@cworth.org>2006-08-31 04:01:10 -0700
commitd1834cca192fe6f8e429be0461fab6914e04024d (patch)
treebae8be8e3f1604d25682131660937c44a19a7e9b /test/imagediff.c
parentd52a1f762d33f3ada919b581e0d62f8ba1c2314c (diff)
test: Ignore single-bit errors for SVG backend.
The interface of the various buffer/image_diff functions is improved to provide the maximum pixel difference in addition to the number of pixels that differ. This value can then be used to compare against a per-backend tolerance. Currently I've set the SVG backend's tolerance to 1 to handle some issues we're currently seeing of single-bit differences on different systems, (but we're not exactly sure why yet). Also I improved the image_diff routines to properly report a status value on failure rather than the bogus value of -1 for pixels_changed.
Diffstat (limited to 'test/imagediff.c')
-rw-r--r--test/imagediff.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/test/imagediff.c b/test/imagediff.c
index 903087745..188c1a979 100644
--- a/test/imagediff.c
+++ b/test/imagediff.c
@@ -32,7 +32,8 @@
int
main (int argc, char *argv[])
{
- int total_pixels_changed;
+ buffer_diff_result_t result;
+ cairo_status_t status;
unsigned int ax, ay, bx, by;
@@ -53,10 +54,18 @@ main (int argc, char *argv[])
ax = ay = bx = by = 0;
}
- total_pixels_changed = image_diff (argv[1], argv[2], NULL, ax, ay, bx, by);
+ status = image_diff (argv[1], argv[2], NULL, ax, ay, bx, by, &result);
- if (total_pixels_changed)
- fprintf (stderr, "Total pixels changed: %d\n", total_pixels_changed);
+ if (status) {
+ fprintf (stderr, "Error comparing images: %s\n",
+ cairo_status_to_string (status));
+ return 1;
+ }
+
+ if (result.pixels_changed)
+ fprintf (stderr, "Total pixels changed: %d with a maximum channel difference of %d.\n",
+ result.pixels_changed,
+ result.max_diff);
- return (total_pixels_changed != 0);
+ return (result.pixels_changed != 0);
}