summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2006-02-15 13:46:52 -0800
committerCarl Worth <cworth@cworth.org>2006-05-03 23:42:45 -0700
commitb3e2252b94297b7fbdbd3a3776781ea6df7c8bc6 (patch)
treecda8fb5fdc5d631777e2ab145b8d416339cdbe50 /test
parent7beb3e27a552c724bbdb147bc27b775af0d61063 (diff)
downloadcairo-b3e2252b94297b7fbdbd3a3776781ea6df7c8bc6.tar.gz
Augment test framework to test everything under device offsets as well.
[With this change, two tests with gradients exhibit subtle differences under device offsets. I don't think we actually care about them though. -cworth]
Diffstat (limited to 'test')
-rw-r--r--test/.gitignore36
-rw-r--r--test/buffer-diff.c98
-rw-r--r--test/buffer-diff.h21
-rw-r--r--test/cairo-test.c111
-rw-r--r--test/imagediff.c45
-rwxr-xr-xtest/make-html.pl124
-rw-r--r--test/xlib-surface.c4
7 files changed, 244 insertions, 195 deletions
diff --git a/test/.gitignore b/test/.gitignore
index 3f3c5821c..d4472f2b0 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -91,38 +91,10 @@ unantialiased-shapes
unbounded-operator
user-data
xlib-surface
-*-image-out.png
-*-image-argb32-out.png
-*-image-rgb24-out.png
-*-pdf-argb32-out.png
-*-pdf-argb32-out.pdf
-*-pdf-rgb24-out.png
-*-pdf-rgb24-out.pdf
-*-ps-argb32-out.png
-*-ps-argb32-out.ps
-*-ps-rgb24-out.png
-*-ps-rgb24-out.ps
-*-svg-argb32-out.png
-*-svg-argb32-out.svg
-*-svg-rgb24-out.png
-*-svg-rgb24-out.svg
-*-test-fallback-argb32-out.png
-*-test-fallback-rgb24-out.png
-*-test-meta-argb32-out.png
-*-test-meta-rgb24-out.png
-*-test-paginated-argb32-out.png
-*-test-paginated-rgb24-out.png
-*-xcb-out.png
-*-xcb-argb32-out.png
-*-xcb-rgb24-out.png
-*-xlib-out.png
-*-xlib-argb32-out.png
-*-xlib-rgb24-out.png
-*-beos-rgb24-out.png
-*-beos_bitmap-rgb24-out.png
-*-beos_bitmap-argb32-out.png
-*-glitz-glx-rgb24-out.png
-*-glitz-glx-argb32-out.png
+*-out.pdf
+*-out.png
+*-out.ps
+*-out.svg
*-diff.png
*.gcno
*.la
diff --git a/test/buffer-diff.c b/test/buffer-diff.c
index dd1b7c664..c62c44ef4 100644
--- a/test/buffer-diff.c
+++ b/test/buffer-diff.c
@@ -62,7 +62,9 @@ buffer_diff_core (unsigned char *_buf_a,
unsigned char *_buf_diff,
int width,
int height,
- int stride,
+ int stride_a,
+ int stride_b,
+ int stride_diff,
pixman_bits_t mask)
{
int x, y;
@@ -72,12 +74,14 @@ buffer_diff_core (unsigned char *_buf_a,
pixman_bits_t *buf_b = (pixman_bits_t*)_buf_b;
pixman_bits_t *buf_diff = (pixman_bits_t*)_buf_diff;
- stride /= sizeof(pixman_bits_t);
+ stride_a /= sizeof(pixman_bits_t);
+ stride_b /= sizeof(pixman_bits_t);
+ stride_diff /= sizeof(pixman_bits_t);
for (y = 0; y < height; y++)
{
- row_a = buf_a + y * stride;
- row_b = buf_b + y * stride;
- row = buf_diff + y * stride;
+ row_a = buf_a + y * stride_a;
+ row_b = buf_b + y * stride_b;
+ row = buf_diff + y * stride_diff;
for (x = 0; x < width; x++)
{
/* check if the pixels are the same */
@@ -112,9 +116,12 @@ buffer_diff (unsigned char *buf_a,
unsigned char *buf_diff,
int width,
int height,
- int stride)
+ int stride_a,
+ int stride_b,
+ int stride_diff)
{
- return buffer_diff_core(buf_a, buf_b, buf_diff, width, height, stride, 0xffffffff);
+ return buffer_diff_core(buf_a, buf_b, buf_diff,
+ width, height, stride_a, stride_b, stride_diff, 0xffffffff);
}
int
@@ -123,9 +130,12 @@ buffer_diff_noalpha (unsigned char *buf_a,
unsigned char *buf_diff,
int width,
int height,
- int stride)
+ int stride_a,
+ int stride_b,
+ int stride_diff)
{
- return buffer_diff_core(buf_a, buf_b, buf_diff, width, height, stride, 0x00ffffff);
+ return buffer_diff_core(buf_a, buf_b, buf_diff,
+ width, height, stride_a, stride_b, stride_diff, 0x00ffffff);
}
/* Image comparison code courtesy of Richard Worth <richard@theworths.org>
@@ -136,11 +146,16 @@ buffer_diff_noalpha (unsigned char *buf_a,
int
image_diff (const char *filename_a,
const char *filename_b,
- const char *filename_diff)
+ const char *filename_diff,
+ int ax,
+ int ay,
+ int bx,
+ int by)
{
int pixels_changed;
unsigned int width_a, height_a, stride_a;
unsigned int width_b, height_b, stride_b;
+ unsigned int stride_diff;
unsigned char *buf_a, *buf_b, *buf_diff;
read_png_status_t status;
@@ -154,9 +169,13 @@ image_diff (const char *filename_a,
return -1;
}
+ width_a -= ax;
+ height_a -= ay;
+ width_b -= bx;
+ height_b -= by;
+
if (width_a != width_b ||
- height_a != height_b ||
- stride_a != stride_b)
+ height_a != height_b)
{
cairo_test_log ("Error: Image size mismatch: (%dx%d@%d) vs. (%dx%d@%d)\n"
" for %s vs. %s\n",
@@ -168,17 +187,27 @@ image_diff (const char *filename_a,
return -1;
}
- buf_diff = xcalloc (stride_a * height_a, 1);
+ stride_diff = 4 * width_a;
+ buf_diff = xcalloc (stride_diff * height_a, 1);
- pixels_changed = buffer_diff (buf_a, buf_b, buf_diff,
- width_a, height_a, stride_a);
+ pixels_changed = buffer_diff (buf_a + (ay * stride_a) + ax * 4,
+ buf_b + (by * stride_b) + by * 4,
+ buf_diff,
+ width_a, height_a,
+ stride_a, stride_b, stride_diff);
if (pixels_changed) {
- FILE *png_file = fopen (filename_diff, "wb");
- write_png_argb32 (buf_diff, png_file, width_a, height_a, stride_a);
- fclose (png_file);
+ FILE *png_file;
+ if (filename_diff)
+ png_file = fopen (filename_diff, "wb");
+ else
+ png_file = stdout;
+ write_png_argb32 (buf_diff, png_file, width_a, height_a, stride_diff);
+ if (png_file != stdout)
+ fclose (png_file);
} else {
- xunlink (filename_diff);
+ if (filename_diff)
+ xunlink (filename_diff);
}
free (buf_a);
@@ -204,7 +233,11 @@ image_diff (const char *filename_a,
int
image_diff_flattened (const char *filename_a,
const char *filename_b,
- const char *filename_diff)
+ const char *filename_diff,
+ int ax,
+ int ay,
+ int bx,
+ int by)
{
int pixels_changed;
unsigned int width_a, height_a, stride_a;
@@ -225,9 +258,13 @@ image_diff_flattened (const char *filename_a,
return -1;
}
+ width_a -= ax;
+ height_a -= ay;
+ width_b -= bx;
+ height_b -= by;
+
if (width_a != width_b ||
- height_a != height_b ||
- stride_a != stride_b)
+ height_a != height_b)
{
cairo_test_log ("Error: Image size mismatch: (%dx%d@%d) vs. (%dx%d@%d)\n"
" for %s vs. %s\n",
@@ -241,17 +278,19 @@ image_diff_flattened (const char *filename_a,
buf_b_surface = cairo_image_surface_create_for_data (buf_b,
CAIRO_FORMAT_ARGB32,
- width_b, height_b,
+ width_b + bx, height_b + bx,
stride_b);
buf_diff = xcalloc (stride_a * height_a, 1);
- b_flat = xcalloc (stride_b * height_b, 1);
+ b_flat = xcalloc (stride_a * height_a, 1);
b_flat_surface = cairo_image_surface_create_for_data (b_flat,
CAIRO_FORMAT_ARGB32,
- width_b, height_b,
- stride_b);
+ width_a, height_a,
+ stride_a);
+ /*cairo_surface_set_device_offset (b_flat_surface, -bx, -by);*/
+
cr = cairo_create (b_flat_surface);
cairo_set_source_rgb (cr, 1, 1, 1);
@@ -263,8 +302,11 @@ image_diff_flattened (const char *filename_a,
cairo_surface_destroy (b_flat_surface);
cairo_surface_destroy (buf_b_surface);
- pixels_changed = buffer_diff (buf_a, b_flat, buf_diff,
- width_a, height_a, stride_a);
+ pixels_changed = buffer_diff (buf_a + (ay * stride_a) + ax * 4,
+ b_flat,
+ buf_diff,
+ width_a, height_a,
+ stride_a, stride_a, stride_a);
if (pixels_changed) {
FILE *png_file = fopen (filename_diff, "wb");
diff --git a/test/buffer-diff.h b/test/buffer-diff.h
index b9c48ed3b..fd9662eac 100644
--- a/test/buffer-diff.h
+++ b/test/buffer-diff.h
@@ -36,7 +36,9 @@ buffer_diff (unsigned char *buf_a,
unsigned char *buf_diff,
int width,
int height,
- int stride);
+ int stride_a,
+ int stride_b,
+ int stride_diff);
/* Returns number of pixels changed ignoring the alpha channel.
* Also fills in a "diff" buffer intended to visually show where the
@@ -48,7 +50,10 @@ buffer_diff_noalpha (unsigned char *buf_a,
unsigned char *buf_diff,
int width,
int height,
- int stride);
+ int stride_a,
+ int stride_b,
+ int stride_diff);
+
/* Returns number of pixels changed, (or -1 on error).
* Also saves a "diff" image intended to visually show where the
@@ -57,13 +62,21 @@ buffer_diff_noalpha (unsigned char *buf_a,
int
image_diff (const char *filename_a,
const char *filename_b,
- const char *filename_diff);
+ const char *filename_diff,
+ int ax,
+ int ay,
+ int bx,
+ int by);
/* Like image_diff, but blending the contents of b over white first. */
int
image_diff_flattened (const char *filename_a,
const char *filename_b,
- const char *filename_diff);
+ const char *filename_diff,
+ int ax,
+ int ay,
+ int bx,
+ int by);
#endif
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 6615b87e3..6a3d52a5a 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -78,6 +78,8 @@ static const char *fail_face = "", *normal_face = "";
#define CAIRO_TEST_REF_SUFFIX "-ref.png"
#define CAIRO_TEST_DIFF_SUFFIX "-diff.png"
+#define NUM_DEVICE_OFFSETS 2
+
/* A fake format we use for the flattened ARGB output of the PS and
* PDF surfaces. */
#define CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED -1
@@ -1403,12 +1405,13 @@ cleanup_svg (void *closure)
static cairo_test_status_t
cairo_test_for_target (cairo_test_t *test,
cairo_test_draw_function_t draw,
- cairo_test_target_t *target)
+ cairo_test_target_t *target,
+ int dev_offset)
{
cairo_test_status_t status;
cairo_surface_t *surface;
cairo_t *cr;
- char *png_name, *ref_name, *diff_name;
+ char *png_name, *ref_name, *diff_name, *offset_str;
char *srcdir;
char *format;
cairo_test_status_t ret;
@@ -1418,10 +1421,16 @@ cairo_test_for_target (cairo_test_t *test,
if (!srcdir)
srcdir = ".";
format = _cairo_test_content_name (target->content);
+
+ if (dev_offset)
+ xasprintf (&offset_str, "-%d", dev_offset);
+ else
+ offset_str = strdup("");
+ xasprintf (&png_name, "%s-%s-%s%s%s", test->name,
+ target->name, format, offset_str, CAIRO_TEST_PNG_SUFFIX);
+
/* First look for a target/format-specific reference image. */
- xasprintf (&png_name, "%s-%s-%s%s", test->name,
- target->name, format, CAIRO_TEST_PNG_SUFFIX);
xasprintf (&ref_name, "%s/%s-%s-%s%s", srcdir, test->name,
target->name, format, CAIRO_TEST_REF_SUFFIX);
if (access (ref_name, F_OK) != 0) {
@@ -1439,11 +1448,22 @@ cairo_test_for_target (cairo_test_t *test,
CAIRO_TEST_REF_SUFFIX);
}
}
- xasprintf (&diff_name, "%s-%s-%s%s", test->name,
- target->name, format, CAIRO_TEST_DIFF_SUFFIX);
+ xasprintf (&diff_name, "%s-%s-%s%s%s", test->name,
+ target->name, 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;
+ }
+
surface = (target->create_target_surface) (test, target->content, &target->closure);
+
+ if (test->width && test->height) {
+ test->width -= dev_offset;
+ test->height -= dev_offset;;
+ }
+
if (surface == NULL) {
cairo_test_log ("Error: Failed to set %s target\n", target->name);
ret = CAIRO_TEST_UNTESTED;
@@ -1457,6 +1477,8 @@ cairo_test_for_target (cairo_test_t *test,
goto UNWIND_SURFACE;
}
+ cairo_surface_set_device_offset (surface, dev_offset, dev_offset);
+
cr = cairo_create (surface);
/* Clear to transparent (or black) depending on whether the target
@@ -1490,9 +1512,9 @@ cairo_test_for_target (cairo_test_t *test,
xunlink (png_name);
(target->write_to_png) (surface, png_name);
if (target->content == CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED)
- pixels_changed = image_diff_flattened (png_name, ref_name, diff_name);
+ pixels_changed = image_diff_flattened (png_name, ref_name, diff_name, dev_offset, dev_offset, 0, 0);
else
- pixels_changed = image_diff (png_name, ref_name, diff_name);
+ pixels_changed = image_diff (png_name, ref_name, diff_name, dev_offset, dev_offset, 0, 0);
if (pixels_changed) {
if (pixels_changed > 0)
cairo_test_log ("Error: %d pixels differ from reference image %s\n",
@@ -1518,6 +1540,7 @@ UNWIND_STRINGS:
free (png_name);
free (ref_name);
free (diff_name);
+ free (offset_str);
return ret;
}
@@ -1526,7 +1549,7 @@ static cairo_test_status_t
cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw,
cairo_test_status_t expectation)
{
- int i, num_targets;
+ int i, j, num_targets;
const char *tname;
cairo_test_status_t status, ret;
cairo_test_target_t **targets_to_test;
@@ -1698,39 +1721,45 @@ cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw,
*/
ret = CAIRO_TEST_UNTESTED;
for (i = 0; i < num_targets; i++) {
- cairo_test_target_t *target = targets_to_test[i];
- cairo_test_log ("Testing %s with %s target\n", test->name, target->name);
- printf ("%s-%s-%s:\t", test->name, target->name,
- _cairo_test_content_name (target->content));
-
- status = cairo_test_for_target (test, draw, target);
-
- cairo_test_log ("TEST: %s TARGET: %s FORMAT: %s RESULT: ",
- test->name, target->name,
- _cairo_test_content_name (target->content));
-
- switch (status) {
- case CAIRO_TEST_SUCCESS:
- printf ("PASS\n");
- cairo_test_log ("PASS\n");
- if (ret == CAIRO_TEST_UNTESTED)
- ret = CAIRO_TEST_SUCCESS;
- break;
- case CAIRO_TEST_UNTESTED:
- printf ("UNTESTED\n");
- cairo_test_log ("UNTESTED\n");
- break;
- default:
- case CAIRO_TEST_FAILURE:
- if (expectation == CAIRO_TEST_FAILURE) {
- printf ("XFAIL\n");
- cairo_test_log ("XFAIL\n");
- } else {
- printf ("%sFAIL%s\n", fail_face, normal_face);
- cairo_test_log ("FAIL\n");
+ for (j = 0; j < NUM_DEVICE_OFFSETS; j++) {
+ cairo_test_target_t *target = targets_to_test[i];
+ int dev_offset = j * 25;
+
+ cairo_test_log ("Testing %s with %s target (dev offset %d)\n", test->name, target->name, dev_offset);
+ printf ("%s-%s-%s [%d]:\t", test->name, target->name,
+ _cairo_test_content_name (target->content),
+ dev_offset);
+
+ status = cairo_test_for_target (test, draw, target, dev_offset);
+
+ cairo_test_log ("TEST: %s TARGET: %s FORMAT: %s OFFSET: %d RESULT: ",
+ test->name, target->name,
+ _cairo_test_content_name (target->content),
+ dev_offset);
+
+ switch (status) {
+ case CAIRO_TEST_SUCCESS:
+ printf ("PASS\n");
+ cairo_test_log ("PASS\n");
+ if (ret == CAIRO_TEST_UNTESTED)
+ ret = CAIRO_TEST_SUCCESS;
+ break;
+ case CAIRO_TEST_UNTESTED:
+ printf ("UNTESTED\n");
+ cairo_test_log ("UNTESTED\n");
+ break;
+ default:
+ case CAIRO_TEST_FAILURE:
+ if (expectation == CAIRO_TEST_FAILURE) {
+ printf ("XFAIL\n");
+ cairo_test_log ("XFAIL\n");
+ } else {
+ printf ("%sFAIL%s\n", fail_face, normal_face);
+ cairo_test_log ("FAIL\n");
+ }
+ ret = status;
+ break;
}
- ret = status;
- break;
}
}
if (ret == CAIRO_TEST_UNTESTED)
diff --git a/test/imagediff.c b/test/imagediff.c
index de66b68d2..41d065cce 100644
--- a/test/imagediff.c
+++ b/test/imagediff.c
@@ -34,54 +34,31 @@
int
main (int argc, char *argv[])
{
- read_png_status_t status;
- unsigned char *buffer_a;
- unsigned int width_a, height_a, stride_a;
- unsigned char *buffer_b;
- unsigned int width_b, height_b, stride_b;
+ int total_pixels_changed;
- unsigned char *buffer;
- unsigned int width, height, stride;
- int buffer_size, total_pixels_changed;
+ unsigned int ax, ay, bx, by;
- if (argc < 2) {
- fprintf (stderr, "Usage: %s image1.png image2.png\n", argv[0]);
+ if (argc != 3 && argc != 7) {
+ fprintf (stderr, "Usage: %s image1.png image2.png [ax ay bx by]\n", argv[0]);
fprintf (stderr, "Computes an output image designed to present a \"visual diff\" such that even\n");
fprintf (stderr, "small errors in single pixels are readily apparent in the output.\n");
fprintf (stderr, "The output image is written on stdout.\n");
exit (1);
}
- status = read_png_argb32 (argv[1], &buffer_a, &width_a, &height_a, &stride_a);
- if (status)
- return 1;
-
- status = read_png_argb32 (argv[2], &buffer_b, &width_b, &height_b, &stride_b);
- if (status)
- return 1;
-
- if ((width_a == width_b) && (height_a == height_b) && (stride_a == stride_b))
- {
- width = width_a;
- height = height_a;
- stride = stride_a;
+ if (argc == 7) {
+ ax = strtoul (argv[3], NULL, 0);
+ ay = strtoul (argv[4], NULL, 0);
+ bx = strtoul (argv[5], NULL, 0);
+ by = strtoul (argv[6], NULL, 0);
} else {
- fprintf (stderr, "Error. Both images must be the same size\n");
- return 1;
+ ax = ay = bx = by = 0;
}
- buffer_size = stride * height;
- buffer = xmalloc (buffer_size);
-
- total_pixels_changed = buffer_diff (buffer_a, buffer_b, buffer,
- width_a, height_a, stride_a);
-
+ total_pixels_changed = image_diff (argv[1], argv[2], NULL, ax, ay, bx, by);
if (total_pixels_changed)
fprintf (stderr, "Total pixels changed: %d\n", total_pixels_changed);
- write_png_argb32 (buffer, stdout, width, height, stride);
-
- free (buffer);
return (total_pixels_changed != 0);
}
diff --git a/test/make-html.pl b/test/make-html.pl
index f4bbb8c88..8b34e1254 100755
--- a/test/make-html.pl
+++ b/test/make-html.pl
@@ -29,8 +29,6 @@
## html to stdout that can be used to view all the test results at once.
##
-# some config options:
-
# show reference images
my $config_show_ref = 0;
@@ -49,20 +47,22 @@ my $teststats = {};
foreach (<*.log>) {
(open LOG, "$_") || next;
while (<LOG>) {
- next unless /^TEST: (.*) TARGET: (.*) FORMAT: (.*) RESULT: (.*)$/;
+ next unless /^TEST: (.*) TARGET: (.*) FORMAT: (.*) OFFSET: (.*) RESULT: (.*)$/;
$tests->{$1} = {} unless $tests->{$1};
$tests->{$1}->{$2} = {} unless $tests->{$1}->{$2};
- $tests->{$1}->{$2}->{$3} = $4;
+ $tests->{$1}->{$2}->{$3} = {} unless $tests->{$1}->{$2}->{$3};
+ $tests->{$1}->{$2}->{$3}->{$4} = $5;
$teststats->{$2} = {"PASS" => 0, "FAIL" => 0, "XFAIL" => 0, "UNTESTED" => 0}
unless $teststats->{$2};
- ($teststats->{$2}->{$4})++;
+ ($teststats->{$2}->{$5})++;
}
close LOG;
}
my $targeth = {};
my $formath = {};
+my $offseth = {};
foreach my $testname (sort(keys %$tests)) {
my $v0 = $tests->{$testname};
@@ -71,13 +71,19 @@ foreach my $testname (sort(keys %$tests)) {
$targeth->{$targetname} = 1;
foreach my $formatname (sort(keys %$v1)) {
+ my $v2 = $v1->{$formatname};
+
$formath->{$formatname} = 1;
+ foreach my $offsetval (sort(keys %$v2)) {
+ $offseth->{$offsetval} = 1;
+ }
}
}
}
my @targets = sort(keys %$targeth);
my @formats = sort(keys %$formath);
+my @offsets = sort(keys %$offseth);
sub printl {
print @_, "\n";
@@ -133,72 +139,78 @@ sub testref {
}
sub testfiles {
- my ($test, $target, $format, $rest) = @_;
+ my ($test, $target, $format, $offset, $rest) = @_;
my $fmtstr = "";
+ my $offstr = "";
if ($format eq "rgb24") {
$fmtstr = "-rgb24";
} elsif ($format eq "argb32") {
$fmtstr = "-argb32";
}
+ if ($offset ne "0") {
+ $offstr = "-" . $offset;
+ }
- return ("out" => "$test-$target$fmtstr-out.png",
- "diff" => "$test-$target$fmtstr-diff.png");
+ return ("out" => "$test-$target$fmtstr$offstr-out.png",
+ "diff" => "$test-$target$fmtstr$offstr-diff.png");
}
foreach my $test (sort(keys %$tests)) {
- foreach my $format (@formats) {
- my $testline = "";
-
- my $num_failed = 0;
-
- foreach my $target (@targets) {
- my $tgtdata = $tests->{$test}->{$target};
- if ($tgtdata) {
- my $testres = $tgtdata->{$format};
- if ($testres) {
- my %testfiles = testfiles($test, $target, $format);
- $testline .= "<td class=\"$testres\">";
- $stats{$target}{$testres}++;
- if ($testres eq "PASS") {
- if ($config_show_all) {
- $testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
- }
- } elsif ($testres eq "FAIL") {
- $num_failed++;
-
- if ($config_show_fail || $config_show_all) {
- $testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
- $testline .= "<hr size=\"1\">";
- $testline .= "<a href=\"" . $testfiles{"diff"} . "\"><img src=\"" . $testfiles{"diff"} . "\"></a>";
- }
- } elsif ($testres eq "XFAIL") {
- #nothing
- if ($config_show_all) {
- $testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
- $testline .= "<hr size=\"1\">";
- $testline .= "<a href=\"" . $testfiles{"diff"} . "\"><img src=\"" . $testfiles{"diff"} . "\"></a>";
- }
- }
-
- $testline .= "</td>";
- } else {
- $testline .= '<td></td>';
- }
- } else {
- $testline .= '<td></td>';
+ foreach my $offset (@offsets) {
+ foreach my $format (@formats) {
+ my $testline = "";
+
+ my $num_failed = 0;
+
+ foreach my $target (@targets) {
+ my $tgtdata = $tests->{$test}->{$target};
+ if ($tgtdata) {
+ my $testres = $tgtdata->{$format}->{$offset};
+ if ($testres) {
+ my %testfiles = testfiles($test, $target, $format, $offset);
+ $testline .= "<td class=\"$testres\">";
+ $stats{$target}{$testres}++;
+ if ($testres eq "PASS") {
+ if ($config_show_all) {
+ $testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
+ }
+ } elsif ($testres eq "FAIL") {
+ $num_failed++;
+
+ if ($config_show_fail || $config_show_all) {
+ $testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
+ $testline .= "<hr size=\"1\">";
+ $testline .= "<a href=\"" . $testfiles{"diff"} . "\"><img src=\"" . $testfiles{"diff"} . "\"></a>";
+ }
+ } elsif ($testres eq "XFAIL") {
+ #nothing
+ if ($config_show_all) {
+ $testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
+ $testline .= "<hr size=\"1\">";
+ $testline .= "<a href=\"" . $testfiles{"diff"} . "\"><img src=\"" . $testfiles{"diff"} . "\"></a>";
+ }
+ }
+
+ $testline .= "</td>";
+ } else {
+ $testline .= '<td></td>';
+ }
+ } else {
+ $testline .= '<td></td>';
+ }
}
- }
- my $testref = testref($test, $format);
- print '<tr><td>', "<a href=\"$testref\">", $test, ' (', $format, ')</a></td>';
+ my $testref = testref($test, $format);
+ print '<tr><td>', "<a href=\"$testref\">", $test, ' (', $format, '/', $offset, ')</a></td>';
- if ($config_show_ref) {
- print "<td><a href=\"$testref\"><img src=\"$testref\"></img></a></td>";
- }
+ if ($config_show_ref) {
+ print "<td><a href=\"$testref\"><img src=\"$testref\"></img></a></td>";
+ }
- print $testline;
+ print $testline;
- print "</tr>\n";
+ print "</tr>\n";
+ }
}
}
diff --git a/test/xlib-surface.c b/test/xlib-surface.c
index 0df5514fa..1aea8734d 100644
--- a/test/xlib-surface.c
+++ b/test/xlib-surface.c
@@ -160,6 +160,8 @@ do_test (Display *dpy,
diff_data + offset,
SIZE - OFFSCREEN_OFFSET,
SIZE - OFFSCREEN_OFFSET,
+ 4 * SIZE,
+ 4 * SIZE,
4 * SIZE);
} else {
result = !buffer_diff_noalpha (reference_data,
@@ -167,6 +169,8 @@ do_test (Display *dpy,
diff_data,
SIZE,
SIZE,
+ 4 * SIZE,
+ 4 * SIZE,
4 * SIZE);
}