diff options
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java b/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java index 866f8894c..3cfd0e2a6 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java @@ -18,6 +18,9 @@ package com.android.inputmethod.latin; import android.test.suitebuilder.annotation.LargeTest; +import com.android.inputmethod.latin.common.Constants; +import com.android.inputmethod.latin.settings.Settings; + @LargeTest public class InputLogicTestsNonEnglish extends InputTestsBase { final String NEXT_WORD_PREDICTION_OPTION = "next_word_prediction"; @@ -68,7 +71,7 @@ public class InputLogicTestsNonEnglish extends InputTestsBase { try { changeLanguage("fr"); type(WORD_TO_TYPE); - sleep(DELAY_TO_WAIT_FOR_UNDERLINE); + sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS); runMessages(); assertTrue("type word then type space should display punctuation strip", mLatinIME.getSuggestedWordsForTest().isPunctuationSuggestions()); @@ -93,7 +96,7 @@ public class InputLogicTestsNonEnglish extends InputTestsBase { try { changeLanguage("fr"); type(WORD_TO_TYPE); - sleep(DELAY_TO_WAIT_FOR_UNDERLINE); + sleep(DELAY_TO_WAIT_FOR_UNDERLINE_MILLIS); runMessages(); final SuggestedWords suggestedWords = mLatinIME.getSuggestedWordsForTest(); assertEquals("type word then type space yields predictions for French", @@ -121,4 +124,32 @@ public class InputLogicTestsNonEnglish extends InputTestsBase { assertEquals("auto-correct with umlaut for German", EXPECTED_RESULT, mEditText.getText().toString()); } + + // Corresponds to InputLogicTests#testDoubleSpace + public void testDoubleSpaceHindi() { + changeLanguage("hi"); + // Set default pref just in case + setBooleanPreference(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true, true); + // U+1F607 is an emoji + final String[] STRINGS_TO_TYPE = + new String[] { "this ", "a+ ", "\u1F607 ", "|| ", ") ", "( ", "% " }; + final String[] EXPECTED_RESULTS = + new String[] { "this| ", "a+| ", "\u1F607| ", "|| ", ")| ", "( ", "%| " }; + for (int i = 0; i < STRINGS_TO_TYPE.length; ++i) { + mEditText.setText(""); + type(STRINGS_TO_TYPE[i]); + assertEquals("double space processing", EXPECTED_RESULTS[i], + mEditText.getText().toString()); + } + } + + // Corresponds to InputLogicTests#testCancelDoubleSpace + public void testCancelDoubleSpaceHindi() { + changeLanguage("hi"); + final String STRING_TO_TYPE = "this "; + final String EXPECTED_RESULT = "this "; + type(STRING_TO_TYPE); + type(Constants.CODE_DELETE); + assertEquals("double space make a period", EXPECTED_RESULT, mEditText.getText().toString()); + } } |