[PATCH weston 1/9] tests: introduce create_client()

Tanibata, Nobuhiko (ADITJ/SWG) ntanibata at jp.adit-jv.com
Wed Apr 1 17:42:27 PDT 2015



> -----Original Message-----
> From: wayland-devel
> [mailto:wayland-devel-bounces at lists.freedesktop.org] On Behalf Of Pekka
> Paalanen
> Sent: Monday, March 30, 2015 6:21 PM
> To: wayland-devel at lists.freedesktop.org
> Cc: Pekka Paalanen; Nobuhiko Tanibata
> Subject: [PATCH weston 1/9] tests: introduce create_client()
> 
> 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>
[ntanibata] 
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>

BR,
Nobuhiko Tanibata

> ---
>  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,
> &registry_listener, client);
> +	wl_registry_add_listener(client->wl_registry,
> &registry_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
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list