2 * Copyright © 2013 Red Hat, Inc.
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32 #include <libevdev/libevdev.h>
33 #include <libevdev/libevdev-uinput.h>
36 enum litest_device_type {
37 LITEST_NO_DEVICE = -1,
38 LITEST_SYNAPTICS_CLICKPAD,
39 LITEST_SYNAPTICS_TOUCHPAD,
40 LITEST_SYNAPTICS_TOPBUTTONPAD,
48 enum litest_device_feature {
49 LITEST_DISABLE_DEVICE = -1,
51 LITEST_TOUCHPAD = 1 << 0,
52 LITEST_CLICKPAD = 1 << 1,
53 LITEST_BUTTON = 1 << 2,
55 LITEST_POINTER = 1 << 4,
56 LITEST_WHEEL = 1 << 5,
57 LITEST_TOUCH = 1 << 6,
58 LITEST_SINGLE_TOUCH = 1 << 7,
59 LITEST_APPLE_CLICKPAD = 1 << 8,
60 LITEST_TOPBUTTONPAD = 1 << 9,
63 struct litest_device {
64 struct libevdev *evdev;
65 struct libevdev_uinput *uinput;
66 struct libinput *libinput;
68 struct libinput_device *libinput_device;
69 struct litest_device_interface *interface;
72 struct libinput *litest_create_context(void);
74 void litest_add(const char *name, void *func,
75 enum litest_device_feature required_feature,
76 enum litest_device_feature excluded_feature);
77 void litest_add_no_device(const char *name, void *func);
79 int litest_run(int argc, char **argv);
80 struct litest_device * litest_create_device(enum litest_device_type which);
81 struct libevdev_uinput *
82 litest_create_uinput_device_from_description(const char *name,
83 const struct input_id *id,
84 const struct input_absinfo *abs,
86 struct litest_device *
87 litest_create_device_with_overrides(enum litest_device_type which,
88 const char *name_override,
89 struct input_id *id_override,
90 const struct input_absinfo *abs_override,
91 const int *events_override);
92 struct litest_device *
93 litest_add_device_with_overrides(struct libinput *libinput,
94 enum litest_device_type which,
95 const char *name_override,
96 struct input_id *id_override,
97 const struct input_absinfo *abs_override,
98 const int *events_override);
100 struct litest_device *litest_current_device(void);
101 void litest_delete_device(struct litest_device *d);
102 int litest_handle_events(struct litest_device *d);
104 void litest_event(struct litest_device *t,
108 void litest_touch_up(struct litest_device *d, unsigned int slot);
109 void litest_touch_move(struct litest_device *d,
113 void litest_touch_down(struct litest_device *d,
117 void litest_touch_move_to(struct litest_device *d,
119 int x_from, int y_from,
122 void litest_button_click(struct litest_device *d,
125 void litest_keyboard_key(struct litest_device *d,
128 void litest_drain_events(struct libinput *li);
129 void litest_assert_empty_queue(struct libinput *li);
131 struct libevdev_uinput * litest_create_uinput_device(const char *name,
134 struct libevdev_uinput * litest_create_uinput_abs_device(const char *name,
136 const struct input_absinfo *abs,
139 #ifndef ck_assert_notnull
140 #define ck_assert_notnull(ptr) ck_assert_ptr_ne(ptr, NULL)
143 #endif /* LITEST_H */