mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-09 14:30:17 +01:00
test: add test helpers for touch sequence parts
The necessary helpers to test for a touch event + one touch frame and the extra case for the TOUCH_CANCEL in is_touch_event Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
adf0e5a9c7
commit
2855e26d6f
2 changed files with 79 additions and 0 deletions
|
|
@ -3203,6 +3203,7 @@ litest_is_touch_event(struct libinput_event *event,
|
|||
case LIBINPUT_EVENT_TOUCH_UP:
|
||||
case LIBINPUT_EVENT_TOUCH_MOTION:
|
||||
case LIBINPUT_EVENT_TOUCH_FRAME:
|
||||
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
||||
litest_assert_event_type(event, type);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -3505,6 +3506,75 @@ litest_assert_touch_sequence(struct libinput *li)
|
|||
libinput_event_destroy(event);
|
||||
}
|
||||
|
||||
void
|
||||
litest_assert_touch_motion_frame(struct libinput *li)
|
||||
{
|
||||
struct libinput_event *event;
|
||||
|
||||
/* expect at least one, but maybe more */
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_MOTION);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
while (event) {
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_MOTION);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
litest_assert_touch_down_frame(struct libinput *li)
|
||||
{
|
||||
struct libinput_event *event;
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_DOWN);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME);
|
||||
libinput_event_destroy(event);
|
||||
}
|
||||
|
||||
void
|
||||
litest_assert_touch_up_frame(struct libinput *li)
|
||||
{
|
||||
struct libinput_event *event;
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_UP);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME);
|
||||
libinput_event_destroy(event);
|
||||
}
|
||||
|
||||
void
|
||||
litest_assert_touch_cancel(struct libinput *li)
|
||||
{
|
||||
struct libinput_event *event;
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_CANCEL);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME);
|
||||
libinput_event_destroy(event);
|
||||
}
|
||||
|
||||
void
|
||||
litest_timeout_tap(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -670,6 +670,15 @@ litest_assert_empty_queue(struct libinput *li);
|
|||
void
|
||||
litest_assert_touch_sequence(struct libinput *li);
|
||||
|
||||
void
|
||||
litest_assert_touch_motion_frame(struct libinput *li);
|
||||
void
|
||||
litest_assert_touch_down_frame(struct libinput *li);
|
||||
void
|
||||
litest_assert_touch_up_frame(struct libinput *li);
|
||||
void
|
||||
litest_assert_touch_cancel(struct libinput *li);
|
||||
|
||||
struct libinput_event_pointer *
|
||||
litest_is_button_event(struct libinput_event *event,
|
||||
unsigned int button,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue