diff options
author | Emilio Pozuelo Monfort <pochu27@gmail.com> | 2017-02-03 16:10:37 +0100 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2017-12-04 21:58:00 +0000 |
commit | 5c3f3575d56702c71b44b612eb3a8cdf8f674f1a (patch) | |
tree | 9b3b04d43bf9090401ba7aa65db683bdf68e1f5d | |
parent | 85d55540cb64bf97a08b40f79dc66843f8295d3b (diff) |
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>
-rw-r--r-- | tests/weston-test-client-helper.c | 29 | ||||
-rw-r--r-- | 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 fd6d5c84..ee508452 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -864,18 +864,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); @@ -883,9 +878,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 a288af7e..880f47a6 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); |