Commit 50dfd52c authored by Peter Hutterer's avatar Peter Hutterer

test: add a test for keyboard LED updates

Not much we can check for here anyway, but at least we can trigger the code.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent a87e2558
......@@ -191,6 +191,9 @@ static int events[] = {
EV_KEY, KEY_SEARCH,
EV_KEY, KEY_MEDIA,
EV_KEY, KEY_FN,
EV_LED, LED_NUML,
EV_LED, LED_CAPSL,
EV_LED, LED_SCROLLL,
-1, -1,
};
......
......@@ -257,6 +257,7 @@ enum litest_device_feature {
LITEST_RING = 1 << 22,
LITEST_STRIP = 1 << 23,
LITEST_TRACKBALL = 1 << 24,
LITEST_LEDS = 1 << 25,
};
struct litest_device {
......
......@@ -366,6 +366,35 @@ START_TEST(keyboard_no_buttons)
}
END_TEST
START_TEST(keyboard_leds)
{
struct litest_device *dev = litest_current_device();
struct libinput_device *device = dev->libinput_device;
/* we can't actually test the results here without physically
* looking at the LEDs. So all we do is trigger the code for devices
* with and without LEDs and check that it doesn't go boom
*/
libinput_device_led_update(device,
LIBINPUT_LED_NUM_LOCK);
libinput_device_led_update(device,
LIBINPUT_LED_CAPS_LOCK);
libinput_device_led_update(device,
LIBINPUT_LED_SCROLL_LOCK);
libinput_device_led_update(device,
LIBINPUT_LED_NUM_LOCK|
LIBINPUT_LED_CAPS_LOCK);
libinput_device_led_update(device,
LIBINPUT_LED_NUM_LOCK|
LIBINPUT_LED_CAPS_LOCK |
LIBINPUT_LED_SCROLL_LOCK);
libinput_device_led_update(device, 0);
libinput_device_led_update(device, -1);
}
END_TEST
void
litest_setup_tests_keyboard(void)
{
......@@ -377,4 +406,6 @@ litest_setup_tests_keyboard(void)
litest_add("keyboard:time", keyboard_time_usec, LITEST_KEYS, LITEST_ANY);
litest_add("keyboard:events", keyboard_no_buttons, LITEST_KEYS, LITEST_ANY);
litest_add("keyboard:leds", keyboard_leds, LITEST_ANY, LITEST_ANY);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment