diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-07-11 09:09:14 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2013-07-11 09:09:14 +1000 |
commit | 76a03e53261723f6096a5bec90207c9ea304c227 (patch) | |
tree | bca90f35e3cc18fa2e22a3c81b720947d43d6ced /test/test-libevdev-has-event.c | |
parent | 9e64f40f61ec3caa271bee14757ab56a8de28ab4 (diff) | |
download | libevdev-76a03e53261723f6096a5bec90207c9ea304c227.tar.gz |
test: add uinput prop bits and the test for it
Turns out I was looking at an old header file, UI_SET_PROPBIT
has existed for quite a while.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test/test-libevdev-has-event.c')
-rw-r--r-- | test/test-libevdev-has-event.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/test/test-libevdev-has-event.c b/test/test-libevdev-has-event.c index 2af2f3e..c2c1a2b 100644 --- a/test/test-libevdev-has-event.c +++ b/test/test-libevdev-has-event.c @@ -212,17 +212,31 @@ START_TEST(test_input_props) { struct uinput_device* uidev; struct libevdev *dev; - int rc; + int rc, i; - rc = test_create_device(&uidev, &dev, - EV_ABS, ABS_X, - -1); + uidev = uinput_device_new(TEST_DEVICE_NAME); + rc = uinput_device_set_event_bits(uidev, + EV_ABS, ABS_X, + -1); + ck_assert_int_eq(rc, 0); + uinput_device_set_prop(uidev, INPUT_PROP_DIRECT); + uinput_device_set_prop(uidev, INPUT_PROP_BUTTONPAD); + rc = uinput_device_create(uidev); + ck_assert_msg(rc == 0, "Failed to create uinput device: %s", strerror(-rc)); + + rc = libevdev_new_from_fd(uinput_device_get_fd(uidev), &dev); ck_assert_msg(rc == 0, "Failed to create device: %s", strerror(-rc)); + + for (i = 0; i < INPUT_PROP_MAX; i++) { + if (i == INPUT_PROP_DIRECT || i == INPUT_PROP_BUTTONPAD) + ck_assert_int_eq(libevdev_has_property(dev, i), 1); + else + ck_assert_int_eq(libevdev_has_property(dev, i), 0); + } + ck_assert_int_eq(libevdev_has_property(dev, INPUT_PROP_MAX + 1), 0); ck_assert_int_eq(libevdev_has_property(dev, INPUT_PROP_MAX), 0); - ck_assert_int_eq(libevdev_has_property(dev, INPUT_PROP_BUTTONPAD), 0); - /* FIXME: no idea how to set props on uinput devices */ uinput_device_free(uidev); libevdev_free(dev); |