summaryrefslogtreecommitdiff
path: root/test/litest-int.h
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-03-31 10:00:16 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-04-08 15:07:02 +1000
commita242d689891b18abf29d8a6a83d10a7f3fe3d01b (patch)
treef85eb1d7383e7e64a2e7e9910aea7a9c23bb1ee1 /test/litest-int.h
parent258ba1c3752045548092f10e6e9f7a626e99134c (diff)
downloadlibinput-a242d689891b18abf29d8a6a83d10a7f3fe3d01b.tar.gz
test: allow for description-based test devices
Most of the test devices now are static descriptions anyway, make them fully static now, including for touch events. Switch the synaptics device now as example, the rest comes later for easier patch review. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'test/litest-int.h')
-rw-r--r--test/litest-int.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/test/litest-int.h b/test/litest-int.h
index b515b6c3..19e6e68d 100644
--- a/test/litest-int.h
+++ b/test/litest-int.h
@@ -23,19 +23,52 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#include <limits.h>
#ifndef LITEST_INT_H
#define LITEST_INT_H
#include "litest.h"
+/* Use as designater for litest to change the value */
+#define LITEST_AUTO_ASSIGN INT_MIN
+
struct litest_test_device {
enum litest_device_type type;
enum litest_device_feature features;
const char *shortname;
void (*setup)(void); /* test fixture, used by check */
void (*teardown)(void); /* test fixture, used by check */
-
+ /**
+ * If create is non-NULL it will be called to initialize the device.
+ * For such devices, no overrides are possible. If create is NULL,
+ * the information in name, id, events, absinfo is used to
+ * create the device instead.
+ */
void (*create)(struct litest_device *d);
+
+ /**
+ * The device name. Only used when create is NULL.
+ */
+ const char *name;
+ /**
+ * The device id. Only used when create is NULL.
+ */
+ const struct input_id *id;
+ /**
+ * List of event type/code tuples, terminated with -1, e.g.
+ * EV_REL, REL_X, EV_KEY, BTN_LEFT, -1
+ * Special tuple is INPUT_PROP_MAX, <actual property> to set.
+ *
+ * Any EV_ABS codes in this list will be initialized with a default
+ * axis range.
+ */
+ int *events;
+ /**
+ * List of abs codes to enable, with absinfo.value determining the
+ * code to set. List must be terminated with absinfo.value -1
+ */
+ struct input_absinfo *absinfo;
+ struct litest_device_interface *interface;
};
struct litest_device_interface {
@@ -43,6 +76,18 @@ struct litest_device_interface {
void (*touch_move)(struct litest_device *d, unsigned int slot, int x, int y);
void (*touch_up)(struct litest_device *d, unsigned int slot);
+ /**
+ * Set of of events to execute on touch down, terminated by a .type
+ * and .code value of -1. If the event value is LITEST_AUTO_ASSIGN,
+ * it will be automatically assigned by the framework (valid for x,
+ * y, tracking id and slot).
+ *
+ * These events are only used if touch_down is NULL.
+ */
+ struct input_event *touch_down_events;
+ struct input_event *touch_move_events;
+ struct input_event *touch_up_events;
+
int min[2];
int max[2];
};