diff options
author | Ran Benita <ran234@gmail.com> | 2012-10-29 20:20:51 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2012-10-29 20:20:51 +0200 |
commit | 94155878ec98e2583e6ec999a881ad8015231a5c (patch) | |
tree | 45e610eb4a0c080df5457a68f91fb4d1816e4c5b /test | |
parent | 7261f404d201b157dc0ce1ae0386fd74f3a128a7 (diff) |
test/keyseq: add test for setting depressed group
Tests the SetGroup action is working properly.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/keyseq.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/keyseq.c b/test/keyseq.c index cb53739..5aa53a6 100644 --- a/test/keyseq.c +++ b/test/keyseq.c @@ -66,6 +66,8 @@ test_key_seq(struct xkb_keymap *keymap, ...) unsigned int nsyms, i; char ksbuf[64]; + fprintf(stderr, "----\n"); + state = xkb_state_new(keymap); assert(state); @@ -419,6 +421,50 @@ main(void) KEY_H, BOTH, XKB_KEY_h, FINISH)); xkb_keymap_unref(keymap); + assert(ctx); + keymap = test_compile_rules(ctx, "evdev", "", "us,il,ru", "", + "grp:switch,grp:lswitch,grp:menu_toggle"); + assert(keymap); + + /* Test depressed group works (Mode_switch). */ + assert(test_key_seq(keymap, + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_RIGHTALT, DOWN, XKB_KEY_Mode_switch, NEXT, + KEY_H, BOTH, XKB_KEY_hebrew_yod, NEXT, + KEY_RIGHTALT, UP, XKB_KEY_ISO_Level3_Shift, NEXT, + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_RIGHTALT, DOWN, XKB_KEY_Mode_switch, NEXT, + KEY_H, BOTH, XKB_KEY_hebrew_yod, NEXT, + KEY_RIGHTALT, UP, XKB_KEY_ISO_Level3_Shift, NEXT, + KEY_H, BOTH, XKB_KEY_h, FINISH)); + + /* Test locked+depressed group works, with wrapping and accumulation. */ + assert(test_key_seq(keymap, + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_COMPOSE, BOTH, XKB_KEY_ISO_Next_Group, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_Mode_switch, NEXT, + KEY_H, BOTH, XKB_KEY_Cyrillic_er, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Mode_switch, NEXT, + KEY_H, BOTH, XKB_KEY_hebrew_yod, NEXT, + KEY_COMPOSE, BOTH, XKB_KEY_ISO_Next_Group, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_Mode_switch, NEXT, + /* Should wrap back to first group. */ + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Mode_switch, NEXT, + KEY_H, BOTH, XKB_KEY_Cyrillic_er, NEXT, + KEY_COMPOSE, BOTH, XKB_KEY_ISO_Next_Group, NEXT, + KEY_H, BOTH, XKB_KEY_h, NEXT, + /* Two SetGroup(+1)'s should add up. */ + KEY_RIGHTALT, DOWN, XKB_KEY_Mode_switch, NEXT, + KEY_H, BOTH, XKB_KEY_hebrew_yod, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_Mode_switch, NEXT, + KEY_H, BOTH, XKB_KEY_Cyrillic_er, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Mode_switch, NEXT, + KEY_H, BOTH, XKB_KEY_hebrew_yod, NEXT, + KEY_RIGHTALT, UP, XKB_KEY_ISO_Level3_Shift, NEXT, + KEY_H, BOTH, XKB_KEY_h, FINISH)); + + xkb_keymap_unref(keymap); xkb_context_unref(ctx); return 0; } |