From 9b7084cfcaccf5c731cad23cf1239a16a1bbe308 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 10 Oct 2022 15:09:43 +0300 Subject: [PATCH] tests: change shot argument type in verify_image() Only the 'image' field of struct buffer is ever used here, so just pass pixman_image_t instead of struct buffer. This allows a future test to mangle a screenshot (e.g. convert pixel format) before feeding it in. Signed-off-by: Pekka Paalanen --- tests/alpha-blending-test.c | 2 +- tests/color-icc-output-test.c | 4 ++-- tests/weston-test-client-helper.c | 12 ++++++------ tests/weston-test-client-helper.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/alpha-blending-test.c b/tests/alpha-blending-test.c index 8ea9de36c..9515a7008 100644 --- a/tests/alpha-blending-test.c +++ b/tests/alpha-blending-test.c @@ -348,7 +348,7 @@ TEST(alpha_blend) shot = capture_screenshot_of_output(client); assert(shot); - match = verify_image(shot, "alpha_blend", seq_no, NULL, seq_no); + match = verify_image(shot->image, "alpha_blend", seq_no, NULL, seq_no); assert(check_blend_pattern(bg, fg, shot, space)); assert(match); diff --git a/tests/color-icc-output-test.c b/tests/color-icc-output-test.c index 55342440e..e6371363d 100644 --- a/tests/color-icc-output-test.c +++ b/tests/color-icc-output-test.c @@ -617,7 +617,7 @@ TEST(opaque_pixel_conversion) shot = capture_screenshot_of_output(client); assert(shot); - match = verify_image(shot, "shaper_matrix", arg->ref_image_index, + match = verify_image(shot->image, "shaper_matrix", arg->ref_image_index, NULL, seq_no); assert(process_pipeline_comparison(buf, shot, arg)); assert(match); @@ -832,7 +832,7 @@ TEST(output_icc_alpha_blend) shot = capture_screenshot_of_output(client); assert(shot); - match = verify_image(shot, "output_icc_alpha_blend", arg->ref_image_index, + match = verify_image(shot->image, "output_icc_alpha_blend", arg->ref_image_index, NULL, seq_no); assert(check_blend_pattern(bg, fg, shot, arg)); assert(match); diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c index f41ea5130..c4d24f8e0 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -1758,7 +1758,7 @@ capture_screenshot_of_output(struct client *client) static void write_visual_diff(pixman_image_t *ref_image, - struct buffer *shot, + pixman_image_t *shot, const struct rectangle *clip, const char *test_name, int seq_no, @@ -1773,7 +1773,7 @@ write_visual_diff(pixman_image_t *ref_image, assert(ret >= 0); fname = screenshot_output_filename(ext_test_name, seq_no); - diff = visualize_image_difference(ref_image, shot->image, clip, fuzz); + diff = visualize_image_difference(ref_image, shot, clip, fuzz); write_image_as_png(diff, fname); pixman_image_unref(diff); @@ -1812,7 +1812,7 @@ write_visual_diff(pixman_image_t *ref_image, * \sa verify_screen_content */ bool -verify_image(struct buffer *shot, +verify_image(pixman_image_t *shot, const char *ref_image, int ref_seq_no, const struct rectangle *clip, @@ -1833,7 +1833,7 @@ verify_image(struct buffer *shot, } if (ref) { - match = check_images_match(ref, shot->image, clip, &gl_fuzz); + match = check_images_match(ref, shot, clip, &gl_fuzz); testlog("Verify reference image %s vs. shot %s: %s\n", ref_fname, shot_fname, match ? "PASS" : "FAIL"); @@ -1848,7 +1848,7 @@ verify_image(struct buffer *shot, } if (!match) - write_image_as_png(shot->image, shot_fname); + write_image_as_png(shot, shot_fname); free(ref_fname); free(shot_fname); @@ -1881,7 +1881,7 @@ verify_screen_content(struct client *client, shot = capture_screenshot_of_output(client); assert(shot); - match = verify_image(shot, ref_image, ref_seq_no, clip, seq_no); + match = verify_image(shot->image, ref_image, ref_seq_no, clip, seq_no); buffer_destroy(shot); return match; diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h index 591acb11a..3d6ab28ee 100644 --- a/tests/weston-test-client-helper.h +++ b/tests/weston-test-client-helper.h @@ -276,7 +276,7 @@ struct buffer * capture_screenshot_of_output(struct client *client); bool -verify_image(struct buffer *shot, +verify_image(pixman_image_t *shot, const char *ref_image, int ref_seq_no, const struct rectangle *clip,