aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputLogicTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-02-02 17:53:00 +0900
committerJean Chalard <jchalard@google.com>2012-02-02 18:21:10 +0900
commitcca2183f5a9174b94e39e68fab9bc749c86743ef (patch)
tree01bd7f7bb03ecc2c992326897fed28e24256a56d /tests/src/com/android/inputmethod/latin/InputLogicTests.java
parent51fd1632f59bd9aaeb5c98ff031f1618e8c31c59 (diff)
downloadlatinime-cca2183f5a9174b94e39e68fab9bc749c86743ef.tar.gz
latinime-cca2183f5a9174b94e39e68fab9bc749c86743ef.tar.xz
latinime-cca2183f5a9174b94e39e68fab9bc749c86743ef.zip
Add unit tests in prevision of magic space removal
Bug: 4994861 Change-Id: I114a1117cf19aa6e514ac7342f733175dc5d5df1
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index 6dfa80904..8c0ccd40b 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -218,4 +218,77 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
assertEquals("auto correct then move curor then backspace",
EXPECTED_RESULT, mTextView.getText().toString());
}
+
+ public void testNoSpaceAfterManualPick() {
+ final String WORD_TO_TYPE = "this";
+ final String EXPECTED_RESULT = WORD_TO_TYPE;
+ type(WORD_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ assertEquals("no space after manual pick", EXPECTED_RESULT,
+ mTextView.getText().toString());
+ }
+
+ public void testManualPickThenType() {
+ final String WORD1_TO_TYPE = "this";
+ final String WORD2_TO_TYPE = "is";
+ final String EXPECTED_RESULT = "this is";
+ type(WORD1_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ type(WORD2_TO_TYPE);
+ assertEquals("manual pick then type", EXPECTED_RESULT, mTextView.getText().toString());
+ }
+
+ public void testManualPickThenSeparator() {
+ final String WORD1_TO_TYPE = "this";
+ final String WORD2_TO_TYPE = "!";
+ final String EXPECTED_RESULT = "this!";
+ type(WORD1_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ type(WORD2_TO_TYPE);
+ assertEquals("manual pick then separator", EXPECTED_RESULT, mTextView.getText().toString());
+ }
+
+ public void testWordThenSpaceThenPunctuationFromStripTwice() {
+ final String WORD_TO_TYPE = "this ";
+ final String PUNCTUATION_FROM_STRIP = "!";
+ final String EXPECTED_RESULT = "this!! ";
+ type(WORD_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ assertEquals("type word then type space then punctuation from strip twice", EXPECTED_RESULT,
+ mTextView.getText().toString());
+ }
+
+ public void testWordThenSpaceThenPunctuationFromKeyboardTwice() {
+ final String WORD_TO_TYPE = "this !!";
+ final String EXPECTED_RESULT = "this !!";
+ type(WORD_TO_TYPE);
+ assertEquals("manual pick then space then punctuation from keyboard twice", EXPECTED_RESULT,
+ mTextView.getText().toString());
+ }
+
+ public void testManualPickThenPunctuationFromStripTwiceThenType() {
+ final String WORD1_TO_TYPE = "this";
+ final String WORD2_TO_TYPE = "is";
+ final String PUNCTUATION_FROM_STRIP = "!";
+ final String EXPECTED_RESULT = "this!! is";
+ type(WORD1_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ mLatinIME.pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ type(WORD2_TO_TYPE);
+ assertEquals("pick word then pick punctuation twice then type", EXPECTED_RESULT,
+ mTextView.getText().toString());
+ }
+
+ public void testManualPickThenSpaceThenType() {
+ final String WORD1_TO_TYPE = "this";
+ final String WORD2_TO_TYPE = " is";
+ final String EXPECTED_RESULT = "this is";
+ type(WORD1_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ type(WORD2_TO_TYPE);
+ assertEquals("manual pick then space then type", WORD1_TO_TYPE + WORD2_TO_TYPE,
+ mTextView.getText().toString());
+ }
}