test


Log

Author Commit Date CI Message
Ran Benita 92e07726 2012-09-27T20:16:12 test: add keycodes files which map directly to evdev codes This is a proof-of-concept for the long key names. The keycodes in the file evdev-xkbcommon are autogenerated from linux/input.h, and uses the names given there; all of the previous names are aliased to the new names, so they continue to work with the symbols files, etc. You can try it with 'sudo ./test/interactive -r evdev-xkbcommon -n 0' The -n 0 means that we don't offset the evdev scan codes - just feed them directly. The -r evdev-xkbcommon just means to use a new rules file which makes us use the new keycodes file. (The only problem I can see is with the MENU and LSGT names which has some conflicts). Maybe some day xkeyboard-config could ship something similar, so that the 8 offset is unneeded. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 32c19f4b 2012-09-27T21:30:29 keymap-dump: make it look better with long key names Not worth messing around with too much, just make it legible. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 984ebf98 2012-09-27T20:44:16 test/interactive: allow to set evdev offset If we want to test a keymap without the usual 8 offset. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 5aaf65b7 2012-09-27T23:27:49 Add xkb_state_key_get_one_sym The trivial wrapper around xkb_state_key_get_syms that every user to date has implemented. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 9a18b872 2012-09-23T17:52:51 Add format argument to xkb_keymap_get_as_string This function really needs a format argument, for symmetry with the keymap creation functions. If we add new formats, we will almost certainly want to add support for serializing it into a string. It would also allow to convert from one format to another, etc. The in the common case, the user would just want to use the format she used to create the keymap; for that we add a special XKB_KEYMAP_USE_ORIGINAL_FORMAT value, which will do that (it is defined to -1 outside of the enum because I have a feeling we might want to use 0 for something else). To support this we need to keep the format inside the keymap. While we're at it we also initialize keymap flags properly. This changes the API, but the old xkb_map_get_as_string name works as expected so this is the best time to do this. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 0dd40125 2012-09-22T10:58:00 API: add _context prefix to log-related functions This is to follow the general scheme set by all of the other API functions. Since no one is using these functions yet, we don't (actually better not) add the old names to xkbcommon-compat.h. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 67b03cea 2012-09-21T16:30:01 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>
Ran Benita c1741732 2012-09-21T11:14:39 Don't choke on RMLVO layout string with holes This old rules parser gives the same kccgst here, so in the interest of staying compatible we shouldn't fix it there. Similarly we shouldn't touch ParseIncludeMap, so this is the best place to handle this. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita fcd20290 2012-09-21T14:44:17 Don't use xkbcommon-compat names in internal code Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 2c96828f 2012-09-19T16:44:15 test: add print-compiled-keymap tool This just prints the compiled keymap string for to the given command line arguments. This often useful when developing. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita ac872bdf 2012-09-17T14:24:38 symbols: fix buffer overflow with illegal explicit group Trying ''./test/interactive -l us:5' causes us to crash. The <layout>:<N> syntax says to put this layout at the N'th level. However the code (inherited from xkbcomp) doesn't check that the group is valid, and then happily indexes keyi->groups with it, which has a static size of XKB_NUM_GROUPS (the SetExplicitGroup function assumes the index is valid). So any value a user might put there > 4 makes nice things happen. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita dbd7a953 2012-09-16T15:57:36 keyseq: add test for repeat-shift-repeat-unshift-repeat 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>
Ran Benita b2110705 2012-09-16T14:45:32 Organize src/ and test/ headers - 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>
Ran Benita 4b69d6f7 2012-09-15T02:09:34 keycodes: ignore explicit minimum/maximum statements These statements are pretty pointless for us; we don't restrict keycodes like X does, and if someone writes e.g. maximum = 255 but only has 100 keys, we currently happily alloc all those empty keys. xkbcomp already handles the case when these statements aren't given, and uses a computed min/max instead. We should just always use that. (Of course since keycodes/evdev currently uses almost all of the keycodes in the range it declares, including 255, this doesn't save any memory for the common user right now). Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8862fd80 2012-09-13T11:49:02 keyseq: test that de(neo) is working properly 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>
Ran Benita 3abfe83e 2012-09-12T23:51:19 symbols: fix real/alias key merge ordering bug 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>
Ran Benita a9fa3739 2012-09-12T16:39:54 keymap-dump: don't write spaces between multiple-syms-per-level This can get a bit unwieldy. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone b4b40d73 2012-09-12T16:54:07 Copyright updates With Dan Nicholson's permission (via email), update his copyright and license statements to the standard X.Org boilerplate MIT license, as both myself and Ran have been using. Clean up my copyright declarations (in some cases to correct ownership), and add copyright/license statements from myself and/or Ran where appropriate. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 1aa6e2b1 2012-08-28T19:07:07 test/rules-file: add benchmark Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 480f919d 2012-08-29T11:54:05 test: add rmlvo-to-kccgst tool For a quick look at what components result from the rules. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 7f04ffc4 2012-08-29T12:10:28 rules: fix check for appending '|' character when applying There are two ways to separate multiple files in XKB include statements: '+' will cause the later file to override the first in case of conflict, while '|' will cause it augment it (this is done by xkbcomp). '!' is unrelated here. Since '|' is practically never used, this wasn't noticed. In the modified test, the '|some_compat' previously was just ignored. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 300f3fb1 2012-08-29T10:12:56 Don't printf NULL strings Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 2a026f6f 2012-08-28T15:55:35 test/data/symbols: keypad can only have one default section Avoids a warning, from xkeyboard-config: commit 6676053f2c93596c2aaa9905151a5c76355a1540 Author: Peter Hutterer <peter.hutterer@who-t.net> Date: Fri Jun 29 09:53:45 2012 +1000 symbols: keypad can only have one default section Warning: Multiple default components in keypad Using x11, ignoring pointerkeys Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f3c4032f 2012-08-30T20:23:35 Set log level for tests through env, not directly This way the test logs have all the information, but we don't get eye bleed every time we run them manually. One can always use TESTS_ENVIRONMENT (we correctly use AM_TESTS_ENVIRONMENT now), or set the envvars from the shell. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8d7d9792 2012-08-28T00:42:59 log: replace "priority" by "level" everywhere Now that we don't use syslog, "level" does sound more commonplace. We should change it while there is still nobody using it. Also leave some space between the integers of the xkb_log_level enum values, if we ever need to shove more in between. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 06d7803a 2012-08-30T12:13:37 state: fix mod_names_are_active This function was always returning -1. Adding a test, we see that test/state.c treat the is_active functions as returning booleans, which would treat -1 as success, so we test for > 0 instead (most users would probably get this wrong as well...). Also update the documentation for the are_active functions, and add a ATTR_NULL_SENTINEL for gcc __attribute__((sentinel)). Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9de067aa 2012-08-27T21:31:18 compat: ignore "group" (compatibility) statements Group compatibility statements are like the following: group 3 = AltGr; This currently results in: keymap->groups[2].mask = <real mod mapped from AltGr vmod> And we don't do any thing with this value later. The reason it exists in XKB is to support non-XKB clients (i.e. XKB support disabled entirely in the server), which do not know the concept of "group", and use some modifier to distinguish between the first and second keyboard layouts (usually with the AltGr key). We don't care about all of that, so we can forget about it. One artifact of this removal is that xkb_map_num_groups no longer works, because it counted through keymap->groups (this wasn't entirely correct BTW). Instead we add a new num_groups member to the keymap, which just hold the maximum among the xkb_key's num_groups. This also means we don't have to compute anything just to get the number of groups. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 16f2de8b 2012-08-14T16:26:30 compat: ignore "locking" field in sym interprets This field is used in conjunction with key behaviors, which we don't support since c1ea23da5. This is also unused in xkeyboard-config. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 7ef359de 2012-08-12T18:16:52 rulescomp: remove bad failtests Since we now handle empty model/layout, the last couple of tests should not fail. The reason they do is bacause they try to use a non-existent "base" rules file. When the file is brought in these tests do not fail. Since we already test for non-existent rules file, we can remove them, and refine the other tests a bit. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita cdc228ea 2012-08-13T11:00:43 Organize xkbcomp/ header files Various non-functional changes: - Re-add keycodes.h and move some stuff there. - Add parser-priv.h for internal bison/flex stuff. - Don't include headers from other headers, such that file dependencies are immediate in each file. - Rename xkbcomp.h -> ast.h, parseutils.{c,h} -> ast-build.{c,h} - Rename path.{c,h} -> include.{c,h} - Rename keytypes.c -> types.c - Make the naming of XkbFile-related functions more consistent. - Move xkb_map_{new,ref,unref} to map.c. - Remove most extern keyword from function declarations, it's just noise (XKB_EXPORT is what's important here). - Append XKBCOMP_ to include guards. - Shuffle some code around to make all of this work. Splitting this would be a headache.. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 3634b156 2012-08-14T11:49:19 Allocate xkb_component_names on stack Instead of malloc'ing it as well. Also improve the error handling. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 5a51ce8b 2012-08-09T01:55:30 Fix warning Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 2f1f1bca 2012-08-08T14:26:23 Add xkb_map_mod_mask_remove_consumed A fairly simple helper which, given an xkb_mod_mask_t, removes all modifiers which are consumed during processing of a particular key. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 5e276adb 2012-08-08T14:01:46 Add xkb_log_level enum rather than using syslog Instead of relying on people including syslog.h, add our own XKB_LOG_LEVEL_* defines. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone ba8458a9 2012-08-08T13:56:28 Increase log verbosity in tests Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 93f6517c 2012-08-03T04:07:33 stringcomp: Make test more punishing Recreate the old test/dump scenario, where we test the following map: - rules: evdev - model: pc104 - layout #1: us - layout #2: ru - layout #3: ca(multix) - layout #4: de(neo) This is ever so slightly altered from the xkbcomp output; running the following: setxkbmap -rules evdev -model pc105 -layout us,ru,ca,de -variant ,,multix,neo -print | xkbcomp -xkb - - will give you a map with RCTL added to the modifier_map for both Control and Mod3. Running the output through xkbcomp -xkb - - again, will give you RCTL only added to Mod3. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone e756e9b5 2012-08-03T04:02:31 test/dump: Remove superfluous test No longer necessary now we have stringcomp doing a full round-trip test for us. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone fb4d3aef 2012-08-03T04:01:21 test/stringcomp: Perform full round-trip test We now pass! \o/ Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 6701fb5f 2012-08-03T03:54:44 stringcomp: Remove unnecessary Level1 mappings As a map will implicitly go to level one unless explicitly mentioned otherwise, remove all explicit =Level1 mappings, except for those with preserve entries. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 6021a976 2012-08-03T03:45:14 test: Minimise includes Mostly from functions which used to use file functions directly, but now use test.h wrappers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 39da9274 2012-08-03T03:38:46 stringcomp: Update input file for output changes Bring the input file into line with recent changes to the dump output, so we're as close as we can get to a round trip. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone ce2e4899 2012-08-03T03:34:53 test: Add extremely rudimentary include path test Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 8fe2a484 2012-08-03T03:32:30 Rename xkey test to keysym Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 5cf4f510 2012-08-03T02:57:02 Staticise xkb_map_new_from_kccgst We didn't expose this to the outside world, and its only trivial user was xkb_map_new_from_rules. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 1eda9e44 2012-08-03T02:51:40 test: Use test_compile_*() in interactive Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 04253fb2 2012-08-03T02:51:10 Add support for default rules/model/layout Right now it just comes from build-time, but eventually this should be sourced from configuration files at runtime too. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 055b3034 2012-08-03T02:37:09 tests: Fix uninitialised-use-of-'ret' warning Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 3f016942 2012-08-03T02:36:40 test: Use test_get_context() in interactive Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 1a930bf2 2012-08-07T00:20:40 Add API to query whether a modifier is consumed Currently the user has no way of knowing which of the active modifiers have been used in the translation of a keycode to its keysyms. The use case is described in the GTK docs: say there's a menu accelerator activated by "<Alt>+". Some layouts have "+" shifted, and some have it on the first level. So in keymaps where "+" is shifted, the Shift modifier is consumed and must be ignored when the user is testing for "<Alt>+". Otherwise, we may get "<Alt><Shift>+" and the accelerator should not actually fire. For this we also use the preserve[] information in the key types, which can forces us to report modifiers as unconsumed even if they were used in the translation. Until now we didn't do anything with this information. The API tries to match its surronding. It's not very efficient but this can be fixed. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a681c624 2012-08-07T08:17:26 types: remove DeleteLevel1MapEntries If there is no map entry for some modifier combination, the default is to use level 1. The removed code is an optimization to save some space by removing these entries. But it doesn't actually save any space, and did not in fact remove all level 1 entries (it walks the array while modifying it so there's an off-by-one error). We can instead keep them in the types but just not print them in keymap-dump.c, to get about the same behavior. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita b0b11c4e 2012-08-02T00:29:07 types: don't use canonical/required types Xkb required every keymap to have at least the four following canonical types: ONE_LEVEL, TWO_LEVEL, ALPHABETIC, KEYPAD. This is specified in e.g. the kbproto spec and XkbKeyTypesForCoreSymbols(3) man page. If these types are not specified in the keymap, the code specifically checks for them and adds them to the 4 first places in the types array, such that they exist in every keymap. These are also the types (along with some non-required 4-level ones) that are automatically assigned to keys which do not explicitly declare a type (see FindAutomaticType in symbols.c, this commit doesn't touch these heuristics, whcih are also not very nice but necessary). The xkeyboard-config does not rely on the builtin xkbcomp definitions of these types and does specify them explicitly, in types/basic and types/numpad, which are virtually always included. This commit removes the special behavior: - The code is ugly and makes keytypes.c harder to read. - The code practically never gets run - everyone who uses xkeyboard-config or a keymap based upon it (i.e. everyone) doesn't need it. So it doesn't get tested. - It mixes policy with implementation for not very good reasons, it seems mostly for default compatibility with X11 core. - And of course we don't need to remain compatible with Xkb ABI neither. Instead, if we read a keymap with no types specified at all, we simply assign all keys a default one-level type (like ONE_LEVEL), and issue plenty of warnings to make it clear (with verbosity >= 3). Note that this default can actually be changed from within the keymap, by writing something like type.modifier = Shift type.whatever_field = value in the top level of the xkb_types section. (This functionality is completely unused as well today, BTW, but makes some sense). This change means that if someone writes a keymap from scratch and doesn't add say ALPHABETIC, then something like <AE11> = { [ q Q ]; }; will ignore the second level. But as stated above this should never happen. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9617b092 2012-08-05T12:03:51 filecomp: fix path and error message Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1d570a6d 2012-08-02T09:54:38 interactive: add support to run from keymap file This is useful for quickly testing a random keymap file. Use -k <PATH>. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita cfd978b8 2012-08-02T00:40:22 keyseq: use our own keysyms Instead of <X11/keysym.h> Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 4c212753 2012-04-08T02:20:39 Add an interactive evdev test The program reads key events from evdev input devices, puts them through the library and prints some information about them. It's nice for experimenting, quick testing and trying to break it with random stuff (already found some!). It is called "interactive" for lack of a better name. It's a bit hackish, but can easily be extended, made more portable etc, in the future. Signed-off-by: Ran Benita <ran234@gmail.com> Conflicts: Makefile.am test/.gitignore
Daniel Stone ca7927ae 2012-07-25T10:55:06 context test: Use test_get_context() So we don't die if we haven't got a valid global include path. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 89723b7c 2012-07-24T19:54:14 utils: add/replace string equality macros It's more tidy and less error prone, since we use strcasecmp == 0 a lot. We replace strcmp == 0 by streq, strcasecmp == 0 by istreq, uStrCasePrefix by istreq_prefix and uDupString by strdup_safe. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita c6279b8b 2012-07-23T21:21:03 expr: don't divide by zero Calculator parser 101. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 3dc1252d 2012-07-22T19:38:14 Add test for logging functionality Just to make sure everything works properly. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 81d029f5 2012-07-15T11:52:54 Replace xkb_keycode_t 'key' variable name by 'kc' We want to reserve the name 'key' for something else. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 9308a460 2012-07-17T10:20:15 Run source tree through uncrustify .uncrustify.cfg committed for future reference also, but had to manually fix up a few things: it really likes justifying struct initialisers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita a3378338 2012-07-13T17:10:48 remove unused function xkb_canonicalise_components commit 46441b1184dfa8553409d493ae6336aabb900d79 removed this from the public API, and we don't need it internally. So send it to the archives. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 3640e14d 2012-07-13T00:39:34 Add multiple-keysyms-per-level to test data Make sure this keeps on working. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone a19abd26 2012-07-13T00:32:41 rulescomp: Fix benchmark runs We'd accidentally inverted silent vs. non-silent compilation, which would skew the benchmark pretty badly, but also forgot to change base to evdev for the rules here. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone a77e9a92 2012-07-13T00:12:57 tests: Update dump.data for recent fixes Makes the test pass again. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita f0599675 2012-07-11T16:16:20 dump: add back kccgst names Readd the component names to the keymap->names struct. This is used when printing the component, e.g. xkb_keymap { xkb_keycodes "evdev+aliases(qwerty)" { instead of xkb_keymap { xkb_keycodes { This makes diffing against xkbcomp $DISPLAY a bit easier and is kind of useful anyway. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita fe5bfdf9 2012-07-11T16:35:43 dump: a few more tweaks to match xkbcomp output Only uppercase / lowercase stuff. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9e505225 2012-07-12T19:28:52 symbols: fix bug in modifier_map handling The code used to match a keysym to a keycode (see added comment) differed in behavior from xkbcomp, always taking the first key it found. This caused some incorrect interpretation of the xkeyboard-config data, for example the one corrected in dump.data (see the diff): since the de-neo layout sets the both_capslock option, the Left Shift key (LFSH) has the Caps_Lock keysym in group 4 level 2; now since keycode(Left Shift) = 50 < keycode(Caps Lock) = 64 the Left Shift one was picked, instead of the Caps Lock one which is group 1 level 1. The correct behavior is to pick according to group, level, keycode. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 62deaeb5 2012-07-12T14:42:31 Import dataset into test/data/ Use a self-contained dataset instead of relying on a globally-installed set. Data taken from xkeyboard-config 2.5.1. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 3e86ebca 2012-07-12T14:15:08 Add a library of common test functions Including creating a context (will come in useful soon), opening and reading files, and compiling keymaps. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 059c1842 2012-07-12T12:02:19 Move test data files to test/data/keymaps Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 1f492901 2012-07-11T18:00:31 Enlarge keysym name buffers and mention in comment The longest keysym is 27 chars long. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 01024259 2012-07-11T16:23:35 test/dump: output commentary to stderr Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 09d1445b 2012-07-11T14:12:12 keyseq: add a failing group-switching test 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>
Ran Benita 19f814f9 2012-07-11T14:08:28 rules: fix parsing of multiple options This was broken by commit 18d331b86b4942ba54fe087ca07e47c9383d768b (where only the first option out of a comma-separated string was matched). Do it correctly this time and add a test. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e201c165 2012-06-30T00:07:09 state: fix base mod set/clear behavior 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>
Ran Benita 37f43849 2012-06-30T00:49:41 rules: remove support for keymap rule This commit removes the ability to specify a keymap *in a rules file*, e.g. in /usr/share/X11/xkb/rules/evdev or somesuch. This is unused in xkeyboard-data, and the current code has never even supported it, because xkb_map_new_from_kccgst (which is no longer exposed in the API) checks to see that one of the usual components (e.g. symbols, types, ..) has been filled, while the rules parser, on the other hand, doesn't allow to specify a keymap and other stuff at the same time. ( The idea was to remove xkb_map_new_from_kccgst entirely, but it's used by a test so it can stay. ) tl;dr: dead code. Of course passing a keymap file to xkb_map_new_from_file still works. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 6d606d10 2012-06-22T15:29:47 state: Add more comprehensive repeating test Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 8e2c66e9 2012-06-22T15:27:05 Add xkb_key_repeats Does what it says on the box. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 0015604a 2012-04-10T21:20:27 Add a test for the results of key sequences 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>
Ran Benita 955ed8c4 2012-06-06T10:38:45 state: use darray for filters For the darray we need to specify the explicit struct xkb_filter type instead of void*, so we move the definition of struct xkb_state into state.c thus making it opaque even from the rest of the files. It has enough getters to get going and is otherwise good style. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita d0718e98 2012-06-05T17:48:08 test/dump: allow to run manually Without the srcdir envvar (and a couple trivial changes). Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1c27bb8e 2012-06-06T00:19:48 Update .gitignore Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 6992de40 2012-06-08T14:54:31 Add keypad sequences to UTF-8 keysym printing Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Rob Bradford e0524296 2012-06-08T13:10:28 Add API for getting unicode representation of a keysym This code uses a table and code derived from http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c The added API calls are: xkb_keysym_to_utf32 xkb_keysym_to_utf8 [daniels: Changed API to be more in line with keysym_get_name, added test, changed formatting to 4-space.]
Daniel Stone 77c909de 2012-06-04T16:16:20 Fix tiny memory leak in dump test We forgot to free the path we'd allocated with asprintf. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 0f09c307 2012-06-04T13:27:41 Make xkb_map_get_as_string test more comprehensive Add a test/dump.data file which contains the result we're expecting from xkb_map_get_as_string run on a particularly complex set of keymaps, and assert that the string representations are the same. This means that any updates to xkb_map_get_as_string will also need to update the test data, but should also ensure that we don't have any more parser regressions. Compared with diff to the output of setxkbmap + xkbcomp for the same keymap; seems completely solid. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 64c277d9 2012-06-04T13:08:01 Revert "dump" (Ahem.) This reverts commit f43f75fb83e94224000ebc6b0736182546781c5e.
Daniel Stone f43f75fb 2012-06-02T15:29:21 dump
Daniel Stone c87468e9 2012-05-29T16:15:07 stringcomp: NULL-terminate string Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 243daf80 2012-05-29T15:08:35 Add test for xkb_map_new_from_string Using data from xkb_map_get_as_string. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone ebd397e1 2012-05-25T17:05:39 Add xkb_map_get_as_string Returns a newly-allocated string representing the specified keymap. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 869c6871 2012-05-19T02:35:15 rules: add test Add a non-extensive test to check that some basic things (e.g. rule matching, var substitution, indexes and groups) work as expected. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita beccc375 2012-05-18T18:09:50 Don't run the benchmark by default For people running 'make check' on every compilation, this can be a nuisance. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita b89b8e70 2012-05-13T23:31:59 Change xkb_map_new_from_fd to use FILE* i.e. xkb_map_new_from_file. The reason is that flex only works with FILE's, so we must use fdopen on the file descriptor; but to avoid a memory leak, we must also fclose() it, which, in turn, closes the file descriptor itself. Either way is not acceptable, so we can either: * dup() the fd and use fdopen on that, or * have the user call fdopen on his own, and accept a FILE* instead of an fd. The second one seems better, and is standard C, so why not. We must add stdio.h to xkbcommon.h though, which is regrettable, but not a big deal. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 661cb840 2012-05-18T00:56:36 Add benchmarking test to rulescomp Apparently it only takes us 8ms to build keymaps. Nice! Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 7b00485a 2012-05-11T15:03:43 Rename 'ctx' back to 'context' in external API Still keep things as 'ctx' internally so we don't have to worry about typing it too often, but rename the user-visible API back as it was kinda ugly. This partially reverts e7bb1e5f. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 46441b11 2012-05-09T20:49:04 Move KcCGST API to internal-only And don't export it. We don't need it for X11 support, let alone anything else. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 2761b1a3 2012-05-09T20:20:12 Rename serialise to serialize Yes, British English is correct, but unfortunately we've lost that battle. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 5a3771d1 2012-05-09T20:18:30 Add common LED names to xkbcommon-names.h Signed-off-by: Daniel Stone <daniel@fooishbar.org>