aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputLogicTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-03-07 15:59:53 +0900
committerJean Chalard <jchalard@google.com>2012-03-07 17:32:42 +0900
commit845b24d9d31072b98958c557366617ad1c34f1b7 (patch)
treec0bb03d7b78f3702a026192613572d725d6f868f /tests/src/com/android/inputmethod/latin/InputLogicTests.java
parent89ffb212b469531db4a616afb9bb7ba6d2a56b50 (diff)
downloadlatinime-845b24d9d31072b98958c557366617ad1c34f1b7.tar.gz
latinime-845b24d9d31072b98958c557366617ad1c34f1b7.tar.xz
latinime-845b24d9d31072b98958c557366617ad1c34f1b7.zip
Fix a bug with successive manual picks
Bug: 6121571 Change-Id: Ib16fbef1087da3b7da5539901ec57156f242f089
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index e3911f22f..50aba7b94 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -404,7 +404,32 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
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,
+ assertEquals("manual pick then space then type", EXPECTED_RESULT,
+ mTextView.getText().toString());
+ }
+
+ public void testManualPickThenManualPick() {
+ final String WORD1_TO_TYPE = "this";
+ final String WORD2_TO_PICK = "is";
+ final String EXPECTED_RESULT = "this is";
+ type(WORD1_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ // Here we fake picking a word through bigram prediction. This test is taking
+ // advantage of the fact that Latin IME blindly trusts the caller of #pickSuggestionManually
+ // to actually pass the right string.
+ mLatinIME.pickSuggestionManually(1, WORD2_TO_PICK);
+ assertEquals("manual pick then manual pick", EXPECTED_RESULT,
+ mTextView.getText().toString());
+ }
+
+ public void testManualPickThenManualPickWithPunctAtStart() {
+ final String WORD1_TO_TYPE = "this";
+ final String WORD2_TO_PICK = "!is";
+ final String EXPECTED_RESULT = "this!is";
+ type(WORD1_TO_TYPE);
+ mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
+ mLatinIME.pickSuggestionManually(1, WORD2_TO_PICK);
+ assertEquals("manual pick then manual pick a word with punct at start", EXPECTED_RESULT,
mTextView.getText().toString());
}