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 <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2022-10-10 15:09:43 +03:00 committed by Pekka Paalanen
parent e11a51709d
commit 9b7084cfca
4 changed files with 10 additions and 10 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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,