spiegel-keyman/common/core/desktop/tests/unit/kmx
Eberhard Beilharz 044e53198a
fix(linux): Fix switching to keyboard in middle of line (#4678)
Don't re-set context if it changed because the cursor location was
wrong. When the user switches to the EuroLatin keyboard in the
middle of the line, we're getting a wrong cursor location. This will
be fixed with the next keypress, but it leads to the context string
suddenly having more characters added to the front. If we re-set the
context because it's different now we will loose the information we
previously added to the context.

We now compare the end of the string. If the new context string ends
with the old context string we assume that the cursor position got
updated and don't re-set the context.

This fixes #4678.
2021-03-18 17:29:21 +01:00
..
000 - null keyboard.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
000 - null keyboard.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
001 - basic input UnicodeI.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
001 - basic input UnicodeI.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
002 - basic input Unicode.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
002 - basic input Unicode.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
003 - nul.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
003 - nul.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
004 - basic input (shift 2).kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
004 - basic input (shift 2).kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
005 - nul with initial context.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
005 - nul with initial context.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
006 - vkey input (shift ctrl).kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
006 - vkey input (shift ctrl).kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
007 - vkey input (ctrl alt).kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
007 - vkey input (ctrl alt).kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
008 - vkey input (ctrl alt 2).kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
008 - vkey input (ctrl alt 2).kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
012 - ralt.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
012 - ralt.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
013 - deadkeys.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
013 - deadkeys.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
014 - groups and virtual keys.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
014 - groups and virtual keys.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
015 - ralt 2.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
015 - ralt 2.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
017 - space mnemonic kbd.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
017 - space mnemonic kbd.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
018 - nul testing.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
018 - nul testing.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
019 - multiple deadkeys.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
019 - multiple deadkeys.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
020 - deadkeys and backspace.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
020 - deadkeys and backspace.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
021 - options.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
021 - options.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
022 - options with preset.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
022 - options with preset.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
023 - options with save.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
023 - options with save.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
024 - options with save and preset.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
024 - options with save and preset.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
025 - options with reset.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
025 - options with reset.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
026 - system stores.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
026 - system stores.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
027 - system stores 2.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
027 - system stores 2.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
028 - smp.kmn fix(common): add test case and fix smp bugs 2021-01-29 16:05:07 +11:00
028 - smp.kmx fix(common): add test case and fix smp bugs 2021-01-29 16:05:07 +11:00
029 - beep.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
029 - beep.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
030 - multiple groups.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
030 - multiple groups.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
031 - caps lock.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
031 - caps lock.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
032 - caps control.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
033 - caps always off.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
034 - options double set reset.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
034 - options double set reset.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
035 - options double set staged.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
035 - options double set staged.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
036 - options - double reset staged.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
036 - options - double reset staged.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
037 - options - double reset.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
037 - options - double reset.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
038 - punctkeys.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
038 - punctkeys.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
039 - generic ctrlalt.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
039 - generic ctrlalt.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
040 - long context.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
040 - long context.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
041 - long context and deadkeys.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
041 - long context and deadkeys.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
042 - long context and split deadkeys.kmn refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
042 - long context and split deadkeys.kmx refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
043 - output and keystroke.kmn chore(common): add tests for Keyman Core 2020-05-08 16:53:53 +10:00
043 - output and keystroke.kmx chore(common): add tests for Keyman Core 2020-05-08 16:53:53 +10:00
044 - if and context.kmn fix(common/core): context mismatch with if and deadkey automatic test 2021-01-18 10:22:59 +11:00
044 - if and context.kmx fix(common/core): context mismatch with if and deadkey automatic test 2021-01-18 10:22:59 +11:00
045 - deadkey and context.kmn fix(common/core): context mismatch with if and deadkey automatic test 2021-01-18 10:22:59 +11:00
045 - deadkey and context.kmx fix(common/core): context mismatch with if and deadkey automatic test 2021-01-18 10:22:59 +11:00
046 - deadkey and contextex.kmn fix(common/core): context mismatch with if and deadkey automatic test 2021-01-18 10:22:59 +11:00
046 - deadkey and contextex.kmx fix(common/core): context mismatch with if and deadkey automatic test 2021-01-18 10:22:59 +11:00
kmp.json refactor(common): Rename keyboardprocessor to desktop 2020-02-26 16:34:29 +07:00
kmx.cpp fix(linux): Fix switching to keyboard in middle of line (#4678) 2021-03-18 17:29:21 +01:00
meson.build fix(common/core): context mismatch with if and deadkey automatic test 2021-01-18 10:22:59 +11:00
README.md docs(common): Add readme for unit tests 2021-03-02 16:55:22 +01:00

KMX unit tests

This directory contains unit tests that test the KMX processing.

The driver (kmx.cpp) loads and executes the tests. Each test consist of a Keyman keyboard source file (0*.kmn) and the compiled KMX keyboard. The source file contains rules and defines the setup, input and expected results.

Defining tests in the .kmn file

The top of the file contains comments that define the setup, input and expected results. Following the comments are the normal rules of a Keyman keyboard.

Setup

  • description: this is just for commenting what we test here
c Description: Tests Caps Lock env set
  • option: allows to put the system in a defined state. The example below turns caps-lock off.
c option: &capsLock=0
  • context: allows to setup a string which serves as context
c context:

Input

  • keys: defines one or more virtual keys that will be processed one after the other
c keys: [K_1][K_CAPS][K_2][SHIFT K_3][K_4][K_CAPS][K_5][K_CAPS][K_6]

Expected Result

  • expected: the resulting string of processing the input keys. In the example below each key press is expected to output the string 'pass.'.
c expected: pass.pass.pass.pass.pass.pass.

Running the tests

All tests can be run at once with meson test.

Alternatively it's possible to run a single test with:

cd common/core/desktop
build/tests/unit/kmx/kmx 'tests/unit/kmx/038 - punctkeys.kmn' 'tests/unit/kmx/038 - punctkeys.kmx'