path: add libinput_path_create_context instead of libinput_create_from_path
[platform/upstream/libinput.git] / test / litest.h
1 /*
2  * Copyright © 2013 Red Hat, Inc.
3  *
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.
13  *
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
20  * OF THIS SOFTWARE.
21  */
22
23 #if HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 #ifndef LITEST_H
28 #define LITEST_H
29
30 #include <stdbool.h>
31 #include <check.h>
32 #include <libevdev/libevdev.h>
33 #include <libevdev/libevdev-uinput.h>
34 #include <libinput.h>
35
36 enum litest_device_type {
37         LITEST_NO_DEVICE = -1,
38         LITEST_SYNAPTICS_CLICKPAD,
39         LITEST_BCM5974,
40         LITEST_KEYBOARD,
41         LITEST_TRACKPOINT,
42         LITEST_MOUSE,
43         LITEST_WACOM_TOUCH,
44 };
45
46 enum litest_device_feature {
47         LITEST_DISABLE_DEVICE = -1,
48         LITEST_ANY = 0,
49         LITEST_TOUCHPAD = 1 << 0,
50         LITEST_CLICKPAD = 1 << 1,
51         LITEST_BUTTON = 1 << 2,
52         LITEST_KEYS = 1 << 3,
53         LITEST_POINTER = 1 << 4,
54         LITEST_WHEEL = 1 << 5,
55         LITEST_TOUCH = 1 << 6,
56 };
57
58 struct litest_device {
59         struct libevdev *evdev;
60         struct libevdev_uinput *uinput;
61         struct libinput *libinput;
62         struct libinput_device *libinput_device;
63         struct litest_device_interface *interface;
64 };
65
66 void litest_add(const char *name, void *func,
67                 enum litest_device_feature required_feature,
68                 enum litest_device_feature excluded_feature);
69 void litest_add_no_device(const char *name, void *func);
70
71 int litest_run(int argc, char **argv);
72 struct litest_device * litest_create_device(enum litest_device_type which);
73 struct litest_device *litest_current_device(void);
74 void litest_delete_device(struct litest_device *d);
75 int litest_handle_events(struct litest_device *d);
76
77 void litest_event(struct litest_device *t,
78                   unsigned int type,
79                   unsigned int code,
80                   int value);
81 void litest_touch_up(struct litest_device *d, unsigned int slot);
82 void litest_touch_move(struct litest_device *d,
83                        unsigned int slot,
84                        int x,
85                        int y);
86 void litest_touch_down(struct litest_device *d,
87                        unsigned int slot,
88                        int x,
89                        int y);
90 void litest_touch_move_to(struct litest_device *d,
91                           unsigned int slot,
92                           int x_from, int y_from,
93                           int x_to, int y_to,
94                           int steps);
95 void litest_button_click(struct litest_device *d,
96                          unsigned int button,
97                          bool is_press);
98 void litest_drain_events(struct libinput *li);
99
100 #endif /* LITEST_H */