keyseq: add a couple of tests Tests the filter refcounting. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/test/keyseq.c b/test/keyseq.c
index d99be0e..7f148f7 100644
--- a/test/keyseq.c
+++ b/test/keyseq.c
@@ -206,6 +206,35 @@ main(void)
KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT,
KEY_O, BOTH, XKB_KEY_o, FINISH));
+ /*
+ * Two key presses from the same key (e.g. if two keyboards use the
+ * same xkb_state) should only be released after two releases.
+ */
+ assert(test_key_seq(keymap,
+ KEY_H, BOTH, XKB_KEY_h, NEXT,
+ KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT,
+ KEY_H, BOTH, XKB_KEY_H, NEXT,
+ KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT,
+ KEY_H, BOTH, XKB_KEY_H, NEXT,
+ KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT,
+ KEY_H, BOTH, XKB_KEY_H, NEXT,
+ KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT,
+ KEY_H, BOTH, XKB_KEY_h, FINISH));
+
+ /* Same as above with locked modifiers. */
+ assert(test_key_seq(keymap,
+ KEY_H, BOTH, XKB_KEY_h, NEXT,
+ KEY_CAPSLOCK, DOWN, XKB_KEY_Caps_Lock, NEXT,
+ KEY_H, BOTH, XKB_KEY_H, NEXT,
+ KEY_CAPSLOCK, DOWN, XKB_KEY_Caps_Lock, NEXT,
+ KEY_H, BOTH, XKB_KEY_H, NEXT,
+ KEY_CAPSLOCK, UP, XKB_KEY_Caps_Lock, NEXT,
+ KEY_H, BOTH, XKB_KEY_H, NEXT,
+ KEY_CAPSLOCK, UP, XKB_KEY_Caps_Lock, NEXT,
+ KEY_H, BOTH, XKB_KEY_H, NEXT,
+ KEY_CAPSLOCK, BOTH, XKB_KEY_Caps_Lock, NEXT,
+ KEY_H, BOTH, XKB_KEY_h, FINISH));
+
/* Group switching / locking. */
assert(test_key_seq(keymap,
KEY_H, BOTH, XKB_KEY_h, NEXT,