tests: rewrite check_surfaces_*() API
check_surfaces_geometry() is removed as it was not used by anything, and
unlikely would be.
check_surfaces_equal() is merged into check_surfaces_match_in_clip(),
passing a NULL clip means to compare whole images.
check_surfaces_match_in_clip() is converted to work on pixman_image_t
instead of struct surface. The function is only concerned about
comparing images in memory, and does not care about a wl_buffer or a
wl_surface.
The verbosity of image comparisons is greatly reduced. An image mismatch
no longer prints a flood of raw pixel values. This will be replaced
later with a function writing out an error image instead.
Degenerate comparisons are no longer accepted, be that clip outside
images or zero area. Those are an indication of a programmer error.
The pixel format assumptions are made more visible in the code.
A new internal helper image_check_get_roi() computes and verifies the
area to be compared. Image iterator helper makes it simpler to write
manual pixel-poking loops.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h
index 3e1cfcd..4910136 100644
--- a/tests/weston-test-client-helper.h
+++ b/tests/weston-test-client-helper.h
@@ -198,13 +198,8 @@
screenshot_reference_filename(const char *basename, uint32_t seq);
bool
-check_surfaces_geometry(const struct surface *a, const struct surface *b);
-
-bool
-check_surfaces_equal(const struct surface *a, const struct surface *b);
-
-bool
-check_surfaces_match_in_clip(const struct surface *a, const struct surface *b, const struct rectangle *clip);
+check_images_match(pixman_image_t *img_a, pixman_image_t *img_b,
+ const struct rectangle *clip);
bool
write_surface_as_png(const struct surface *weston_surface, const char *fname);