summaryrefslogtreecommitdiff
path: root/test/keyseq.c
AgeCommit message (Collapse)AuthorFilesLines
2013-03-18state: fix unbound virtual modifier bugRan Benita1-1/+10
Recent xkeyboard-config introduced the following line in symbols/level3: vmods = LevelThree, However, the XKM format which xkbcomp produces for the X server can't handle explicit virtual modifiers such as this: https://bugs.freedesktop.org/show_bug.cgi?id=4927 So by doing the following, for example: setxkbmap -layout de (or another 3-level layouts) xkbcomp $DISPLAY out.xkb xkbcomp out.xkb $DISPLAY The modifier is lost and can't be used for switching to Level3 (see the included test). We, however, are affected worse by this bug when we load the out.xkb keymap. First, the FOUR_LEVEL_ALPHABETIC key type has these entries: map[None] = Level1; map[Shift] = Level2; map[Lock] = Level2; map[LevelThree] = Level3; [...] Now, because the LevelThree virtual modifier is not bound to anything, the effective mask of the "map[LevelThree]" entry is just 0. So when the modifier state is empty (initial state), this entry is chosen, and we get Level3, instead of failing to match any entry and getting the default Level1. The difference in behavior from the xserver stems from this commit: acdad6058d52dc8a3e724dc95448300850d474f2 Which removed the entry->active field. Without bugs, this would be correct; however, it seems in this case we should just follow the server's behavior. The server sets the entry->active field like so in XKBMisc.c: /* entry is active if vmods are bound */ entry->active = (mask != 0); The xkblib spec explains this field, but does not specify how to initialize it. This commit does the same as above but more directly. Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18test/keyseq: re-add de(neo) level5 testRan Benita1-6/+5
See: https://bugs.freedesktop.org/show_bug.cgi?id=50935 This works now after syncing with recent xkeyboard-config. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-29test/keyseq: add test for setting depressed groupRan Benita1-0/+46
Tests the SetGroup action is working properly. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-16Add xkb_keysym_from_name() flags argument for case-insensitive searchDavid Herrmann1-1/+1
This adds a flags argument to xkb_keysym_from_name() so we can perform a case-insensitive search. This should really be supported as many keysyms have really weird capitalization-rules. However, as this may produce conflicts, users must be warned to only use this for fallback paths or error-recovery. This is also the reason why the internal XKB parsers still use the case-sensitive search. This also adds some test-cases so the expected results are really produced. The binary-size does _not_ change with this patch. However, case-sensitive search may be slightly slower with this patch. But this is barely measurable. [ran: use bool instead of int for icase, add a recommendation to the doc, and test a couple "thorny" cases.] Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-24state: correctly wrap state->locked_group and ->groupRan Benita1-0/+40
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>
2012-09-24Don't use xkbcommon-compat names in internal codeRan Benita1-2/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-16keyseq: add test for repeat-shift-repeat-unshift-repeatRan Benita1-1/+17
e.g. hhhhhHHHHHHHhhhhhh with shift down and up in the middle. Unfortunately trying a quick test with test/interactive is not possible because the evdev soft-repeat stops the repeat when another key is pressed. So you need real soft-repeat for that. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-16Organize src/ and test/ headersRan Benita1-5/+0
- Add context.h and move context-related functions from xkb-priv.h to it. - Move xkb_context definition back to context.c. - Add keysym.h and move keysym upper/lower/keypad from xkb-priv.h to it. - Rename xkb-priv.h to map.h since it only contains keymap-related definitions and declarations now. - Remove unnecessary includes and some and some other small cleanups. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-14keyseq: test that de(neo) is working properlyRan Benita1-1/+75
This layout stretches us pretty well, so it's good for testing nothing breaks. There are a couple of things that need looking into, though (particularly the level5 issue). Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-13symbols: fix real/alias key merge ordering bugRan Benita1-1/+22
Background: The CopySymbolsDef has a comment on a couple of lines which supposedly fixed a bug: /* * kt_index[i] may have been set by a previous run (if we have two * layouts specified). Let's not overwrite it with the ONE_LEVEL * default group if we dont even have keys for this group anyway. * * FIXME: There should be a better fix for this. */ if (!darray_empty(groupi->levels)) key->kt_index[i] = types[i]; But neither the comment nor the fix make any sense, because the kt_index is indexed per group, i.e. each group gets its own type. The original xkbcomp commit which added this (36fecff58) points to this bug: https://bugzilla.redhat.com/show_bug.cgi?id=436626 which complains about -layout "ru,us" -variant "phonetic," not working properly. And indeed when we try: sudo ./test/interactive -l ru,us -v the first group doesn't get any syms for the main keys. The problem (Clearly the fix above is useless): The ru(phonetic) map is specified using aliases, e.g. LatQ, LatW instead of AD01, AD02, etc. When combined with another layout which uses the real names (AD01, AD02), the symbols code should recognize they are the same key and merge them into one KeyInfo. The current code does that, but it doesn't catch the case where the alias was processes *before* the real one; so we get two KeyInfo's and the later one wins. So e.g. the ru(phonetic) symbols are ignored. The fix: Before adding a new KeyInfo to the keys array, always replace its name by the real name, which avoids the entire issue. Luckily this is done pretty late so most error messages should still show the alias name. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-07keyseq: use our own keysymsRan Benita1-92/+91
Instead of <X11/keysym.h> Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-18Replace xkb_keycode_t 'key' variable name by 'kc'Ran Benita1-6/+6
We want to reserve the name 'key' for something else. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-12Add a library of common test functionsDaniel Stone1-11/+5
Including creating a context (will come in useful soon), opening and reading files, and compiling keymaps. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-12Enlarge keysym name buffers and mention in commentRan Benita1-1/+1
The longest keysym is 27 chars long. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-12keyseq: add a failing group-switching testRan Benita1-5/+13
For some reason, with the grp:alt_shift_toggle option, the following sequence switches a group: < Left Shift down, Left Alt down > While the reverse doesn't: < Left Alt down, Left Shift down > And it should. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-01state: fix base mod set/clear behaviorRan Benita1-10/+10
This commit fixes the incorrect current behavior, where at the end of the following key sequence Left Shift down, Right Shift down, Left Shift up the Shift modifier is cleared. Clearly the code is not as nice as before, but it seems like some count of the depressed modifiers must be kept. The code is lifted mostly as is from xkbActions.c. [ There they also assign to setMods and clearMods each time and not OR it. I assume its correct, although I wouldn't have guessed... ] Signed-off-by: Ran Benita <ran234@gmail.com>
2012-06-18Add a test for the results of key sequencesRan Benita1-0/+277
This test verifies the core purpose of this library, which is to translate the user's keypresses into keysyms according to the keymap and the XKB specification. The tests emulate a series of key presses, and checks that the resulting keysyms are what we expect. Several of the tests currently fail, and plenty more should be added and maybe split up. It also currently uses an RMLVO keymap, which comes from the xkeyboard-config data set, and whose behaviour may change in the future. So it should probably be changed to use several files of our own, but it's OK for now. Signed-off-by: Ran Benita <ran234@gmail.com>