abouttreesummaryrefslogcommitdiff
path: root/test
diff options
context:
space:
mode:
authorJules Aguillon2025-02-27 23:53:42 +0100
committerJules Aguillon2025-02-27 23:53:42 +0100
commit466e0b82189352ee931916b22494f638fabc9aa3 (patch)
tree8acfb89d4e53571cfa5c7b20f7cc1b6b6c9f5755 /test
parent75fdc2bfa9cfe7ad5b743105c3679e2fdc3110e3 (diff)
downloadunexpected-keyboard-466e0b82189352ee931916b22494f638fabc9aa3.tar.gz
unexpected-keyboard-466e0b82189352ee931916b22494f638fabc9aa3.zip
KeyValue: Don't wrap keys into a macro when possible
Many kind of KeyValues don't need to be wrapped into a Macro to show a specific symbol. This is especially useful as Macro keys are not affected by modifiers. The parser is changed to have a fast-path when a key value is not a macro.
Diffstat (limited to 'test')
-rw-r--r--test/juloo.keyboard2/KeyValueParserTest.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/juloo.keyboard2/KeyValueParserTest.java b/test/juloo.keyboard2/KeyValueParserTest.java
index a041e8a..7ece1a7 100644
--- a/test/juloo.keyboard2/KeyValueParserTest.java
+++ b/test/juloo.keyboard2/KeyValueParserTest.java
@@ -55,6 +55,13 @@ public class KeyValueParserTest
}
@Test
+ /* Using the [symbol:..] syntax but not resulting in a macro. */
+ public void parse_non_macro() throws Exception
+ {
+ Utils.parse("a:b", KeyValue.makeCharKey('b', "a", 0));
+ }
+
+ @Test
public void parse_string_key() throws Exception
{
Utils.parse("symbol:'str'", KeyValue.makeMacro("symbol", new KeyValue[]{
@@ -87,9 +94,7 @@ public class KeyValueParserTest
@Test
public void parse_key_event() throws Exception
{
- Utils.parse("symbol:keyevent:85", KeyValue.makeMacro("symbol", new KeyValue[]{
- KeyValue.keyeventKey("", 85, 0)
- }, 0));
+ Utils.parse("symbol:keyevent:85", KeyValue.keyeventKey("symbol", 85, 0));
Utils.parse("macro:keyevent:85,abc", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.keyeventKey("", 85, 0),
KeyValue.makeStringKey("abc")