diff options
-rw-r--r-- | test/litest.c | 22 | ||||
-rw-r--r-- | test/litest.h | 5 |
2 files changed, 26 insertions, 1 deletions
diff --git a/test/litest.c b/test/litest.c index 29820a7e..e028176d 100644 --- a/test/litest.c +++ b/test/litest.c @@ -634,7 +634,12 @@ void litest_event(struct litest_device *d, unsigned int type, unsigned int code, int value) { - int ret = libevdev_uinput_write_event(d->uinput, type, code, value); + int ret; + + if (d->skip_ev_syn && type == EV_SYN && code == SYN_REPORT) + return; + + ret = libevdev_uinput_write_event(d->uinput, type, code, value); ck_assert_int_eq(ret, 0); } @@ -1135,3 +1140,18 @@ litest_timeout_softbuttons(void) { msleep(300); } + +void +litest_push_event_frame(struct litest_device *dev) +{ + assert(!dev->skip_ev_syn); + dev->skip_ev_syn = true; +} + +void +litest_pop_event_frame(struct litest_device *dev) +{ + assert(dev->skip_ev_syn); + dev->skip_ev_syn = false; + litest_event(dev, EV_SYN, SYN_REPORT, 0); +} diff --git a/test/litest.h b/test/litest.h index c40427db..26b30407 100644 --- a/test/litest.h +++ b/test/litest.h @@ -73,6 +73,8 @@ struct litest_device { struct litest_device_interface *interface; int ntouches_down; + bool skip_ev_syn; + void *private; /* device-specific data */ }; @@ -161,6 +163,9 @@ struct libevdev_uinput * litest_create_uinput_abs_device(const char *name, void litest_timeout_tap(void); void litest_timeout_softbuttons(void); +void litest_push_event_frame(struct litest_device *dev); +void litest_pop_event_frame(struct litest_device *dev); + #ifndef ck_assert_notnull #define ck_assert_notnull(ptr) ck_assert_ptr_ne(ptr, NULL) #endif |