mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2026-05-08 13:38:45 +02:00
test: fix ev_rep test for new uinput implementation
We can actually set EV_REP values now, though with limitations Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
parent
cc2eaec4ed
commit
da425202c1
1 changed files with 27 additions and 4 deletions
|
|
@ -195,15 +195,38 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(test_ev_rep)
|
START_TEST(test_ev_rep)
|
||||||
{
|
{
|
||||||
|
struct libevdev *dev;
|
||||||
struct uinput_device* uidev;
|
struct uinput_device* uidev;
|
||||||
int rc;
|
int rc;
|
||||||
|
int rep, delay;
|
||||||
|
const int KERNEL_DEFAULT_REP = 250;
|
||||||
|
const int KERNEL_DEFAULT_DELAY = 33;
|
||||||
|
|
||||||
/* EV_REP is special, it's always fully set if set at all,
|
/* EV_REP is special, it's always fully set if set at all,
|
||||||
can't test this through uinput though */
|
can't test this through uinput though */
|
||||||
rc = uinput_device_new_with_events(&uidev, TEST_DEVICE_NAME, DEFAULT_IDS,
|
uidev = uinput_device_new(TEST_DEVICE_NAME);
|
||||||
EV_REP, 0,
|
ck_assert(uidev != NULL);
|
||||||
-1);
|
rc = uinput_device_set_bit(uidev, EV_REP);
|
||||||
ck_assert_int_eq(rc, -EINVAL);
|
ck_assert_int_eq(rc, 0);
|
||||||
|
|
||||||
|
rc = uinput_device_create(uidev);
|
||||||
|
ck_assert_int_eq(rc, 0);
|
||||||
|
|
||||||
|
rc = libevdev_new_from_fd(uinput_device_get_fd(uidev), &dev);
|
||||||
|
ck_assert_int_eq(rc, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(libevdev_has_event_type(dev, EV_REP), 1);
|
||||||
|
ck_assert_int_eq(libevdev_has_event_code(dev, EV_REP, REP_DELAY), 1);
|
||||||
|
ck_assert_int_eq(libevdev_has_event_code(dev, EV_REP, REP_PERIOD), 1);
|
||||||
|
|
||||||
|
ck_assert_int_eq(libevdev_get_repeat(dev, &rep, &delay), 0);
|
||||||
|
/* default values as set by the kernel,
|
||||||
|
see drivers/input/input.c:input_register_device() */
|
||||||
|
ck_assert_int_eq(rep, KERNEL_DEFAULT_REP);
|
||||||
|
ck_assert_int_eq(delay, KERNEL_DEFAULT_DELAY);
|
||||||
|
|
||||||
|
libevdev_free(dev);
|
||||||
|
uinput_device_free(uidev);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue