[PATCH v2] event-test: more aggressive event testing

Pekka Paalanen ppaalanen at gmail.com
Thu Sep 27 23:31:29 PDT 2012


On Tue, 25 Sep 2012 14:13:45 -0700
"U. Artie Eoff" <ullysses.a.eoff at intel.com> wrote:

> From: "U. Artie Eoff" <ullysses.a.eoff at intel.com>
> 
> Test surface pointer enter/leave/motion and surface leave/enter
> events more aggressively.
> 
> Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>

Hi Artie,

since you asked...

> ---
>  tests/event-test.c  | 269 ++++++++++++++++++++++++++++++++++++++++++++++++----
>  tests/test-client.c |  60 ++++++++++--
>  tests/test-runner.c |   8 +-
>  3 files changed, 305 insertions(+), 32 deletions(-)
> 
> diff --git a/tests/event-test.c b/tests/event-test.c
> index 2cbfc2d..9572c91 100644
> --- a/tests/event-test.c
> +++ b/tests/event-test.c
> @@ -25,50 +25,280 @@
>  #include <sys/socket.h>
>  #include <assert.h>
>  #include <unistd.h>
> -
>  #include <string.h>
>  
>  #include "test-runner.h"
>  
> +struct state {
> +	int px; // pointer x
> +	int py; // pointer y
> +	int sx; // surface x
> +	int sy; // surface y
> +	int sw; // surface width
> +	int sh; // surface height
> +};
> +
> +static size_t state_size = sizeof(struct state);
> +
> +struct context {
> +	struct weston_layer *layer;
> +	struct weston_seat *seat;
> +	struct weston_surface *surface;
> +	int pointer_x; // server pointer x
> +	int pointer_y; // server pointer y
> +	size_t index;
> +	struct wl_array states;
> +};
> +
> +static void
> +resize(struct context *context, int w, int h)
> +{
> +	// resize the surface if the width or height is different
> +	if (context->surface->geometry.width != w ||
> +		context->surface->geometry.height != h) {

Continuation lines are usually aligned to the opening parenthesis, like
this:

	if (context->surface->geometry.width != w ||
	    context->surface->geometry.height != h) {

> +
> +		weston_surface_configure(context->surface,
> +			context->surface->geometry.x,
> +			context->surface->geometry.y,
> +			w, h);

except here it looks like the it would be a too long line, so I'd guess
this one is ok...

> +		weston_surface_update_transform(context->surface);
> +		weston_surface_damage(context->surface);
> +
> +		fprintf(stderr, "resize surface: %d %d\n",
> +			context->surface->geometry.width,
> +			context->surface->geometry.height);

This one is already good. ;-)

Other than that, comments, and some pretty long lines,
looks good to me. Some of the too long lines I would probably not
break, though. Max line length is 80 (I think? I try to keep under 78),
and tabs are 8-wide.


Thanks,
pq


More information about the wayland-devel mailing list