From 94155878ec98e2583e6ec999a881ad8015231a5c Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 29 Oct 2012 20:20:51 +0200 Subject: test/keyseq: add test for setting depressed group Tests the SetGroup action is working properly. Signed-off-by: Ran Benita --- test/keyseq.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'test') 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); @@ -418,6 +420,50 @@ main(void) KEY_COMPOSE, BOTH, XKB_KEY_ISO_Next_Group, NEXT, 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; -- cgit v1.2.3