[PATCH weston v1 17/17] tests: add interactive tests

Derek Foreman derekf at osg.samsung.com
Tue Dec 9 12:42:05 PST 2014


This new test fails for me:
"interactive.weston: tests/interactive-test.c:115:
focus_tests_one_client: Assertion `c1->input->keyboard->focus ==
c1->surface->wl_surface' failed.

On 05/12/14 07:36 AM, Marek Chalupa wrote:
> These tests are using pointer and keyboard simulated events
> to interact with client.
> 
> Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
> ---
>  Makefile.am              |   7 ++-
>  tests/interactive-test.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 141 insertions(+), 1 deletion(-)
>  create mode 100644 tests/interactive-test.c
> 
> diff --git a/Makefile.am b/Makefile.am
> index 57882cd..f59b52a 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -932,7 +932,8 @@ weston_tests =					\
>  	presentation.weston			\
>  	roles.weston				\
>  	subsurface.weston			\
> -	test-suite-tests.weston
> +	test-suite-tests.weston			\
> +	interactive.weston
>  
>  
>  AM_TESTS_ENVIRONMENT = \
> @@ -1053,6 +1054,10 @@ test_suite_tests_weston_SOURCES = tests/test-suite-test.c
>  test_suite_tests_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
>  test_suite_tests_weston_LDADD = libtest-client.la
>  
> +interactive_weston_SOURCES = tests/interactive-test.c
> +interactive_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
> +interactive_weston_LDADD = libtest-client.la
> +
>  if ENABLE_EGL
>  weston_tests += buffer-count.weston
>  buffer_count_weston_SOURCES = tests/buffer-count-test.c
> diff --git a/tests/interactive-test.c b/tests/interactive-test.c
> new file mode 100644
> index 0000000..07b3686
> --- /dev/null
> +++ b/tests/interactive-test.c
> @@ -0,0 +1,135 @@
> +/*
> + * Copyright © 2014 Red Hat, Inc.
> + *
> + * Permission to use, copy, modify, distribute, and sell this software and
> + * its documentation for any purpose is hereby granted without fee, provided
> + * that the above copyright notice appear in all copies and that both that
> + * copyright notice and this permission notice appear in supporting
> + * documentation, and that the name of the copyright holders not be used in
> + * advertising or publicity pertaining to distribution of the software
> + * without specific, written prior permission.  The copyright holders make
> + * no representations about the suitability of this software for any
> + * purpose.  It is provided "as is" without express or implied warranty.
> + *
> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
> + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
> + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
> + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
> + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
> + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include <unistd.h>
> +#include <time.h>
> +#include <linux/input.h>
> +
> +#include "weston-test-client-helper.h"
> +
> +/* relative position where to grab the client when dragging*/
> +#define GRAB_SHIFT_X 150
> +#define GRAB_SHIFT_Y 45
> +
> +static void
> +drag_and_check(struct client *client, int x, int y)
> +{
> +	wl_test_get_geometry(client->test->wl_test, client->surface->wl_surface);
> +	client_roundtrip(client);
> +
> +	fprintf(stderr, "dragging from %dx%d to %dx%d\n",
> +		client->test->geometry.x, client->test->geometry.y,
> +		x, y);
> +	fflush(stderr);
> +
> +	pointer_simulate_drag(client,
> +			      client->test->geometry.x + GRAB_SHIFT_X,
> +			      client->test->geometry.y + GRAB_SHIFT_Y,
> +			      x + GRAB_SHIFT_X, y + GRAB_SHIFT_Y);
> +	client_roundtrip(client);
> +
> +	wl_test_get_geometry(client->test->wl_test, client->surface->wl_surface);
> +	client_roundtrip(client);
> +
> +	assert(!window_is_maximized(client->toytoolkit->window));
> +	assert(!window_is_fullscreen(client->toytoolkit->window));
> +	assert(client->test->geometry.x == x);
> +	assert(client->test->geometry.y == y);
> +}
> +
> +#define MSEC_TO_USEC(n) ((n) * 1000)

There's that define again... maybe it should be in a header somewhere if
it's used in a few places?



More information about the wayland-devel mailing list