mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-07 06:08:08 +02:00
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 <peter.hutterer@who-t.net>
This commit is contained in:
parent
a87e2558cf
commit
50dfd52cd7
3 changed files with 35 additions and 0 deletions
|
|
@ -191,6 +191,9 @@ static int events[] = {
|
||||||
EV_KEY, KEY_SEARCH,
|
EV_KEY, KEY_SEARCH,
|
||||||
EV_KEY, KEY_MEDIA,
|
EV_KEY, KEY_MEDIA,
|
||||||
EV_KEY, KEY_FN,
|
EV_KEY, KEY_FN,
|
||||||
|
EV_LED, LED_NUML,
|
||||||
|
EV_LED, LED_CAPSL,
|
||||||
|
EV_LED, LED_SCROLLL,
|
||||||
-1, -1,
|
-1, -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,7 @@ enum litest_device_feature {
|
||||||
LITEST_RING = 1 << 22,
|
LITEST_RING = 1 << 22,
|
||||||
LITEST_STRIP = 1 << 23,
|
LITEST_STRIP = 1 << 23,
|
||||||
LITEST_TRACKBALL = 1 << 24,
|
LITEST_TRACKBALL = 1 << 24,
|
||||||
|
LITEST_LEDS = 1 << 25,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct litest_device {
|
struct litest_device {
|
||||||
|
|
|
||||||
|
|
@ -366,6 +366,35 @@ START_TEST(keyboard_no_buttons)
|
||||||
}
|
}
|
||||||
END_TEST
|
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
|
void
|
||||||
litest_setup_tests_keyboard(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:time", keyboard_time_usec, LITEST_KEYS, LITEST_ANY);
|
||||||
|
|
||||||
litest_add("keyboard:events", keyboard_no_buttons, 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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue