tests: introduce create_client()
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 26 Mar 2015 10:49:35 +0000 (12:49 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 2 Apr 2015 09:54:04 +0000 (12:54 +0300)
Introduce a new helper create_client(), which creates and initializes
the client struct, but does not create a wl_surface.

This will be useful for ivi-shell tests.

v2: Rebased, and restored the dependency to weston-test.so, since seat
handling requires it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
tests/weston-test-client-helper.c
tests/weston-test-client-helper.h

index 9a031e3ead0e0455da5f2a7b8488daa43c87bb66..84eae7e670fb9653543876eba280e8fc7e05280a 100644 (file)
@@ -736,10 +736,9 @@ client_set_input(struct client *cl)
 }
 
 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);
 
@@ -752,7 +751,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, &registry_listener, client);
+       wl_registry_add_listener(client->wl_registry, &registry_listener,
+                                client);
 
        /* this roundtrip makes sure we have all globals and we bound to them */
        client_roundtrip(client);
@@ -778,6 +778,17 @@ client_create(int x, int y, int width, int height)
        /* must have seat set */
        assert(client->input);
 
+       return client;
+}
+
+struct client *
+client_create(int x, int y, int width, int height)
+{
+       struct client *client;
+       struct surface *surface;
+
+       client = create_client();
+
        /* initialize the client surface */
        surface = xzalloc(sizeof *surface);
        surface->wl_surface =
index 63883fe51dae42d18526379f2c4e4896dc257461..61c0b4556538434f96b4f3d7b6c3207dd6de4724 100644 (file)
@@ -143,6 +143,9 @@ xzalloc(size_t size)
         return p;
 }
 
+struct client *
+create_client(void);
+
 struct client *
 client_create(int x, int y, int width, int height);