Debian Codegraph @

test/test-keyboard.c

raw
1 /*
2 * Copyright © 2014 Jonas Ådahl <[email protected]>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 #include "config.h"
25
26 #include <stdio.h>
27
28 #include "libinput-util.h"
29 #include "litest.h"
30
31 START_TEST(keyboard_seat_key_count)
32 {
33 struct litest_device *devices[4];
34 const int num_devices = ARRAY_LENGTH(devices);
35 struct libinput_event *ev;
36 struct libinput_event_keyboard *kev;
37 int i;
38 int seat_key_count = 0;
39 int expected_key_button_count = 0;
40 char device_name[255];
41
42 _litest_context_destroy_ struct libinput *libinput = litest_create_context();
43 for (i = 0; i < num_devices; ++i) {
44 sprintf(device_name, "litest Generic keyboard (%d)", i);
45 devices[i] = litest_add_device_with_overrides(libinput,
46 LITEST_KEYBOARD,
47 device_name,
48 NULL,
49 NULL,
50 NULL);
51 }
52
53 litest_drain_events(libinput);
54
55 for (i = 0; i < num_devices; ++i)
56 litest_keyboard_key(devices[i], KEY_A, true);
57
58 litest_dispatch(libinput);
59 while ((ev = libinput_get_event(libinput))) {
60 kev = litest_is_keyboard_event(ev, KEY_A, LIBINPUT_KEY_STATE_PRESSED);
61
62 ++expected_key_button_count;
63 seat_key_count = libinput_event_keyboard_get_seat_key_count(kev);
64 litest_assert_int_eq(expected_key_button_count, seat_key_count);
65
66 libinput_event_destroy(ev);
67 litest_dispatch(libinput);
68 }
69
70 litest_assert_int_eq(seat_key_count, num_devices);
71
72 for (i = 0; i < num_devices; ++i)
73 litest_keyboard_key(devices[i], KEY_A, false);
74
75 litest_dispatch(libinput);
76 while ((ev = libinput_get_event(libinput))) {
77 kev = libinput_event_get_keyboard_event(ev);
78 litest_assert_notnull(kev);
79 litest_assert_int_eq(libinput_event_keyboard_get_key(kev),
80 (unsigned int)KEY_A);
81 litest_assert_enum_eq(libinput_event_keyboard_get_key_state(kev),
82 LIBINPUT_KEY_STATE_RELEASED);
83
84 --expected_key_button_count;
85 seat_key_count = libinput_event_keyboard_get_seat_key_count(kev);
86 litest_assert_int_eq(expected_key_button_count, seat_key_count);
87
88 libinput_event_destroy(ev);
89 litest_dispatch(libinput);
90 }
91
92 litest_assert_int_eq(seat_key_count, 0);
93
94 for (i = 0; i < num_devices; ++i)
95 litest_device_destroy(devices[i]);
96 }
97 END_TEST
98
99 START_TEST(keyboard_ignore_no_pressed_release)
100 {
101 struct litest_device *dev;
102 struct libinput_event *event;
103 struct libinput_event_keyboard *kevent;
104 int events[] = {
105 EV_KEY,
106 KEY_A,
107 -1,
108 -1,
109 };
110 enum libinput_key_state expected_states[] = {
111 LIBINPUT_KEY_STATE_PRESSED,
112 LIBINPUT_KEY_STATE_RELEASED,
113 };
114
115 /* We can't send pressed -> released -> pressed events using uinput
116 * as such non-symmetric events are dropped. Work-around this by first
117 * adding the test device to the tested context after having sent an
118 * initial pressed event. */
119 _litest_context_destroy_ struct libinput *unused_libinput =
120 litest_create_context();
121 dev = litest_add_device_with_overrides(unused_libinput,
122 LITEST_KEYBOARD,
123 "Generic keyboard",
124 NULL,
125 NULL,
126 events);
127
128 litest_keyboard_key(dev, KEY_A, true);
129 litest_drain_events(unused_libinput);
130
131 _litest_context_destroy_ struct libinput *libinput = litest_create_context();
132 libinput_path_add_device(libinput, libevdev_uinput_get_devnode(dev->uinput));
133 litest_drain_events(libinput);
134
135 litest_keyboard_key(dev, KEY_A, false);
136 litest_keyboard_key(dev, KEY_A, true);
137 litest_keyboard_key(dev, KEY_A, false);
138
139 litest_dispatch(libinput);
140
141 ARRAY_FOR_EACH(expected_states, state) {
142 event = libinput_get_event(libinput);
143 litest_assert_notnull(event);
144 litest_assert_event_type(event, LIBINPUT_EVENT_KEYBOARD_KEY);
145 kevent = libinput_event_get_keyboard_event(event);
146 litest_assert_int_eq(libinput_event_keyboard_get_key(kevent),
147 (unsigned int)KEY_A);
148 litest_assert_int_eq(libinput_event_keyboard_get_key_state(kevent),
149 *state);
150 libinput_event_destroy(event);
151 litest_dispatch(libinput);
152 }
153
154 litest_assert_empty_queue(libinput);
155 litest_device_destroy(dev);
156 }
157 END_TEST
158
159 START_TEST(keyboard_key_auto_release)
160 {
161 struct litest_device *dev;
162 struct libinput_event *event;
163 enum libinput_event_type type;
164 struct libinput_event_keyboard *kevent;
165 struct {
166 int code;
167 int released;
168 } keys[] = {
169 {
170 .code = KEY_A,
171 },
172 {
173 .code = KEY_S,
174 },
175 {
176 .code = KEY_D,
177 },
178 {
179 .code = KEY_G,
180 },
181 {
182 .code = KEY_Z,
183 },
184 {
185 .code = KEY_DELETE,
186 },
187 {
188 .code = KEY_F24,
189 },
190 };
191 int events[2 * (ARRAY_LENGTH(keys) + 1)];
192 unsigned i;
193 int key;
194 int valid_code;
195
196 /* Enable all tested keys on the device */
197 i = 0;
198 while (i < 2 * ARRAY_LENGTH(keys)) {
199 key = keys[i / 2].code;
200 events[i++] = EV_KEY;
201 events[i++] = key;
202 }
203 events[i++] = -1;
204 events[i++] = -1;
205
206 _litest_context_destroy_ struct libinput *libinput = litest_create_context();
207 dev = litest_add_device_with_overrides(libinput,
208 LITEST_KEYBOARD,
209 "Generic keyboard",
210 NULL,
211 NULL,
212 events);
213
214 litest_drain_events(libinput);
215
216 /* Send pressed events, without releasing */
217 for (i = 0; i < ARRAY_LENGTH(keys); ++i) {
218 key = keys[i].code;
219 litest_event(dev, EV_KEY, key, 1);
220 litest_event(dev, EV_SYN, SYN_REPORT, 0);
221
222 litest_dispatch(libinput);
223
224 event = libinput_get_event(libinput);
225 litest_is_keyboard_event(event, key, LIBINPUT_KEY_STATE_PRESSED);
226 libinput_event_destroy(event);
227 }
228
229 litest_drain_events(libinput);
230
231 /* "Disconnect" device */
232 litest_device_destroy(dev);
233
234 /* Mark all released keys until device is removed */
235 while (1) {
236 event = libinput_get_event(libinput);
237 litest_assert_notnull(event);
238 type = libinput_event_get_type(event);
239
240 if (type == LIBINPUT_EVENT_DEVICE_REMOVED) {
241 libinput_event_destroy(event);
242 break;
243 }
244
245 litest_assert_event_type(event, LIBINPUT_EVENT_KEYBOARD_KEY);
246 kevent = libinput_event_get_keyboard_event(event);
247 litest_assert_enum_eq(libinput_event_keyboard_get_key_state(kevent),
248 LIBINPUT_KEY_STATE_RELEASED);
249 key = libinput_event_keyboard_get_key(kevent);
250
251 valid_code = 0;
252 for (i = 0; i < ARRAY_LENGTH(keys); ++i) {
253 if (keys[i].code == key) {
254 litest_assert_int_eq(keys[i].released, 0);
255 keys[i].released = 1;
256 valid_code = 1;
257 }
258 }
259 litest_assert_int_eq(valid_code, 1);
260 libinput_event_destroy(event);
261 }
262
263 /* Check that all pressed keys has been released. */
264 for (i = 0; i < ARRAY_LENGTH(keys); ++i) {
265 litest_assert_int_eq(keys[i].released, 1);
266 }
267 }
268 END_TEST
269
270 START_TEST(keyboard_has_key)
271 {
272 struct litest_device *dev = litest_current_device();
273 struct libinput_device *device = dev->libinput_device;
274 unsigned int code;
275 int evdev_has, libinput_has;
276
277 litest_assert(
278 libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD));
279
280 for (code = 0; code < KEY_CNT; code++) {
281 evdev_has = libevdev_has_event_code(dev->evdev, EV_KEY, code);
282 libinput_has = libinput_device_keyboard_has_key(device, code);
283 litest_assert_int_eq(evdev_has, libinput_has);
284 }
285 }
286 END_TEST
287
288 START_TEST(keyboard_keys_bad_device)
289 {
290 struct litest_device *dev = litest_current_device();
291 struct libinput_device *device = dev->libinput_device;
292 unsigned int code;
293 int has_key;
294
295 if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD))
296 return LITEST_NOT_APPLICABLE;
297
298 for (code = 0; code < KEY_CNT; code++) {
299 has_key = libinput_device_keyboard_has_key(device, code);
300 litest_assert_int_eq(has_key, -1);
301 }
302 }
303 END_TEST
304
305 START_TEST(keyboard_time_usec)
306 {
307 struct litest_device *dev = litest_current_device();
308 struct libinput *li = dev->libinput;
309 struct libinput_event_keyboard *kev;
310 struct libinput_event *event;
311 uint64_t time_usec;
312
313 if (!libevdev_has_event_code(dev->evdev, EV_KEY, KEY_A))
314 return LITEST_NOT_APPLICABLE;
315
316 litest_drain_events(dev->libinput);
317
318 litest_keyboard_key(dev, KEY_A, true);
319 litest_dispatch(li);
320
321 event = libinput_get_event(li);
322 kev = litest_is_keyboard_event(event, KEY_A, LIBINPUT_KEY_STATE_PRESSED);
323
324 time_usec = libinput_event_keyboard_get_time_usec(kev);
325 litest_assert_int_eq(libinput_event_keyboard_get_time(kev),
326 (uint32_t)(time_usec / 1000));
327
328 libinput_event_destroy(event);
329 litest_drain_events(dev->libinput);
330 }
331 END_TEST
332
333 START_TEST(keyboard_no_buttons)
334 {
335 struct litest_device *dev = litest_current_device();
336 struct libinput *li = dev->libinput;
337 struct libinput_event *event;
338 int code;
339 const char *name;
340
341 litest_drain_events(dev->libinput);
342
343 for (code = 0; code < KEY_MAX; code++) {
344 if (!libevdev_has_event_code(dev->evdev, EV_KEY, code))
345 continue;
346
347 name = libevdev_event_code_get_name(EV_KEY, code);
348 if (!strstartswith(name, "KEY_"))
349 continue;
350
351 litest_keyboard_key(dev, code, true);
352 litest_keyboard_key(dev, code, false);
353 litest_dispatch(li);
354
355 event = libinput_get_event(li);
356 litest_is_keyboard_event(event, code, LIBINPUT_KEY_STATE_PRESSED);
357 libinput_event_destroy(event);
358 event = libinput_get_event(li);
359 litest_is_keyboard_event(event, code, LIBINPUT_KEY_STATE_RELEASED);
360 libinput_event_destroy(event);
361 }
362 }
363 END_TEST
364
365 START_TEST(keyboard_frame_order)
366 {
367 struct litest_device *dev = litest_current_device();
368 struct libinput *li = dev->libinput;
369
370 if (!libevdev_has_event_code(dev->evdev, EV_KEY, KEY_A) ||
371 !libevdev_has_event_code(dev->evdev, EV_KEY, KEY_LEFTSHIFT))
372 return LITEST_NOT_APPLICABLE;
373
374 litest_drain_events(li);
375
376 litest_event(dev, EV_KEY, KEY_LEFTSHIFT, 1);
377 litest_event(dev, EV_KEY, KEY_A, 1);
378 litest_event(dev, EV_SYN, SYN_REPORT, 0);
379 litest_dispatch(li);
380
381 litest_assert_key_event(li, KEY_LEFTSHIFT, LIBINPUT_KEY_STATE_PRESSED);
382 litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_PRESSED);
383
384 litest_event(dev, EV_KEY, KEY_LEFTSHIFT, 0);
385 litest_event(dev, EV_KEY, KEY_A, 0);
386 litest_event(dev, EV_SYN, SYN_REPORT, 0);
387 litest_dispatch(li);
388
389 litest_assert_key_event(li, KEY_LEFTSHIFT, LIBINPUT_KEY_STATE_RELEASED);
390 litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_RELEASED);
391
392 litest_event(dev, EV_KEY, KEY_A, 1);
393 litest_event(dev, EV_KEY, KEY_LEFTSHIFT, 1);
394 litest_event(dev, EV_SYN, SYN_REPORT, 0);
395 litest_dispatch(li);
396
397 litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_PRESSED);
398 litest_assert_key_event(li, KEY_LEFTSHIFT, LIBINPUT_KEY_STATE_PRESSED);
399
400 litest_event(dev, EV_KEY, KEY_A, 0);
401 litest_event(dev, EV_KEY, KEY_LEFTSHIFT, 0);
402 litest_event(dev, EV_SYN, SYN_REPORT, 0);
403 litest_dispatch(li);
404
405 litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_RELEASED);
406 litest_assert_key_event(li, KEY_LEFTSHIFT, LIBINPUT_KEY_STATE_RELEASED);
407
408 litest_dispatch(li);
409 }
410 END_TEST
411
412 START_TEST(keyboard_leds)
413 {
414 struct litest_device *dev = litest_current_device();
415 struct libinput_device *device = dev->libinput_device;
416
417 /* we can't actually test the results here without physically
418 * looking at the LEDs. So all we do is trigger the code for devices
419 * with and without LEDs and check that it doesn't go boom
420 */
421
422 libinput_device_led_update(device, LIBINPUT_LED_NUM_LOCK);
423 libinput_device_led_update(device, LIBINPUT_LED_CAPS_LOCK);
424 libinput_device_led_update(device, LIBINPUT_LED_SCROLL_LOCK);
425 libinput_device_led_update(device, LIBINPUT_LED_COMPOSE);
426 libinput_device_led_update(device, LIBINPUT_LED_KANA);
427
428 libinput_device_led_update(device,
429 LIBINPUT_LED_NUM_LOCK | LIBINPUT_LED_CAPS_LOCK);
430 libinput_device_led_update(device,
431 LIBINPUT_LED_NUM_LOCK | LIBINPUT_LED_CAPS_LOCK |
432 LIBINPUT_LED_SCROLL_LOCK);
433 libinput_device_led_update(device,
434 LIBINPUT_LED_NUM_LOCK | LIBINPUT_LED_CAPS_LOCK |
435 LIBINPUT_LED_SCROLL_LOCK |
436 LIBINPUT_LED_COMPOSE | LIBINPUT_LED_KANA);
437 libinput_device_led_update(device, 0);
438 libinput_device_led_update(device, -1);
439 }
440 END_TEST
441
442 START_TEST(keyboard_no_scroll)
443 {
444 struct litest_device *dev = litest_current_device();
445 struct libinput_device *device = dev->libinput_device;
446 enum libinput_config_scroll_method method;
447 enum libinput_config_status status;
448
449 method = libinput_device_config_scroll_get_method(device);
450 litest_assert_enum_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
451 method = libinput_device_config_scroll_get_default_method(device);
452 litest_assert_enum_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
453
454 status = libinput_device_config_scroll_set_method(device,
455 LIBINPUT_CONFIG_SCROLL_2FG);
456 litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
457 status = libinput_device_config_scroll_set_method(device,
458 LIBINPUT_CONFIG_SCROLL_EDGE);
459 litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
460 status = libinput_device_config_scroll_set_method(
461 device,
462 LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
463 litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
464 status = libinput_device_config_scroll_set_method(
465 device,
466 LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
467 litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
468 }
469 END_TEST
470
471 START_TEST(keyboard_alt_printscreen)
472 {
473 struct litest_device *dev = litest_current_device();
474 struct libinput *li = dev->libinput;
475
476 litest_drain_events(li);
477
478 /* normal key press, not ignored */
479 litest_event(dev, EV_KEY, KEY_LEFTALT, 1);
480 litest_event(dev, EV_SYN, SYN_REPORT, 0);
481 litest_dispatch(li);
482 litest_assert_key_event(li, KEY_LEFTALT, LIBINPUT_KEY_STATE_PRESSED);
483
484 /* normal key repeat, ignored */
485 litest_event(dev, EV_KEY, KEY_LEFTALT, 2);
486 litest_event(dev, EV_SYN, SYN_REPORT, 1);
487 litest_dispatch(li);
488 litest_assert_empty_queue(li);
489
490 /* not a repeat, not ignored */
491 litest_event(dev, EV_KEY, KEY_LEFTALT, 0);
492 litest_event(dev, EV_SYN, SYN_REPORT, 0);
493 litest_dispatch(li);
494 litest_assert_key_event(li, KEY_LEFTALT, LIBINPUT_KEY_STATE_RELEASED);
495 litest_assert_empty_queue(li);
496
497 /* special alt+printscreen frame, *not* ignored */
498 litest_event(dev, EV_KEY, KEY_LEFTALT, 1);
499 litest_event(dev, EV_KEY, KEY_SYSRQ, 1);
500 litest_event(dev, EV_SYN, SYN_REPORT, 1);
501 litest_dispatch(li);
502
503 /* special alt+printscreen frame, *not* ignored */
504 litest_event(dev, EV_KEY, KEY_LEFTALT, 0);
505 litest_event(dev, EV_KEY, KEY_SYSRQ, 0);
506 litest_event(dev, EV_SYN, SYN_REPORT, 1);
507 litest_dispatch(li);
508
509 /* Note: The kernel first releases KEY_LEFTALT when pressing KEY_SYSRQ,
510 * then later generates press/release for KEY_LEFTALT + KEY_SYSRQ
511 * once *both* keys are released. The order is reshuffled so we have
512 * alt down, sysrq down, sysrq up, alt up.
513 */
514 litest_assert_key_event(li, KEY_LEFTALT, LIBINPUT_KEY_STATE_PRESSED);
515 litest_assert_key_event(li, KEY_LEFTALT, LIBINPUT_KEY_STATE_RELEASED);
516
517 litest_assert_key_event(li, KEY_LEFTALT, LIBINPUT_KEY_STATE_PRESSED);
518 litest_assert_key_event(li, KEY_SYSRQ, LIBINPUT_KEY_STATE_PRESSED);
519 litest_assert_key_event(li, KEY_SYSRQ, LIBINPUT_KEY_STATE_RELEASED);
520 litest_assert_key_event(li, KEY_LEFTALT, LIBINPUT_KEY_STATE_RELEASED);
521
522 litest_assert_empty_queue(li);
523 }
524 END_TEST
525
526 START_TEST(keyboard_keycode_obfuscation)
527 {
528 #ifdef EVENT_DEBUGGING
529 struct litest_device *dev = litest_current_device();
530 struct libinput *li = dev->libinput;
531
532 litest_drain_events(li);
533
534 litest_with_logcapture(li, capture) {
535 litest_event(dev, EV_KEY, KEY_Q, 1);
536 litest_event(dev, EV_SYN, SYN_REPORT, 0);
537 litest_event(dev, EV_KEY, KEY_Q, 0);
538 litest_event(dev, EV_SYN, SYN_REPORT, 0);
539 litest_dispatch(li);
540 litest_drain_events(li);
541
542 /* clang-format off */
543 /* We get two possible debug messages:
544 * Queuing event14 KEYBOARD_KEY +0.000s KEY_Q (16) released
545 * event14: plugin evdev - 0.000 EV_KEY KEY_Q 0
546 *
547 * Both KEY_Q must be obfuscated to KEY_A
548 */
549 /* clang-format on */
550 char **strv = capture->debugs;
551 litest_assert_strv_no_substring(strv, "KEY_Q");
552
553 strv = capture->debugs;
554 size_t index;
555 litest_assert(strv_find_substring(strv, "KEY_A", &index));
556 do {
557 litest_assert_str_in("EV_KEY", strv[index]);
558 strv += index + 1;
559 } while (strv_find_substring(strv, "KEY_A", &index));
560 }
561 #else
562 return LITEST_SKIP;
563 #endif
564 }
565 END_TEST
566
567 START_TEST(keyboard_nkey_rollover)
568 {
569 struct litest_device *dev = litest_current_device();
570 struct libinput *li = dev->libinput;
571
572 int nkeys = litest_test_param_get_i32(test_env->params, "nkeys");
573
574 litest_drain_events(li);
575
576 /* The kernel allocates a 7 + 1 buffer for devices without EV_ABS and
577 * EV_REL, see
578 * drivers/input/input.c:input_estimate_events_per_packet()
579 *
580 * If the device exceeds that buffer the current set is flushed out
581 * as SYN_REPORT 1 followed by (if any) the remaining events immediately
582 * after.
583 *
584 * Either way, we expect n keys to arrive, regardless what the kernel
585 * does.
586 */
587 for (int i = 0; i < nkeys; i++) {
588 litest_event_unchecked(dev, EV_KEY, KEY_A + i, 1);
589 litest_event_unchecked(dev, EV_MSC, MSC_SCAN, 0x1000 + i);
590 }
591 litest_event_unchecked(dev, EV_SYN, SYN_REPORT, 0);
592
593 for (int i = 0; i < nkeys; i++) {
594 litest_event_unchecked(dev, EV_KEY, KEY_A + i, 0);
595 litest_event_unchecked(dev, EV_MSC, MSC_SCAN, 0x1000 + i);
596 }
597 litest_event_unchecked(dev, EV_SYN, SYN_REPORT, 0);
598
599 litest_dispatch(li);
600
601 for (int i = 0; i < nkeys; i++) {
602 litest_checkpoint("here for %d", i);
603 litest_assert_key_event(li, KEY_A + i, LIBINPUT_KEY_STATE_PRESSED);
604 }
605 for (int i = 0; i < nkeys; i++) {
606 litest_assert_key_event(li, KEY_A + i, LIBINPUT_KEY_STATE_RELEASED);
607 }
608
609 litest_assert_empty_queue(li);
610 }
611 END_TEST
612
613 TEST_COLLECTION(keyboard)
614 {
615 /* clang-format off */
616 litest_add_no_device(keyboard_seat_key_count);
617 litest_add_no_device(keyboard_ignore_no_pressed_release);
618 litest_add_no_device(keyboard_key_auto_release);
619 litest_add(keyboard_has_key, LITEST_KEYS, LITEST_ANY);
620 litest_add(keyboard_keys_bad_device, LITEST_ANY, LITEST_ANY);
621 litest_add(keyboard_time_usec, LITEST_KEYS, LITEST_ANY);
622
623 litest_add(keyboard_no_buttons, LITEST_KEYS, LITEST_ANY);
624 litest_add(keyboard_frame_order, LITEST_KEYS, LITEST_ANY);
625
626 litest_add(keyboard_leds, LITEST_ANY, LITEST_ANY);
627
628 litest_add(keyboard_no_scroll, LITEST_KEYS, LITEST_WHEEL);
629
630 litest_add_for_device(keyboard_alt_printscreen, LITEST_KEYBOARD);
631 litest_add_for_device(keyboard_keycode_obfuscation, LITEST_KEYBOARD);
632
633 /* Adding for one device only to be able to hardcode buffer sizes */
634 litest_with_parameters(params, "nkeys", 'i', 4, 3, 4, 5, 6)
635 litest_add_parametrized_for_device(keyboard_nkey_rollover, LITEST_KEYBOARD, params);
636
637 /* clang-format on */
638 }