mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-04 22:13:13 +00:00
tests: add a create_test_surface function
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@collabora.co.uk> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
85d55540cb
commit
5c3f3575d5
|
@ -864,6 +864,25 @@ create_client(void)
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct surface *
|
||||||
|
create_test_surface(struct client *client)
|
||||||
|
{
|
||||||
|
struct surface *surface;
|
||||||
|
|
||||||
|
surface = xzalloc(sizeof *surface);
|
||||||
|
|
||||||
|
surface->wl_surface =
|
||||||
|
wl_compositor_create_surface(client->wl_compositor);
|
||||||
|
assert(surface->wl_surface);
|
||||||
|
|
||||||
|
wl_surface_add_listener(surface->wl_surface, &surface_listener,
|
||||||
|
surface);
|
||||||
|
|
||||||
|
wl_surface_set_user_data(surface->wl_surface, surface);
|
||||||
|
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
struct client *
|
struct client *
|
||||||
create_client_and_test_surface(int x, int y, int width, int height)
|
create_client_and_test_surface(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
@ -875,16 +894,8 @@ create_client_and_test_surface(int x, int y, int width, int height)
|
||||||
client = create_client();
|
client = create_client();
|
||||||
|
|
||||||
/* initialize the client surface */
|
/* initialize the client surface */
|
||||||
surface = xzalloc(sizeof *surface);
|
surface = create_test_surface(client);
|
||||||
surface->wl_surface =
|
|
||||||
wl_compositor_create_surface(client->wl_compositor);
|
|
||||||
assert(surface->wl_surface);
|
|
||||||
|
|
||||||
wl_surface_add_listener(surface->wl_surface, &surface_listener,
|
|
||||||
surface);
|
|
||||||
|
|
||||||
client->surface = surface;
|
client->surface = surface;
|
||||||
wl_surface_set_user_data(surface->wl_surface, surface);
|
|
||||||
|
|
||||||
surface->width = width;
|
surface->width = width;
|
||||||
surface->height = height;
|
surface->height = height;
|
||||||
|
|
|
@ -155,6 +155,9 @@ struct rectangle {
|
||||||
struct client *
|
struct client *
|
||||||
create_client(void);
|
create_client(void);
|
||||||
|
|
||||||
|
struct surface *
|
||||||
|
create_test_surface(struct client *client);
|
||||||
|
|
||||||
struct client *
|
struct client *
|
||||||
create_client_and_test_surface(int x, int y, int width, int height);
|
create_client_and_test_surface(int x, int y, int width, int height);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue