[PATCH weston 1/3] tests: add a create_test_surface function
Emilio Pozuelo Monfort
emilio.pozuelo at collabora.co.uk
Fri Feb 3 15:15:57 UTC 2017
BTW note this series depends on this other one:
https://patchwork.freedesktop.org/series/18695/
https://lists.freedesktop.org/archives/wayland-devel/2017-January/032890.html
Cheers,
Emilio
On 03/02/17 16:10, Emilio Pozuelo Monfort wrote:
> This doesn't attach a buffer to the surface. This is needed for the
> next commit, where we have a test case with a surface that doesn't
> have a buffer attached.
>
> Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo at collabora.co.uk>
> ---
> tests/weston-test-client-helper.c | 29 ++++++++++++++++++++---------
> tests/weston-test-client-helper.h | 3 +++
> 2 files changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
> index dd411925..4c27988d 100644
> --- a/tests/weston-test-client-helper.c
> +++ b/tests/weston-test-client-helper.c
> @@ -884,18 +884,13 @@ create_client(void)
> return client;
> }
>
> -struct client *
> -create_client_and_test_surface(int x, int y, int width, int height)
> +struct surface *
> +create_test_surface(struct client *client)
> {
> - struct client *client;
> struct surface *surface;
> - pixman_color_t color = { 16384, 16384, 16384, 16384 }; /* uint16_t */
> - pixman_image_t *solid;
> -
> - client = create_client();
>
> - /* initialize the client surface */
> surface = xzalloc(sizeof *surface);
> +
> surface->wl_surface =
> wl_compositor_create_surface(client->wl_compositor);
> assert(surface->wl_surface);
> @@ -903,9 +898,25 @@ create_client_and_test_surface(int x, int y, int width, int height)
> wl_surface_add_listener(surface->wl_surface, &surface_listener,
> surface);
>
> - client->surface = surface;
> wl_surface_set_user_data(surface->wl_surface, surface);
>
> + return surface;
> +}
> +
> +struct client *
> +create_client_and_test_surface(int x, int y, int width, int height)
> +{
> + struct client *client;
> + struct surface *surface;
> + pixman_color_t color = { 16384, 16384, 16384, 16384 }; /* uint16_t */
> + pixman_image_t *solid;
> +
> + client = create_client();
> +
> + /* initialize the client surface */
> + surface = create_test_surface(client);
> + client->surface = surface;
> +
> surface->width = width;
> surface->height = height;
> surface->buffer = create_shm_buffer_a8r8g8b8(client, width, height);
> diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h
> index 8908ae7e..8ab59c61 100644
> --- a/tests/weston-test-client-helper.h
> +++ b/tests/weston-test-client-helper.h
> @@ -155,6 +155,9 @@ struct rectangle {
> struct client *
> create_client(void);
>
> +struct surface *
> +create_test_surface(struct client *client);
> +
> struct client *
> create_client_and_test_surface(int x, int y, int width, int height);
>
>
More information about the wayland-devel
mailing list