diff options
Diffstat (limited to 'test/juloo.keyboard2')
| -rw-r--r-- | test/juloo.keyboard2/ComposeKeyTest.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/test/juloo.keyboard2/ComposeKeyTest.java b/test/juloo.keyboard2/ComposeKeyTest.java index 3d0b371..a3d1ddb 100644 --- a/test/juloo.keyboard2/ComposeKeyTest.java +++ b/test/juloo.keyboard2/ComposeKeyTest.java @@ -42,22 +42,21 @@ public class ComposeKeyTest assertEquals(apply("ய", state), KeyValue.makeStringKey("௰", KeyValue.FLAG_SMALLER_FONT)); } - KeyValue apply(String seq) throws Exception + @Test + public void stringKeys() throws Exception + { + int state = ComposeKeyData.shift; + assertEquals(apply("𝕨", state), KeyValue.makeStringKey("𝕎")); + assertEquals(apply("𝕩", state), KeyValue.makeStringKey("𝕏")); + } + + KeyValue apply(String seq) { - return apply(seq, ComposeKeyData.compose); + return ComposeKey.apply(ComposeKeyData.compose, seq); } - KeyValue apply(String seq, int state) throws Exception + KeyValue apply(String seq, int state) { - KeyValue r = null; - for (int i = 0; i < seq.length(); i++) - { - r = ComposeKey.apply(state, seq.charAt(i)); - if (r.getKind() == KeyValue.Kind.Compose_pending) - state = r.getPendingCompose(); - else if (i + 1 < seq.length()) - throw new Exception("Sequence too long: " + seq); - } - return r; + return ComposeKey.apply(state, seq); } } |
