diff options
author | 2013-08-21 01:37:38 -0700 | |
---|---|---|
committer | 2013-08-21 01:37:38 -0700 | |
commit | 1d0e9fc0830a95079adc6bace220f1a0dca38323 (patch) | |
tree | 2d04007a769f7205669bea72268c03aa0bfc3295 /tests/src | |
parent | 54978cafa540bd7a860192c57e67bae07da39d83 (diff) | |
parent | f2773ba76b2c01f388445d085a58fc6b47fe6f4f (diff) | |
download | latinime-1d0e9fc0830a95079adc6bace220f1a0dca38323.tar.gz latinime-1d0e9fc0830a95079adc6bace220f1a0dca38323.tar.xz latinime-1d0e9fc0830a95079adc6bace220f1a0dca38323.zip |
am f2773ba7: Merge "Add tests for start composing"
* commit 'f2773ba76b2c01f388445d085a58fc6b47fe6f4f':
Add tests for start composing
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputLogicTests.java | 28 |
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 } |