diff options
author | Ran Benita <ran234@gmail.com> | 2012-09-21 16:30:01 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2012-09-24 09:08:53 +1000 |
commit | 67b03cea0b1eca4aec4b80060d71603a055bef4c (patch) | |
tree | a0593f86cd6700b78bc3769e9bed0e2b7ca937f2 /test | |
parent | 7d1db12dbb34ee6da34aba9dafdceb6f09d2e8b6 (diff) |
state: correctly wrap state->locked_group and ->group
These values weren't wrapped before, which caused group_index_is_active
to stop working after a few group switches.
Also, the current group-wrapping function didn't take into consideration
actions such as LockGroup=-1, which need to wrap around, etc.
xkb_layout_index_t is unsigned, but it was used to hold possibly
negative values (e.g. locked_group is 0 and gets a -1 action).
This group wrapping function should now act like the XkbAdjustGroup
function from xserver, and at least ./test/interactive doesn't bring up
any problems with group switching any more.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/keyseq.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/keyseq.c b/test/keyseq.c index 4508ab1..d5993ec 100644 --- a/test/keyseq.c +++ b/test/keyseq.c @@ -379,6 +379,46 @@ main(void) KEY_V, BOTH, XKB_KEY_p, FINISH)); xkb_keymap_unref(keymap); + assert(ctx); + keymap = test_compile_rules(ctx, "evdev", "", "us,il,ru", "", + "grp:alt_shift_toggle_bidir,grp:menu_toggle"); + assert(keymap); + + assert(test_key_seq(keymap, + KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_ISO_Prev_Group, NEXT, + KEY_LEFTALT, UP, XKB_KEY_ISO_Prev_Group, NEXT, + KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, FINISH)); + + assert(test_key_seq(keymap, + KEY_LEFTALT, DOWN, XKB_KEY_Alt_L, NEXT, + KEY_LEFTSHIFT, DOWN, XKB_KEY_ISO_Prev_Group, NEXT, + KEY_LEFTSHIFT, UP, XKB_KEY_ISO_Prev_Group, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Alt_L, FINISH)); + + /* Check backwards (negative) group switching and wrapping. */ + assert(test_key_seq(keymap, + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_COMPOSE, BOTH, XKB_KEY_ISO_Next_Group, NEXT, + KEY_H, BOTH, XKB_KEY_hebrew_yod, NEXT, + KEY_COMPOSE, BOTH, XKB_KEY_ISO_Next_Group, NEXT, + KEY_H, BOTH, XKB_KEY_Cyrillic_er, NEXT, + KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT, + KEY_LEFTALT, BOTH, XKB_KEY_ISO_Prev_Group, NEXT, + KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT, + KEY_H, BOTH, XKB_KEY_hebrew_yod, NEXT, + KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT, + KEY_LEFTALT, BOTH, XKB_KEY_ISO_Prev_Group, NEXT, + KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT, + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT, + KEY_LEFTALT, BOTH, XKB_KEY_ISO_Prev_Group, NEXT, + KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT, + KEY_H, BOTH, XKB_KEY_Cyrillic_er, NEXT, + KEY_COMPOSE, BOTH, XKB_KEY_ISO_Next_Group, NEXT, + KEY_H, BOTH, XKB_KEY_h, FINISH)); + + xkb_keymap_unref(keymap); xkb_context_unref(ctx); return 0; } |