aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputLogicTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-08-21 15:52:33 +0900
committerJean Chalard <jchalard@google.com>2013-08-21 16:19:31 +0900
commite38097dc2ae31774d49142d619f7d57708369785 (patch)
tree61a57b22f25ffd7d85bd03f482dab304c13bcdba /tests/src/com/android/inputmethod/latin/InputLogicTests.java
parent2448159ad4bf900c1aba10dbfe51dd5479d40e38 (diff)
downloadlatinime-e38097dc2ae31774d49142d619f7d57708369785.tar.gz
latinime-e38097dc2ae31774d49142d619f7d57708369785.tar.xz
latinime-e38097dc2ae31774d49142d619f7d57708369785.zip
Add tests for start composing
Bug: 10403176 Change-Id: I510bf1dccf6795426e6fb1b36181b18039a0f435
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index 6cc4befae..fe92be618 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -305,5 +305,33 @@ public class InputLogicTests extends InputTestsBase {
assertEquals("resume suggestion on backspace", 8,
BaseInputConnection.getComposingSpanEnd(mEditText.getText()));
}
+
+ private void helperTestComposing(final String wordToType, final boolean shouldBeComposing) {
+ mEditText.setText("");
+ type(wordToType);
+ assertEquals("start composing inside text", shouldBeComposing ? 0 : -1,
+ BaseInputConnection.getComposingSpanStart(mEditText.getText()));
+ assertEquals("start composing inside text", shouldBeComposing ? wordToType.length() : -1,
+ BaseInputConnection.getComposingSpanEnd(mEditText.getText()));
+ }
+
+ public void testStartComposing() {
+ // Should start composing on a letter
+ helperTestComposing("a", true);
+ type(" "); // To reset the composing state
+ // Should not start composing on quote
+ helperTestComposing("'", false);
+ type(" ");
+ helperTestComposing("'-", false);
+ type(" ");
+ // Should not start composing on dash
+ helperTestComposing("-", false);
+ type(" ");
+ helperTestComposing("-'", false);
+ type(" ");
+ helperTestComposing("a-", true);
+ type(" ");
+ helperTestComposing("a'", true);
+ }
// TODO: Add some tests for non-BMP characters
}