test


Log

Author Commit Date CI Message
Peter Hutterer 2eb5d2c8 2020-06-23T16:06:10 test: simplify error handling in interactive-evdev Passing -errno around and having separate labels depending on failure types is superfluous here. All the unref calls can handle NULL and nothing cares about errno once we're out of the immediate scope. So let's simplify this and deal with 0 and 1 only. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 725a3198 2020-06-22T13:08:51 test: how-to-type: prefer local headers over system ones Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 928771ed 2020-06-22T13:17:47 test: untangle rmlvo-to-kccgst from the test headers Using test helpers to init the context gives it fairly specific behavior; unless the user sets the right environment variables and/or calls it from the right PWD, it may or may not include the test data. Let's drop this behavior, make it a default tool to compile a keymap. If there is a specific need to modify the include paths, we can add this later. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer ec2bbe59 2020-06-22T13:07:46 Move the various tools to a tools/ directory Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer e5d4056e 2020-06-22T13:04:43 test: untangle print-compiled-keymap from the test headers Commit 16c84cdd819db516fff089c76b99248fb7dd4e8c removed the getopt handling for RMLVO arguments, so now this tool only takes a keymap file and compiles it. Using test helpers to init the context gives it fairly specific behavior; unless the user sets the right environment variables and/or calls it from the right PWD, it may or may not include the test data. Let's drop this behavior, make it a default tool to compile a keymap. If there is a specific need to modify the include paths, we can add this later. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 7d1aefdd 2020-06-22T13:01:41 test: simplify an exit path The unref() functions take NULL as argument, so we don't need different labels for every possible exit path. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita 860cfc03 2020-04-05T00:07:57 keymap: don't forget about fallback mappings in xkb_keymap_key_get_mods_for_level() If the active set of modifiers doesn't match any explicit entry of the key type, the resulting level is 0 (i.e. Level 1). Some key types don't explicitly map Level 1, taking advantage of this fallback. Previously, xkb_keymap_key_get_mods_for_level didn't consider this, and only reported masks for explicit mappings. But this causes some glaring omissions, like matching "a" in the "us" keymap returning not results. Since every mask which isn't explicitly mapped falls back to 0, we can't return the all. Almost always the best choice for this is the empty mask, so return that, when applicable. Fixes https://github.com/xkbcommon/libxkbcommon/issues/140. Reported-by: https://github.com/AliKet Signed-off-by: Ran Benita <ran@unusedvar.com>
Nils 0f1cae0c 2020-03-25T08:43:41 test: use flag instead of hardcoded value in examples
Ran Benita 8a1709a4 2020-03-21T12:56:13 test/how-to-type: some code fixes/improvements Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 188a1c79 2020-03-20T18:29:03 test: add "how to type" demo program The program takes a unicode codepoint and an RMLVO and prints out all key + modifier combinations that would result in that codepoint. The program was written to exercise the new xkb_keymap_key_get_mods_for_level() function. It's handy and can be extended in several ways, but enough for now. Example: $ ./build/how-to-type -l us,il,ru 0x41 | column -ts $'\t' keysym: A (0x41) KEYCODE KEY NAME LAYOUT# LAYOUT NAME LEVEL# MODIFIERS 38 AC01 1 English (US) 2 [ Shift ] 38 AC01 1 English (US) 2 [ Lock ] 38 AC01 2 Hebrew 2 [ Shift ] 38 AC01 2 Hebrew 2 [ Lock ] $ ./build/how-to-type -l de -v neo 0x3b6 | column -ts $'\t' keysym: Greek_zeta (0x7e6) KEYCODE KEY NAME LAYOUT# LAYOUT NAME LEVEL# MODIFIERS 56 AB05 1 German (Neo 2) 4 [ Shift Mod5 ] 56 AB05 1 German (Neo 2) 4 [ Shift Mod2 Mod3 Mod5 ] 56 AB05 1 German (Neo 2) 4 [ Shift Lock Mod5 ] 56 AB05 1 German (Neo 2) 4 [ Lock Mod2 Mod3 Mod5 ] Signed-off-by: Ran Benita <ran@unusedvar.com>
Jaroslaw Kubik d92a248c 2020-02-05T17:42:06 API to query modifier set required to type a keysym The new API is useful to implement features like auto-type and desktop automation. Since the inputs for these features is usually specified in terms of the symbols that need to be typed, the implementation needs to be able to invert the keycode->keysym transformation and produce a sequence of keycodes that can be used to type the requested character(s).
Jaroslaw Kubik 0345aba0 2020-02-12T23:44:42 Support translation Unicode codepoints to keysyms In order to support features like auto-type and UI automation, the relevant tools need to be able to invert the keycode->keysym->text transformation. In order to facilitate that, a new API was added. It allows querying the keysyms that correspond to particular Unicode codepoints. For all practical purposes, it can be thought of as an inverse of xkb_keysym_to_utf32().
Adrian Perez de Castro abb2f9d9 2019-08-05T15:44:33 MSVC: Provide implementations of test_{dis,en}able_stdin_echo This provides implementations of the test_enable_stdin_echo and test_disable_stdin_echo which do not require <termios.h>, which is not available on Windows.
Adrian Perez de Castro 5354dee2 2019-08-05T13:52:18 MSVC: Use <io.h> as an alternative for <unistd.h> Only the input/output functions from <unistd.h> options are used, so using <io.h> when building with MSVC should be enough. The inclusion of the header in context-priv.c does not seem to be needed (tested on GNU/Linux) and so it is removed. Signed-off-by: Ran Benita <ran@unusedvar.com>
Adrian Perez de Castro f1186acf 2019-08-05T15:53:04 MSVC: Provide implementations of [un]setenv() Reference: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-s-wputenv-s
Ran Benita faac4ba7 2019-12-28T15:52:20 test/data: ensure files are checked out with LF, not CRLF The tests stringcomp and buffercomp do binary comparison on some files; if the files are changed to CRLF on checkout, the tests fail. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita d1e39c11 2019-12-28T14:11:27 test/atom: use correct format specifier for size_t From MSVC: test\atom.c(98): note: consider using '%zu' in the format string test\atom.c(98): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(100): note: consider using '%zu' in the format string test\atom.c(100): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(114): note: consider using '%zu' in the format string test\atom.c(114): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(128): note: consider using '%zu' in the format string test\atom.c(128): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(130): note: consider using '%zu' in the format string test\atom.c(130): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t' test\atom.c(137): note: consider using '%zu' in the format string test\atom.c(137): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 2 has type 'size_t' Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita da4a90c1 2019-12-28T13:49:40 Open files in binary mode This turns off some misfeatures on Windows, and does nothing on POSIX. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita fe417d84 2019-12-28T13:40:38 test/common: avoid double // in path Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita eb23982c 2019-12-28T13:32:02 test/common: simplify test_get_path() Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita f967d46b 2019-12-27T15:47:15 test/context: use a more portable directory-exists check MSVC doesn't have opendir/closedir. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 670566f0 2019-12-27T15:03:10 Only add GCC diagnostic pragmas when compiler is GCC compatible Avoid "unknown pragma" warnings on other compilers. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 40aab05e 2019-12-27T13:03:20 build: include config.h manually Previously we included it with an `-include` compiler directive. But that's not portable. And it's better to be explicit anyway. Every .c file should have `include "config.h"` first thing. Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer ca033a29 2019-09-03T11:23:14 rules: add include statements to rules files The majority use-case for extending XKB on a machine is to override one or a few keys with custom keycodes, not to define whole layouts. Previously, we relied on the rules file to be a single file, making it hard to extend. libxkbcommon parses $XDG_CONFIG_HOME/xkb/ but that only works as long as there is a rule that matches the user-specified RMLVO. This works for MLV but not for options which don't have a wildcard defined. Users have to copy the whole rules file and then work from there - not something easy to extend and maintain. This patch adds a new ! include directive to rules files that allows including another file. The file path must be without quotes and may not start with the literal "include". Two directives are supported, %H to $HOME and %S for the system-installed rules directory (usually /usr/share/X11/xkb/rules). A user would typically use a custom rules file like this: ! option = symbols custom:foo = +custom(foo) custom:bar = +custom(baz) ! include %S/evdev Where the above defines the two options and then includes the system-installed evdev rule. Since most current implementations default to loading the "evdev" ruleset, it's best to name this $XDG_CONFIG_HOME/xkb/rules/evdev, but any valid name is allowed. The include functionally replaces the line with the content of the included file which means the behavior of rules files is maintained. Specifically, custom options must be defined before including another file because the first match usually wins. In other words, the following ruleset will not assign my_model as one would expect: ! include %S/evdev ! model = symbols my_model = +custom(foo) The default evdev ruleset has wildcards for model and those match before the my_model is hit. The actual resolved components need only be in one of the XKB lookup directories, e.g. for the example above: $ cat $XDG_CONFIG_HOME/xkb/symbols/custom partial alphanumeric_keys xkb_symbols "foo" { key <TLDE> { [ VoidSymbol ] }; }; partial alphanumeric_keys xkb_symbols "baz" { key <AB01> { [ k, K ] }; }; This can then be loaded with the XKB option "custom:foo,custom:bar". The use of "custom" is just as an example, there are no naming requirements beyond avoiding already-used ones. Also note the bar/baz above - the option names don't have to match the component names. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 1de2f174 2019-11-13T13:42:11 test: let rmlvo-to-kccgst take long options like rmlvo-to-keymap The short options were left for backwards compatibility. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita c79c8033 2019-11-09T21:25:01 atom: combine atom_intern() and atom_lookup() Use an "add" bool parameter instead. This simplifies the code a bit. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 2a615593 2019-11-08T22:40:13 test/atom: increase iteration count and print random seed on failure Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 2af474e8 2019-11-02T13:31:44 parser: get rid of "stealing" atoms This requires (well, at least implemented by) casting away `const` which is undefined behavior, and clang started to warn about it. The micro optimization didn't save too many allocations, anyway. Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer 31e561fc 2019-11-05T13:33:11 test: remove a superfluous string-is-null check A few lines above we check path_rel[0], so any null pointer will blow up before we get here. Found by coverity Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 96ef14ac 2019-11-05T13:22:49 test: fix a potential memory leak Found by coverity Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita 3515ba19 2019-11-01T10:45:43 test: xkeyboard-config: bring back the progress bar Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer 8f93e22a 2019-11-01T18:41:16 test: xkeyboard-config: invoke the python3 command (#120) python3 is always python3, but python could be python2 in some cases. Or just missing (e.g. RHEL8). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 0609073c 2019-11-01T11:09:16 test: xkeyboard-config: add missing variant tests Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer f4a0f738 2019-11-01T09:54:29 test: xkeyboard-config: use universal_newlines instead of decode This way stdin/stdout of the process are opened in text mode and we don't need manually decode. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 7832cc72 2019-10-30T12:03:48 test: xkeyboard-config: flake8 fixes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer cd5a24aa 2019-10-30T11:22:49 test: xkeyboard-config: handle keyboard interrupts correctly In python multiprocessing, each process needs to handle (and ignore) the KeyboardInterrupt to avoid exception logging. This is a separate patch for easier reviewing, the first hunks merely re-indent all of the xkbcommontool/xkbcomp functions into a try/except KeyboardInterrupt block. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 9fc0cb87 2019-10-30T10:53:58 test: xkeyboard-config: print to stderr on failure, stdout otherwise This is a change in behavior and requires any automated callers to adjust accordingly. Still, much easier to get the errors that way rather than it being mixed into a thousands-of-lines output file. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer f5383847 2019-10-29T16:06:10 test: xkeyboard-config: add a multiprocessing.Pool() to speed up the test Collect all options into a dictionary, then process that as async actions through a process pool. This of course requires collecting the various print statements to avoid mangled output. This dropped the time to completion from around 14 min to 8 min on my local machine (unscientific single run only for the original timing). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 1e131906 2019-10-30T11:15:49 test: xkeyboard-config: use argparse for the path and the tool selection Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 255200fa 2019-10-28T11:40:56 test: add test for the various default include paths All tests create a temporary directory, set up the environment for that directory and then check the include paths for the presence of that directory, ideally in the right position of the list. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita 45496c33 2019-10-19T00:37:48 test: fix printf("%s", NULL) in error path ../test/common.c: In function ‘test_get_path’: ../test/common.c:171:9: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 171 | fprintf(stderr, "Failed to allocate path (%d chars) for %s\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 172 | (int) path_len, path); | ~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 076047b2 2019-10-16T10:32:19 keymap-dump: use consistent capitalization for "Group<N>" It's used capitalized everywhere except a couple places. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita a6ed0304 2019-10-16T10:27:12 keymap-dump: fix invalid names used for levels above 8 xkbcomp only accepts the "Level" prefix for a level name for levels 1 to 8, but the keymap dumping code added it always, e.g. "Level15". The plain integer, e.g. "8", "15" is always accepted, so just use that. Fixes https://github.com/xkbcommon/libxkbcommon/issues/113 Signed-off-by: Ran Benita <ran@unusedvar.com> Reported-by: progandy
Ran Benita ab4b4b7f 2019-07-25T10:12:53 travis: improve configuration and add macOS Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 7407d311 2019-07-25T13:49:41 test/symbols-leak-test: fix sed regex on macOS Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 97f41fe4 2019-07-25T13:24:00 test/symbols-leak-test: make it work with macOS diff The <() stuff fails with an error: diff: extra operand `/dev/fd/61' Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 6728ebca 2019-07-25T11:59:07 test/rmlvo-to-keymap: drop basename usage It wants some libgen.h include which is POSIX only, let's just remove it as it's hardly important. Signed-off-by: Ran Benita <ran234@gmail.com>
worldofpeace 32d178b5 2019-07-19T02:56:41 test/rmlvo-to-keymap.c: fix compilation on Darwin (#101) program_invocation_short_name isn't portable.
Daniel Stone 909cc04d 2019-07-02T13:48:32 interactive-wayland: Port to stable xdg-shell (#100) xdg_shell v6 was pretty close to the finalised stable version of xdg-shell. We can now just use the stable version, which is supported everywhere (Enlightenment, KWin, Mutter, Weston, wlroots). This requires bumping the wayland-protocols dependency. Signed-off-by: Daniel Stone <daniels@collabora.com>
Peter Hutterer 878bc085 2018-08-20T16:46:19 test: allow for absolute paths to be resolved This makes it possible to check a keymap sitting elsewhere than in the test directory. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 16c84cdd 2018-08-20T15:50:35 test: drop the rmlvo ability from print-compiled-keymap This is now handled by the rmlvo-to-keymap tool Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer d1cb8ad4 2018-08-14T11:16:30 test: add a tool to test-compile all LVO combinations from xkeyboard-config This test contains of two parts: - a simple program to convert RMLVO commandline arguments into a keymap (and print that keymap if requested). - a python script that runs through rules/evdev.xml, and tries to compile a keymap for sort-of every layout/variant/option combination. Sort-of, because we can have multiple options and it really only does one per layout(variant) combination. Same thing can be done using xkbcomp, but right now it doesn't take that as argument, it's hard-coded. This takes quite a while, installing python-tqdm is recommended to see fancy progress bars instead of just miles of dumps. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita 5cee660f 2018-06-23T22:00:19 keysym-utf: reject out-of-range Unicode codepoints in xkb_keysym_to_utf{8,32} It used to be UTF-8 was defined for inputs > 0x10FFFF, but nowadays that's the maximum and a codepoint is encoded up to 4 bytes, not 6. Fixes: https://github.com/xkbcommon/libxkbcommon/issues/58 Fixes: https://github.com/xkbcommon/libxkbcommon/issues/59 Reported-by: @andrecbarros Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita afea3dd0 2018-01-27T20:42:44 test/interactive-wayland: replace tabs with spaces Match the style of all other files. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 767fa86d 2017-12-21T14:18:07 Convert http:// -> https:// where possible Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 29998c25 2017-12-12T15:57:58 test/x11: properly clean up also when skipping test To make valgrind happy. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 6456835f 2017-12-03T13:04:35 test/data: sync with xkeyboard-config 2.22 Some tweaks to the de(neo) keyseq tests were required. It seems to have improved. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 14686cd1 2017-08-16T20:24:27 test/interactive-wayland: avoid unused function warning due to configuration test/interactive-wayland.c:95:1: warning: ‘set_cloexec_or_close’ defined but not used [-Wunused-function] Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita fbd86e44 2017-08-03T13:38:14 test/symbols-leak-test.bash: make it easier to read Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 4309735d 2017-07-31T11:24:28 build: use top_srcdir consistently Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita d44ba481 2017-07-29T22:43:08 build: remove unneeded preprocessor include flags Better to avoid these unexpected include paths. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita daebdb5e 2017-07-31T10:18:54 x11/keymap,test/interactive-evdev: fix a couple of clang-analyzer warnings From my analysis these values cannot be null, but the analyzer cannot see this. So assert it. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 2d964065 2017-07-29T23:31:19 test/x11comp: fix compiler warnings Signed-off-by: Ran Benita <ran234@gmail.com>
Naman Dixit 4f17fc60 2017-05-27T09:15:26 Fixed a minor bug in error detection in Wayland test
Ran Benita c9832d43 2017-04-28T09:33:25 test/interactive-x11: handle NULL from xcb_wait_for_event Can happen in cases like: - There was an error between the error check and the call. - The internal poll() fails. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 5d821aed 2017-04-11T20:19:15 test/x11comp: be a bit more careful with kill() We did it correctly but better be safe and appease clang. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9d941458 2017-04-11T20:39:10 test/interactive-wayland: mark a local function static Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 03f4a03e 2017-04-11T20:06:01 test/interactive-wayland: handle unrecognized SHM format The enum seems large, and we don't handle all of the values in it. Previously if we got an unrecognized SHM format we would use an uninitialized `stride`. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 0f43cfa2 2017-04-11T20:01:19 test/interactive-wayland: fix uninitialized `ret` in error path Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 90bd9fdb 2017-04-11T15:09:50 interactive-wayland: Port to xdg-shell v6 Mutter only implements v6 now, and Weston also implements that. Port interactive-wayland to this so people can keep on using it. Signed-off-by: Daniel Stone <daniels@collabora.com>
Ran Benita b5586a6c 2016-12-02T22:15:19 keysym: fix locale dependence in xkb_keysym_from_name() We currently use strcasecmp, which is locale-dependent. In particular, one well-known surprise even if restricted just ASCII input is found in the tr_TR (Turkish) locale, see e.g. https://msdn.microsoft.com/en-us/library/ms973919.aspx#stringsinnet20_topic5 We have known to avoid locale-dependent functions before, but in this case, we forgot. Fix it by implementing our own simple ASCII-only strcasecmp/strncasecmp. Might have been possible to use strcasecmp_l() with the C locale, but went the easy route. Side advantage is that even this non-optimized version is faster than the optimized libc one (__strcasecmp_l_sse42) since it doesn't need to do the locale stuff. xkb_keysym_from_name(), which uses strcasecmp heavily, becomes faster, and so for example Compose file parsing, which uses xkb_keysym_from_name() heavily, becomes ~20% faster. Resolves https://github.com/xkbcommon/libxkbcommon/issues/42 Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita babc9e0c 2016-02-27T22:31:16 state: add GTK consumed modifiers mode This is more or less what is implemented here: https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkkeys-x11.c?h=3.19.10#n1131 The implementation here is more technically correct but should provide the same results. Try it out with ./test/interactive-evdev -g (modifiers prefixed with "-" are consumed). https://bugzilla.gnome.org/show_bug.cgi?id=754110 https://github.com/xkbcommon/libxkbcommon/issues/17 Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a0a41332 2016-02-27T19:06:14 state: allow different modes for calculating consumed modifiers The current functions dealing with consumed modifiers use the traditional XKB definition of consumed modifiers (see description in the added documentation). However, for several users of the library (e.g. GTK) this definition is unsuitable or too eager. This is exacerbated by some less-than-ideal xkeyboard-config type definitions (CTRL+ALT seems to cause most grief...). So, because we - want to enable alternative interpretations, but - don't want to expose too much internal details, and - want to keep things simple for all library users, we add a high-level "mode" parameter which selects the desired interpretation. New ones can be added as long as they make some sense. All of the old consumed-modifiers functions keep using the traditional ("XKB") mode. I mark xkb_state_mod_mask_remove_consumed() and as deprecated without adding a *2 variant because I don't it is very useful (or used) in practice. Alternative modes are added in subsequent commits (this commit only adds a mode for the existing behavior). https://github.com/xkbcommon/libxkbcommon/issues/17 Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 914c060a 2016-10-22T20:13:11 test/state: move wrongly-placed assert Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8978ec39 2016-06-09T17:23:55 test/interactive-wayland: fix control reaches end of non-void function AFAICS there is nothing that can fail directly in this function, so change it to void. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 81ee012a 2016-06-09T14:52:34 test/symbols-leak-test: use more portable shebang Some BSDs don't want to give bash the honor of /bin and put it elsewhere. So look it up in PATH instead. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 316c7e24 2016-05-05T15:43:59 test/interactive-wayland: don't ignore asprintf return value Fixes warn_unused_result warning. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita fc41d3d6 2016-05-05T15:41:13 test: use termios instead of system() for disabling terminal echo Takes care of GCC's annoyingly persistent warn_unused_result warnings. But it's better to avoid system() I suppose. Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 48d5b44f 2016-04-12T13:19:25 interactive-wayland: Valgrind-proofing More meticulously free everything we create, including hooking up the buffer-release callback so we actually free those when required. Make sure seats are actually in the display's seat list. The xkbcommon object-unref functions don't actually require NULL-checking, so we can elide those. Signed-off-by: Daniel Stone <daniels@collabora.com>
Daniel Stone 7e123a10 2016-04-12T12:03:32 test: Add interactive-wayland interactive-wayland is very similar to x11/xev, and dumps out as much state as possible. It provides no titlebar and a completely random cursor, but such is life. Signed-off-by: Daniel Stone <daniels@collabora.com>
Ran Benita 4c24f7fa 2016-03-15T20:42:21 test: assert/ignore some warn_unused_result's Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 37ee8e65 2016-03-13T22:56:48 test/x11comp: fix memory leak Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita fa1b4543 2016-03-13T20:56:58 test: add a test that all symbol version file is updated It is easy to forget to update these files when adding new symbols. Stolen with slight changes from libinput (commit by Marek Chalupa): https://cgit.freedesktop.org/wayland/libinput/commit/?id=a9f216ab47ea2f643f20ed741b741a2b5766eba3 Signed-off-by: Ran Benita <ran234@gmail.com>
Mike Blumenkrantz 0ce17ef3 2016-01-20T11:40:43 keymap: add xkb_keymap_key_by_name(), xkb_keymap_key_get_name(), tests xkb_keymap_key_by_name() allows finding a keycode from a given keyname and is useful for generating keyboard events to use in regression tests during CI xkb_keymap_key_get_name() is the inverse of xkb_keymap_key_by_name() Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com> [ran: some stylistic tweaks + another test case] Signed-off-by: Ran Benita <ran234@gmail.com>
Kazunobu Kuriyama 91a19905 2015-08-24T13:44:20 test/x11comp: Fix contention between X11 and Xvfb on Mac OS X - Abandon use of -displayfd. - Have x11comp itself look for an unused X11 display number instead.
Ran Benita 74f85d05 2015-08-23T23:02:10 test/x11comp: remove duplicate FOUR_LEVEL_KEYPAD from test keymap The `test/data/keymaps/host.xkb` file contains a duplicate definition of this type. On my computer (linux, xkbcomp 1.3.0, xserver 1.17.2), the test passes as is, but if I remove the duplicate definition, the roundtrip brings it back and the test fails. I can also reproduce it without relation to the test, by loading `test/data/keymaps/host.xkb` (without the duplicate) using xkbcomp -I $(pwd)/test/data/keymaps/host.xkb $DISPLAY and downloading it again using xkbcomp $DISPLAY out.xkb the duplicate is added. On Mac OS X however, the duplicate is removed (correctly), so the test fails there. xkbcommon itself, which was forked from xkbcomp, doesn't have this bug; in fact, doing ./test/print-compiled-keymap -k keymaps/host.xkb removes the duplicate if it is present. This is (probably) a regression in xkbcomp or xserver compared to the versions used in Mac OS X. Since getting a patch for any of these two is hopeless from my experience, I did not try to investigate further. I am not sure why, but if I also add a `PC_SUPER_LEVEL2` type, the duplicate of `FOUR_LEVEL_KEYPAD` doesn't show up. Hopefully the test will work on all platforms now. https://github.com/xkbcommon/libxkbcommon/issues/26 Reported-by: @nuko8 Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita bdf68803 2015-08-23T22:22:11 test/x11comp: small simplifications xkbcomp doesn't need the search-path argument, since we pass an absolute path. Keep the plain -I which clears the search path just to be sure. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8e1fed6c 2015-03-24T16:40:29 compose: correctly parse modifier syntax As described in: http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=ddf3b09bb262d01b56fbaade421ac85b0e60a69f Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 74482de6 2015-02-03T20:50:52 test/common: print keycode in decimal not hex Keycodes are usually written in decimal, so hex is hard to compare. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a0d2b029 2014-10-17T01:14:57 test/keyseq: test 'map[None] = Level2;' scenario See previous commit for an explanation. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 312182ce 2014-10-16T17:55:46 test/data: add files for model=applealu_ansi layout=us Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita c6ee6371 2014-10-16T17:48:00 test/data: sync to xkeyboard-config 2.13 (Run ./test/data/sync.sh). Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita c42b8646 2014-10-14T11:47:25 test/compose: test include statement Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 3f489730 2014-10-14T10:53:38 test/compose: test modifier syntax Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 5cefa5c5 2014-01-29T13:46:42 test/interactive-evdev: add compose support To try, do e.g.: sudo ./test/interactive-evdev -l us -v intl -o compose:ralt -d Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 10a7a2bd 2013-10-27T20:37:27 test/compose: add new test Some results from the benchmark (compilation of en_US.UTF-8/Compose): $ grep 'model name' /proc/cpuinfo model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz $ uname -a Linux ran 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14 07:40:19 CEST 2014 x86_64 GNU/Linux $ ./test/compose bench compiled 1000 compose tables in 7.776488331s So according to the above benchmark and valgrind --tool=massif, an xkb_compose_table adds an overhead of about ~8ms time and ~130KB resident memory. For contrast, a plain US keymap adds an overhead of ~3ms time and 90KB resident memory. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita bc3b4c08 2014-10-02T22:03:28 Move benchmarks from tests to their own files in bench/ The tests only contain tests, and the benchmarks are more visible. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 68962aa1 2014-09-21T23:54:34 keymap-dump: combine modifier_map's with the same modifier A bit less efficient, but makes for shorter, nicer output. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 24846080 2014-09-11T14:08:12 test/keyseq: add test Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a931740c 2014-09-10T13:29:52 keycodes: fix keymap compilation with no aliases and malloc(0)==NULL If the keymap doesn't have any key-aliases (which is certainly possible), the calloc(num_key_aliases, ...) is allowed to return NULL according to the C standard, but this is not an error. Signed-off-by: Ran Benita <ran234@gmail.com>