[PATCH weston 1/9] tests: introduce create_client()
Pekka Paalanen
ppaalanen at gmail.com
Mon Mar 30 02:20:04 PDT 2015
From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
Introduce a new helper create_client(), which literally only creates the
client struct, and does not require the test extension to be present.
This will be useful for ivi-shell tests.
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
tests/weston-test-client-helper.c | 23 +++++++++++++++++------
tests/weston-test-client-helper.h | 3 +++
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
index cf9e742..58ed250 100644
--- a/tests/weston-test-client-helper.c
+++ b/tests/weston-test-client-helper.c
@@ -562,10 +562,9 @@ log_handler(const char *fmt, va_list args)
}
struct client *
-client_create(int x, int y, int width, int height)
+create_client(void)
{
struct client *client;
- struct surface *surface;
wl_log_set_handler_client(log_handler);
@@ -577,7 +576,8 @@ client_create(int x, int y, int width, int height)
/* setup registry so we can bind to interfaces */
client->wl_registry = wl_display_get_registry(client->wl_display);
- wl_registry_add_listener(client->wl_registry, ®istry_listener, client);
+ wl_registry_add_listener(client->wl_registry, ®istry_listener,
+ client);
/* trigger global listener. Need to dispatch two times, because wl_shm
* will emit new events after binding and we need them to arrive
@@ -588,12 +588,23 @@ client_create(int x, int y, int width, int height)
/* must have WL_SHM_FORMAT_ARGB32 */
assert(client->has_argb);
- /* must have weston_test interface */
- assert(client->test);
-
/* must have an output */
assert(client->output);
+ return client;
+}
+
+struct client *
+client_create(int x, int y, int width, int height)
+{
+ struct client *client;
+ struct surface *surface;
+
+ client = create_client();
+
+ /* must have weston_test interface */
+ assert(client->test);
+
/* initialize the client surface */
surface = xzalloc(sizeof *surface);
surface->wl_surface =
diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h
index 3208cc4..3ca8fd8 100644
--- a/tests/weston-test-client-helper.h
+++ b/tests/weston-test-client-helper.h
@@ -115,6 +115,9 @@ xzalloc(size_t size)
}
struct client *
+create_client(void);
+
+struct client *
client_create(int x, int y, int width, int height);
struct wl_buffer *
--
2.0.5
More information about the wayland-devel
mailing list