summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2022-11-30 17:54:16 +0200
committerDaniel Stone <daniels@collabora.com>2023-01-25 17:55:39 +0000
commit1e16a5eb2dc123886cda6cac8b0380008b449ce5 (patch)
tree03d4e55d14db57d92d5f3ed2d918ba063c89af1f /tests
parent59ac0a38da2c1f1c40bbbbd4e59735b1fa2e9e25 (diff)
downloadweston-1e16a5eb2dc123886cda6cac8b0380008b449ce5.tar.gz
tests: Add the ability the specify the output name
In preparation of having multiple outputs available we should be able to specify by its name. We just use the default one if none was set-up at all. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/alpha-blending-test.c2
-rw-r--r--tests/buffer-transforms-test.c2
-rw-r--r--tests/color-icc-output-test.c4
-rw-r--r--tests/drm-smoke-test.c2
-rw-r--r--tests/internal-screenshot-test.c2
-rw-r--r--tests/output-damage-test.c2
-rw-r--r--tests/output-transforms-test.c2
-rw-r--r--tests/pointer-shot-test.c6
-rw-r--r--tests/single-pixel-buffer-test.c2
-rw-r--r--tests/subsurface-shot-test.c2
-rw-r--r--tests/viewporter-shot-test.c2
-rw-r--r--tests/weston-test-client-helper.c32
-rw-r--r--tests/weston-test-client-helper.h4
-rw-r--r--tests/yuv-buffer-test.c2
14 files changed, 43 insertions, 23 deletions
diff --git a/tests/alpha-blending-test.c b/tests/alpha-blending-test.c
index 1c033e29..99ea8e57 100644
--- a/tests/alpha-blending-test.c
+++ b/tests/alpha-blending-test.c
@@ -346,7 +346,7 @@ TEST(alpha_blend)
/* attach, damage, commit background window */
move_client(client, 0, 0);
- shot = capture_screenshot_of_output(client);
+ shot = capture_screenshot_of_output(client, NULL);
assert(shot);
match = verify_image(shot->image, "alpha_blend", seq_no, NULL, seq_no);
assert(check_blend_pattern(bg, fg, shot, space));
diff --git a/tests/buffer-transforms-test.c b/tests/buffer-transforms-test.c
index ed8b1cb5..f7ec51e1 100644
--- a/tests/buffer-transforms-test.c
+++ b/tests/buffer-transforms-test.c
@@ -143,7 +143,7 @@ TEST_P(buffer_transform, my_buffer_args)
bargs->transform);
move_client(client, 19, 19);
- match = verify_screen_content(client, refname, 0, NULL, 0);
+ match = verify_screen_content(client, refname, 0, NULL, 0, NULL);
assert(match);
client_destroy(client);
diff --git a/tests/color-icc-output-test.c b/tests/color-icc-output-test.c
index 51f5c249..ea12b4eb 100644
--- a/tests/color-icc-output-test.c
+++ b/tests/color-icc-output-test.c
@@ -618,7 +618,7 @@ TEST(opaque_pixel_conversion)
wl_surface_damage(surface, 0, 0, width, height);
wl_surface_commit(surface);
- shot = capture_screenshot_of_output(client);
+ shot = capture_screenshot_of_output(client, NULL);
assert(shot);
match = verify_image(shot->image, "shaper_matrix", arg->ref_image_index,
@@ -834,7 +834,7 @@ TEST(output_icc_alpha_blend)
/* attach, damage, commit background window */
move_client(client, 0, 0);
- shot = capture_screenshot_of_output(client);
+ shot = capture_screenshot_of_output(client, NULL);
assert(shot);
match = verify_image(shot->image, "output_icc_alpha_blend", arg->ref_image_index,
NULL, seq_no);
diff --git a/tests/drm-smoke-test.c b/tests/drm-smoke-test.c
index 04f3499c..3790f6d4 100644
--- a/tests/drm-smoke-test.c
+++ b/tests/drm-smoke-test.c
@@ -90,7 +90,7 @@ TEST(drm_screenshot_no_damage) {
*/
for (i = 0; i < 5; i++) {
ret = verify_screen_content(client, "drm_screenshot_no_damage",
- 0, NULL, i);
+ 0, NULL, i, NULL);
assert(ret);
}
diff --git a/tests/internal-screenshot-test.c b/tests/internal-screenshot-test.c
index ef8d2170..e3b6a54b 100644
--- a/tests/internal-screenshot-test.c
+++ b/tests/internal-screenshot-test.c
@@ -118,7 +118,7 @@ TEST(internal_screenshot)
/* Take a snapshot. Result will be in screenshot->wl_buffer. */
testlog("Taking a screenshot\n");
- screenshot = capture_screenshot_of_output(client);
+ screenshot = capture_screenshot_of_output(client, NULL);
assert(screenshot);
/* Load good reference image */
diff --git a/tests/output-damage-test.c b/tests/output-damage-test.c
index 1114a670..b021ea51 100644
--- a/tests/output-damage-test.c
+++ b/tests/output-damage-test.c
@@ -221,7 +221,7 @@ TEST(output_damage)
*/
for (i = 1; i < COUNT_BUFS; i++) {
commit_buffer_with_damage(client->surface, buf[i], damages[i]);
- if (!verify_screen_content(client, refname, i, NULL, i))
+ if (!verify_screen_content(client, refname, i, NULL, i, NULL))
match = false;
}
diff --git a/tests/output-transforms-test.c b/tests/output-transforms-test.c
index 54769679..006ab35a 100644
--- a/tests/output-transforms-test.c
+++ b/tests/output-transforms-test.c
@@ -143,7 +143,7 @@ TEST_P(output_transform, my_buffer_args)
bargs->transform);
move_client(client, 19, 19);
- match = verify_screen_content(client, refname, 0, NULL, 0);
+ match = verify_screen_content(client, refname, 0, NULL, 0, NULL);
assert(match);
client_destroy(client);
diff --git a/tests/pointer-shot-test.c b/tests/pointer-shot-test.c
index 7bfd777e..a78d7ed9 100644
--- a/tests/pointer-shot-test.c
+++ b/tests/pointer-shot-test.c
@@ -149,7 +149,7 @@ TEST(pointer_cursor_retains_committed_buffer_after_reenter)
client->input->pointer->serial,
main_cursor_surface->wl_surface, 0, 0);
match = verify_screen_content(client, "pointer_cursor_reenter", 0,
- NULL, 0);
+ NULL, 0, NULL);
assert(match);
/* Move the cursor just outside the main surface. */
@@ -158,7 +158,7 @@ TEST(pointer_cursor_retains_committed_buffer_after_reenter)
client->input->pointer->serial,
back_cursor_surface->wl_surface, 0, 0);
match = verify_screen_content(client, "pointer_cursor_reenter", 1,
- NULL, 1);
+ NULL, 1, NULL);
assert(match);
/* And back in the main surface again. */
@@ -167,7 +167,7 @@ TEST(pointer_cursor_retains_committed_buffer_after_reenter)
client->input->pointer->serial,
main_cursor_surface->wl_surface, 0, 0);
match = verify_screen_content(client, "pointer_cursor_reenter", 2,
- NULL, 2);
+ NULL, 2, NULL);
assert(match);
surface_destroy(back_cursor_surface);
diff --git a/tests/single-pixel-buffer-test.c b/tests/single-pixel-buffer-test.c
index 6c041a1d..e7cf1331 100644
--- a/tests/single-pixel-buffer-test.c
+++ b/tests/single-pixel-buffer-test.c
@@ -102,7 +102,7 @@ TEST(solid_buffer_argb_u32)
wl_surface_commit(client->surface->wl_surface);
frame_callback_wait(client, &done);
- match = verify_screen_content(client, "single-pixel-buffer", 0, NULL, 0);
+ match = verify_screen_content(client, "single-pixel-buffer", 0, NULL, 0, NULL);
assert(match);
wl_buffer_destroy(buffer);
diff --git a/tests/subsurface-shot-test.c b/tests/subsurface-shot-test.c
index bd25dceb..4bbc1af6 100644
--- a/tests/subsurface-shot-test.c
+++ b/tests/subsurface-shot-test.c
@@ -103,7 +103,7 @@ check_screen(struct client *client,
bool match;
match = verify_screen_content(client, ref_image, ref_seq_no, clip,
- seq_no);
+ seq_no, NULL);
return match ? 0 : -1;
}
diff --git a/tests/viewporter-shot-test.c b/tests/viewporter-shot-test.c
index 3d57bd8c..1f9bca85 100644
--- a/tests/viewporter-shot-test.c
+++ b/tests/viewporter-shot-test.c
@@ -92,7 +92,7 @@ TEST(viewport_upscale_solid)
move_client(client, 19, 19);
match = verify_screen_content(client, "viewport_upscale_solid", 0,
- NULL, 0);
+ NULL, 0, NULL);
assert(match);
wp_viewport_destroy(viewport);
diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
index 31d8ea7c..3e24a031 100644
--- a/tests/weston-test-client-helper.c
+++ b/tests/weston-test-client-helper.c
@@ -1721,8 +1721,8 @@ client_capture_output(struct client *client,
/**
* Take screenshot of a single output
*
- * Requests a screenshot from the server of the output that the
- * client appears on. This implies that the compositor goes through an output
+ * Requests a screenshot from the server of the output specified
+ * in output_name. This implies that the compositor goes through an output
* repaint to provide the screenshot before this function returns. This
* function is therefore both a server roundtrip and a wait for a repaint.
*
@@ -1732,16 +1732,34 @@ client_capture_output(struct client *client,
* orientation rather than scale=1 or orientation=normal. The pixel format
* is ensured to be PIXMAN_a8r8g8b8.
*
+ * @param client a client instance, as created by create_client()
+ * @param output_name the name of the output, as specified by wl_output.name
* @returns A new buffer object, that should be freed with buffer_destroy().
*/
struct buffer *
-capture_screenshot_of_output(struct client *client)
+capture_screenshot_of_output(struct client *client, const char *output_name)
{
struct image_header ih;
struct buffer *shm;
struct buffer *buf;
+ struct output *output = NULL;
- shm = client_capture_output(client, client->output,
+ if (output_name) {
+ struct output *output_iter;
+
+ wl_list_for_each(output_iter, &client->output_list, link) {
+ if (!strcmp(output_name, output_iter->name)) {
+ output = output_iter;
+ break;
+ }
+ }
+
+ assert(output);
+ } else {
+ output = client->output;
+ }
+
+ shm = client_capture_output(client, output,
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER);
ih = image_header_from(shm->image);
@@ -1866,6 +1884,8 @@ verify_image(pixman_image_t *shot,
* \param ref_seq_no See verify_image().
* \param clip See verify_image().
* \param seq_no See verify_image().
+ * \param output_name the output name as specified by wl_output.name. If NULL,
+ * this is the last wl_output advertised by wl_registry.
* \return True if the screen contents matches the reference image,
* false otherwise.
*/
@@ -1874,12 +1894,12 @@ verify_screen_content(struct client *client,
const char *ref_image,
int ref_seq_no,
const struct rectangle *clip,
- int seq_no)
+ int seq_no, const char *output_name)
{
struct buffer *shot;
bool match;
- shot = capture_screenshot_of_output(client);
+ shot = capture_screenshot_of_output(client, output_name);
assert(shot);
match = verify_image(shot->image, ref_image, ref_seq_no, clip, seq_no);
buffer_destroy(shot);
diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h
index efee44a9..5d0c5363 100644
--- a/tests/weston-test-client-helper.h
+++ b/tests/weston-test-client-helper.h
@@ -274,7 +274,7 @@ pixman_image_t *
load_image_from_png(const char *fname);
struct buffer *
-capture_screenshot_of_output(struct client *client);
+capture_screenshot_of_output(struct client *client, const char *output_name);
struct buffer *
client_capture_output(struct client *client,
@@ -296,7 +296,7 @@ verify_screen_content(struct client *client,
const char *ref_image,
int ref_seq_no,
const struct rectangle *clip,
- int seq_no);
+ int seq_no, const char *output_name);
struct buffer *
client_buffer_from_image_file(struct client *client,
diff --git a/tests/yuv-buffer-test.c b/tests/yuv-buffer-test.c
index f672afcb..2a3c679c 100644
--- a/tests/yuv-buffer-test.c
+++ b/tests/yuv-buffer-test.c
@@ -464,7 +464,7 @@ TEST_P(yuv_buffer_shm, yuv_cases)
buf = my_case->create_buffer(client, my_case->drm_format, img);
show_window_with_yuv(client, buf);
- match = verify_screen_content(client, "yuv-buffer", 0, NULL, 0);
+ match = verify_screen_content(client, "yuv-buffer", 0, NULL, 0, NULL);
assert(match);
yuv_buffer_destroy(buf);