aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/PunctuationTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/PunctuationTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/PunctuationTests.java53
1 files changed, 34 insertions, 19 deletions
diff --git a/tests/src/com/android/inputmethod/latin/PunctuationTests.java b/tests/src/com/android/inputmethod/latin/PunctuationTests.java
index 1b5b72ff8..e1d4c46f8 100644
--- a/tests/src/com/android/inputmethod/latin/PunctuationTests.java
+++ b/tests/src/com/android/inputmethod/latin/PunctuationTests.java
@@ -16,21 +16,36 @@
package com.android.inputmethod.latin;
+import com.android.inputmethod.latin.R;
+
public class PunctuationTests extends InputTestsBase {
+ final String NEXT_WORD_PREDICTION_OPTION = "next_word_prediction";
+
public void testWordThenSpaceThenPunctuationFromStripTwice() {
final String WORD_TO_TYPE = "this ";
final String PUNCTUATION_FROM_STRIP = "!";
final String EXPECTED_RESULT = "this!! ";
- type(WORD_TO_TYPE);
- sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
- runMessages();
- assertTrue("type word then type space should display punctuation strip",
- mLatinIME.isShowingPunctuationList());
- 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());
+ final boolean defaultNextWordPredictionOption =
+ mLatinIME.getResources().getBoolean(R.bool.config_default_next_word_suggestions);
+ final boolean previousNextWordPredictionOption =
+ setBooleanPreference(NEXT_WORD_PREDICTION_OPTION, false,
+ defaultNextWordPredictionOption);
+ try {
+ mLatinIME.loadSettings();
+ type(WORD_TO_TYPE);
+ sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
+ runMessages();
+ assertTrue("type word then type space should display punctuation strip",
+ mLatinIME.isShowingPunctuationList());
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ assertEquals("type word then type space then punctuation from strip twice",
+ EXPECTED_RESULT, mTextView.getText().toString());
+ } finally {
+ setBooleanPreference(NEXT_WORD_PREDICTION_OPTION, previousNextWordPredictionOption,
+ defaultNextWordPredictionOption);
+ }
}
public void testWordThenSpaceThenPunctuationFromKeyboardTwice() {
@@ -47,9 +62,9 @@ public class PunctuationTests extends InputTestsBase {
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);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
+ pickSuggestionManually(0, PUNCTUATION_FROM_STRIP);
type(WORD2_TO_TYPE);
assertEquals("pick word then pick punctuation twice then type", EXPECTED_RESULT,
mTextView.getText().toString());
@@ -60,8 +75,8 @@ public class PunctuationTests extends InputTestsBase {
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);
+ pickSuggestionManually(0, WORD1_TO_TYPE);
+ pickSuggestionManually(1, WORD2_TO_PICK);
assertEquals("manual pick then manual pick a word with punct at start", EXPECTED_RESULT,
mTextView.getText().toString());
}
@@ -71,7 +86,7 @@ public class PunctuationTests extends InputTestsBase {
final String PUNCTUATION = ":";
final String EXPECTED_RESULT = "this:";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
type(PUNCTUATION);
assertEquals("manually pick word then colon",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -82,7 +97,7 @@ public class PunctuationTests extends InputTestsBase {
final String PUNCTUATION = "(";
final String EXPECTED_RESULT = "this (";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
type(PUNCTUATION);
assertEquals("manually pick word then open paren",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -93,7 +108,7 @@ public class PunctuationTests extends InputTestsBase {
final String PUNCTUATION = ")";
final String EXPECTED_RESULT = "this)";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
type(PUNCTUATION);
assertEquals("manually pick word then close paren",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -104,7 +119,7 @@ public class PunctuationTests extends InputTestsBase {
final String SPECIAL_KEY = ":-)";
final String EXPECTED_RESULT = "this :-)";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
mLatinIME.onTextInput(SPECIAL_KEY);
assertEquals("manually pick word then press the smiley key",
EXPECTED_RESULT, mTextView.getText().toString());
@@ -115,7 +130,7 @@ public class PunctuationTests extends InputTestsBase {
final String SPECIAL_KEY = ".com";
final String EXPECTED_RESULT = "this.com";
type(WORD_TO_TYPE);
- mLatinIME.pickSuggestionManually(0, WORD_TO_TYPE);
+ pickSuggestionManually(0, WORD_TO_TYPE);
mLatinIME.onTextInput(SPECIAL_KEY);
assertEquals("manually pick word then press the .com key",
EXPECTED_RESULT, mTextView.getText().toString());