test


Log

Author Commit Date CI Message
Pierre Le Marre fe9cd66f 2023-09-18T13:17:30 Test: Enable x11comp and use the xvfb wrapper This test was previously disabled in 914e84e0188b5fbd67855f38f4499bb1412f4516. Note that it requires a recent version of xkeyboard-config to succeed.
Pierre Le Marre 26b1a076 2023-09-18T13:17:17 Test: Use a xvfb wrapper for x11 test The x11 test is currently silently skipped in CI, because it requires a running X server. Create a xvfb wrapper to run the test. We do not use `xvfb-run`, because it is a shell script and it causes valgrind to detect unrelated memory issues in the shell (dash, bash). Improve wrapper using a special ELF section TODO: The wrapper is intended to be used with the x11comp test as well.
Pierre Le Marre 26642772 2023-09-18T13:17:31 Test: Catch SIGUSR1 from Xvfb for X11 tests Based on the work done by Peter Hutterer. Original commit message: If SIGUSR1 is set to SIG_IGN, X servers (all of them, including Xvfb) will send that signal to the parent process when they're ready to accept connections. We can use that instead of a hardcoded sleep which brings the wait down to ~37ms on my box.
Pierre Le Marre a4c08526 2023-07-04T09:23:24 Improved tests related to keysyms - Add a keymap test with decimal and hexadecimal keysyms. - Reorganize code in `test/keysym.c` by parsing type: name, Unicode and hexadecimal. - Add more tests for edge cases. In particular: - test decimal format (currently not supported); - test the Unicode and hexadecimal ranges more thoroughly; - test with wrong case without the XKB_KEYSYM_CASE_INSENSITIVE flag; - test surrounding spaces. - Document the tests.
Pierre Le Marre 0d01a933 2023-07-04T09:34:08 Replace keycode numeric offset with EVDEV_OFFSET Add a constant `EVDEV_OFFSET` to make the semantic of the offset clearer.
Pierre Le Marre fc25e0f0 2023-06-26T12:19:49 Test(compose): fix assumption on environment variables The test `test_from_locale` fails when there is a user-defined compose file, e.g. ~/.XCompose. Indeed, the function `xkb_compose_table_new_from_locale` use various environment variables to determine the location of the compose file. Ensure no environment variables but the required ones are set, in order to have robust tests.
Pierre Le Marre 183761ac 2023-05-13T17:26:24 Do not interpret nor emit invalid Unicode encoding forms Surrogates are invalid in both UTF-32 and UTF-8. See https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf#G28875 and https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf#G31703
Peter Hutterer b06aedb8 2023-05-02T14:15:55 scanner: allow for a zero terminated string as keymap As the documentation for xkb_keymap_new_from_buffer() states, the "input string does not have to be zero-terminated". The actual implementation however failed with "unrecognized token/syntax error" when it encountered a null byte. Fix this by allowing a null byte at the last position of the buffer. Anything else is likely a client error anyway. Fixes #307
Wismill 5b5b67f2 2023-05-01T22:30:41 Add support for modmap None (#291) Unlike current xkbcommon, X11’s xkbcomp allows to remove entries in the modifiers’ map using “modifier_map None { … }”. “None” is translated to the special value “XkbNoModifier” defined in “X11/extensions/XKB.h”. Then it relies on the fact that in "CopyModMapDef", the following code: 1U << entry->modifier ends up being zero when “entry->modifier” is “XkbNoModifier” (i.e. 0xFF). Indeed, it relies on the overflow behaviour of the left shift, which in practice resolves to use only the 5 low bits of the shift amount, i.e. 0x1F here. Then the result of “1U << 0xFF” is cast to “char”, i.e. 0. This is a good trick but too magical, so in libxkbcommon we will use an explicit test against our new constant XKB_MOD_NONE.
Ran Benita bd79a960 2023-04-11T23:24:47 Possible fix for non-MSVC windows compilers `_MSC_VER` is specific to MSVC, but there can be other compilers targeting windows. Hopefully they do define `_WIN32`, so let's use that. Refs: https://github.com/xkbcommon/libxkbcommon/issues/305 Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita f9858bf5 2022-09-24T10:27:51 test: move mkdir & mkdtemp calls to common place and fix them on MSVC Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 4d829390 2022-09-24T10:37:06 utils: move some MSVC compat stuff to common place Signed-off-by: Ran Benita <ran@unusedvar.com>
Sam Lantinga 25367130 2022-04-27T18:45:54 Remove bogus euro sign entry from keysymtab Not sure what it's doing here, but converting "€" to a keysym doesn't work with this entry. 0x13a4 doesn't appear in xkbcommon-keysyms.h. 0x20ac is the keysym documented in the header (and it's the last entry in the table). It's been in the table since it was introduced in e0524296d2e0 ("Add API for getting unicode representation of a keysym"). Co-authored-by: Simon Ser <contact@emersion.fr>
Weng Xuetian b064b609 2022-05-14T01:11:32 Do not clear sibling entries when override. lokid and hikid actually stores the sibling to current node, which should not be cleared when override. This would break the sequence with a common prefix when override another. Fix #286 Signed-off-by: Weng Xuetian <wengxt@gmail.com>
Peter Hutterer 1c8ef9e0 2022-01-24T11:13:06 test: add test for variant inheritance of ISO 639/3166 codes See efa99624320f54e6e1ff24e4c4b1fcecdfba43d5
M Hickford efa99624 2022-01-24T02:16:08 Variants should inherit iso639, iso3166 and brief from parent layout if omitted (#266)
Peter Hutterer 9b05825e 2022-01-20T13:08:36 registry: skip over invalid ISO639 or ISO3166 entries If the XML file is somehow off, don't load entries that are against the spec.
Peter Hutterer 34ef11d9 2022-01-20T14:17:50 test: show the tool exit status on failure We already do so for the non-successful cases, let's do this here too so we know whether it was a signal or a normal exit.
Ran Benita 8507af73 2021-05-22T20:11:10 test/tool-option-parsing: don't depend on build prefix Fixes: https://github.com/xkbcommon/libxkbcommon/issues/244 Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 98f07da8 2021-05-22T20:07:06 test/compose: add tests for xkb_compose_table_new_from_locale lookup Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 5b1b2f75 2021-05-22T20:00:24 test/compose: clean up after a setenv Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita e2465c2a 2021-05-22T19:55:04 tests/data: add files needed to fully test compose Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 09ac27f7 2021-05-22T19:51:02 ignore: remove no longer relevant gitignore files These were relevant for the autoconf build but now we're meson only. Signed-off-by: Ran Benita <ran@unusedvar.com>
Isaac Freund 68dddd41 2021-04-22T00:37:03 keysym: fix underflow in binary searches This is hit when passing an empty string and XKB_KEYSYM_CASE_INSENSITIVE to xkb_keysym_from_name currently if `(lo + hi) / 2` is 0 and `cmp < 0`, causing mid to underflow and the the array access into name_to_keysym on the next iteration of the loop to be out of bounds . We *would* use ssize_t here as it is the appropriate type, but windows unfortunately does not define it.
Peter Hutterer 15576683 2021-04-21T09:02:40 test: allow skipping errors in certain conditions Add a skipError test function that can analyse rc, stdout, stderr to skip a test even when we expect an error. We use that to skip if we couldn't find a keyboard in the interactive-evdev test. Fixes #235 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer f60bdb16 2021-04-20T12:21:28 test: add extra info to the layout-tester --help output Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer be520ef9 2021-04-16T09:24:20 test: print the layout-tester progress bar to stdout by default tqdm prints to stderr by default but we're using that for failed keymap compiles (which are the ones that really matter). Plus, whether we're using tqdm is dependent on isatty(sys.stdout) anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer efa58050 2021-04-16T07:42:27 test: add an LVO argument to the XKB layout tester Slightly easier to debug if we can have it only parse one single layout. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer a955dca3 2021-04-15T11:07:33 test: print the compiled keymaps to a given directory With --keymap-output-dir, the given directory will contain a list of files named after the layout + variant ('us', 'us(euro)', ...) that contain the keymaps for each variant + option combination compiled. This is still a lot, but better to sift through hundreds of keymaps than tens of thousands. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 1cae2500 2021-04-15T10:39:05 test: rework the output for the xkeyboard-config layout tester The previous output is largely unusable. The result in the CI test runs is a 6GB file with every compiled keymap in it and while we can grep for ERROR, it's not particularly useful. Let's change this and print out YAML instead - that can be machine-processed. This patch adds a new parent class that prints itself in YAML format, the tool invocations are child classes of that class. The result looks like this: Example output: - rmlvo: ["evdev", "pc105", "us", "haw", "grp:rwin_switch"] cmd: "xkbcli-compile-keymap --verbose --rules evdev --model pc105 --layout us --variant haw --options grp:rwin_switch" status: 0 - rmlvo: ["evdev", "pc105", "us", "foo", ""] cmd: "xkbcli-compile-keymap --verbose --rules evdev --model pc105 --layout us --variant foo" status: 1 error: "failed to compile keymap" Special status codes are: 99 for "unrecognized keysym" and 90 for "Cannot open display" in the setxkbmap case. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 44e8d4b0 2021-04-15T08:57:51 test: add proper --verbose handling to the xkeyboard-config tester Instead of defaulting to verbose on/off depending on isatty, make it an argument instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita 8cd688c0 2021-04-01T22:07:28 keysym: avoid strtoul in xkb_keysym_from_name Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 1c0e28ad 2021-03-30T19:11:59 keysym: properly handle overflow in 0x keysym names Relatedly, strtoul allows a lot of unwanted stuff (spaces, +/- sign, thousand seperators), we really ought not use it. But that's for another time. Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer d1726527 2021-03-30T08:08:58 test: move an assert up to before the strlen() use ../../../test/keysym.c:80:24: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker] (unsigned) strlen(expected)); Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 694b8f71 2021-03-18T11:13:43 test: fix missing va_end in case of test failures Found by coverity Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 0abd430e 2021-02-22T12:54:15 test: add a keysym tester A simple script that creates a new layout with the given keysym replacing TLDE. Then we compile a keymap and search for the keysym being assigned to TLDE and bail if that fails. The list of keysyms is manually maintained but we only need to add one or two to spot-check whenever the xorgproto is updated. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 069777f4 2021-01-22T08:18:13 test: fix interactive evdev test invocation rmlvos is the parent list which then fails during a list join because, well, it's a list of lists. Fixes #206 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer d5e3695e 2021-01-22T08:05:09 test: fill in srcdir/builddir when not set in the environment Makes this test easier to run from the commandline. Where either of top_srcdir or top_builddir isn't set, fill them in from the CWD or fail otherwise. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita fbf087ea 2020-11-23T19:51:04 keymap-dump: follow xkbcomp in printing affect=both in pointer actions It is equivalent to nothing but good to match up. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 95f8ff83 2020-11-23T18:35:27 test/data: update host.xkb to match keymap-dump style This is needed for fixing the x11comp test. Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer 6268ba1c 2020-10-19T11:51:27 test: catch unrecognized keysyms in the xkeyboard-config test Prompted by https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/127 We run the keymap tool with --verbose which will print the messages from the compiler to the log file as well. And then we can search for the warning regarding an unrecognized keysym and fail our test based on that.
Peter Hutterer afdc9cee 2020-10-19T10:49:37 xkbcomp: where a keysym cannot be resolved, set it to NoSymbol Where resolve_keysym fails we warn but use the otherwise uninitialized variable as our keysym. That later ends up in the keymap as random garbage hex value. Simplest test case, set this in the 'us' keymap: key <TLDE> { [ xyz ] }; And without this patch we get random garbage: ./build/xkbcli-compile-keymap --layout us | grep TLDE: key <TLDE> { [ 0x018a5cf0 ] }; With this patch, we now get NoSymbol: ./build/xkbcli-compile-keymap --layout us | grep TLDE: key <TLDE> { [ NoSymbol ] };
Ran Benita 6178924f 2020-09-07T12:27:26 test/tool-option-parsing: skip testing of disabled tools Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita c621319e 2020-09-07T10:36:18 test/tool-option-parsing: switch from pytest to unittest For me, installing pytest for libxkbcommon is a bit problematic, so I end up skipping it which is not great. Switch to unittest which is built in to Python. It's not as nice as pytest but good enough in this case. Note: I was too lazy to switch the plain asserts to unittest assertions... Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita c8f309a2 2020-09-07T11:10:19 test/tool-option-parsing: keep isolated by using our own test data Make it possible to run the test on all machines. Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer 13745014 2020-09-07T19:24:12 test: include unstd.h in the registry test to cut down the MacOS warnings mkdtmp, rmdir and unlink are in unstd.h on MacOS. Since including that it doesn't hurt us on Linux, let's do it without ifdefs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita 534e54f6 2020-09-07T11:38:00 test/data: add rule registry files Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 1c352199 2020-09-07T11:35:22 test/data: sync from xkeyboard-config 2.30 Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 461d7278 2020-09-07T11:15:43 test/data: change quartz.xkb from CRLF to LF Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer 850ba7e6 2020-09-07T08:22:32 test: fix the xkbcli --version test Fixes https://github.com/xkbcommon/libxkbcommon/issues/185 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer d7b39f6f 2020-07-10T08:50:02 Add /etc/xkb as extra lookup path for system data files This completes the usual triplet of configuration locations available for most processes: - vendor-provided data files in /usr/share/X11/xkb - system-specific data files in /etc/xkb - user-specific data files in $XDG_CONFIG_HOME/xkb The default lookup order user, system, vendor, just like everything else that uses these conventions. For include directives in rules files, the '%E' resolves to that path. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 9b9c5f20 2020-07-29T08:13:14 test: fix the xkeyboard-config test 'xkbcli compile-keymap' doesn't work unless we ninja install first. But for a test that's to be run from the test directory, that's not a useful option so let's call the binary directly. The script adds the meson builddir to the PATH anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 03ecaa6b 2020-07-27T11:26:51 test: ignore the real XDG_CONFIG_HOME during tests Let's not have our tests fail if the user has an incompatible $XDG_CONFIG_HOME/xkb directory. libxkbcommon has fallbacks when XDG_CONFIG_HOME isn't set so we need to override this with a real directory instead of just unsetting it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita fcc6b28f 2020-07-27T11:57:24 tools/interactive-evdev: fixup 64bff65 Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 0df23ea8 2020-07-25T16:38:43 test/tool-option-parsing: remove --kccgst test, it's private for now Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita 608e9361 2020-07-25T16:30:39 tools: run test-tool-option-parsing.py like a regular test Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer 29e80e7b 2020-07-08T13:30:47 tools: install our tools as xkbcli subcommands The xkbcli tool usage help is ifdef'd out where the tool isn't built but the man page always includes all tools. Easier that way. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer f0b1441f 2020-07-23T08:49:54 test: make the symbols-leak-test executable Python leaks like crazy when run under valgrind. But if we make the script executable **and** it has uses the env invocation (i.e. #!/usr/bin/env python3), the leaks disappear. This is not the case for a shebang of /usr/bin/python3. Why exactly this is the case I'm not sure but executables we plan to run should have the exec bit set. So this is a janitor patch with the nice side effect of fixing our valgrind runs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ran Benita a4901662 2020-07-22T20:02:25 PACKAING: remove bash Converted to Python. Signed-off-by: Ran Benita <ran@unusedvar.com>
Ran Benita fa300b24 2020-07-22T11:47:15 test: fix Windows CI by rewriting symbols-leak-test from bash to python The CI started installing some wrapper instead of a real bash which is what gets found. See: https://github.com/actions/virtual-environments/pull/1081 Given meson is written in python, it should always be available hopefully. Disabled valgrind wrapper for now because it now also applies to the python interpreter which leaks like a sieve. Signed-off-by: Ran Benita <ran@unusedvar.com>
Peter Hutterer 41a7c975 2020-07-10T14:57:57 Add asprintf_safe helper function We only ever care about whether we error out or not, so let's wrap this into something more sane. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer afb26e7d 2020-05-12T14:09:50 Add libxkbregistry to query available RMLVO This library is the replacement for clients parsing evdev.xml directly. Instead, they should use the API here so that in the future we may even be able to swap evdev.xml for a more suitable data format. The library parses through evdev.xml (using libxml2) and - if requested - through evdev.extras.xml as well. The merge approach is optimised for the default case where we have a system-installed rules XML and another file in $XDG_CONFIG_DIR that adds a few entries. We load the system file first, then append any custom ones to that. It's not possible to overwrite the MLVO list provided by the system files - if you want to do that, get the change upstream. XML validation is handled through the DTD itself which means we only need to check for a nonempty name, everything else the DTD validation should complain about. The logging system is effectively identical to xkbcommon. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer fe886133 2020-06-23T11:07:53 utils: add streq_null() for streq that allows NULL values Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 9b1b0c57 2020-06-16T10:34:07 Add a snprintf_safe() helper function Returns true on success or false on error _or_ truncation. Since truncation is almost always an error anyway, we might as well make this easier to check. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 43b9d092 2020-07-01T07:58:35 test: fix the xkeyboard-config test for the prefixed tool name Regression introduced in 362130debb5d90d77f0d4f7549880b5f9699f647 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 314b6486 2020-06-24T08:30:50 test: drop some now-obsolete functions These were moved to tools/tools-common.c and now that all tools are switched over, they're no longer needed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 3adbe54e 2020-06-23T16:20:08 tools: move the remaining tools from test to here Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer f525f9f0 2020-06-23T16:25:50 test: disentangle interactive-wayland from the test headers Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer 1326d5ad 2020-06-23T16:23:24 test: untangle interactive-x11 from the test headers Use the new tools headers and create a custom internal lib for the x11 tool. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer c09bf363 2020-06-23T14:01:48 test: untangle interactive-evdev from the test headers Move (sometimes duplicate) the required bits into new shared files tools-common.(c|h) that are compiled into the internal tools library. Rename the test_foo() functions to tools_foo() and in one case just copy the code of the keymap compile function to the tool. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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 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 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 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 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
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>
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>