aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputTestsBase.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-11-25 17:06:01 +0900
committerJean Chalard <jchalard@google.com>2013-11-25 17:22:15 +0900
commite629f860d1044fc018a12307b7d9f639ba6fb081 (patch)
tree449f91b4ab95c6867c115c1296a584ae7e86082f /tests/src/com/android/inputmethod/latin/InputTestsBase.java
parenta78b0f6b9e03cc9822e9f61a70ec5c3ed7ce3526 (diff)
downloadlatinime-e629f860d1044fc018a12307b7d9f639ba6fb081.tar.gz
latinime-e629f860d1044fc018a12307b7d9f639ba6fb081.tar.xz
latinime-e629f860d1044fc018a12307b7d9f639ba6fb081.zip
Fix a flaky test.
Corrections depend on the proximity info, which depends on the layout, which in turn depends on the subtype and not only the language. Thus, we need to force the whole subtype for meaningful tests. Bug: 11142685 Change-Id: I9cf3d948259e0236061454a93ffc2e28c7e0768f
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputTestsBase.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputTestsBase.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
index 3cb980cb0..630657176 100644
--- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java
+++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
@@ -30,6 +30,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
+import android.view.inputmethod.InputMethodSubtype;
import android.widget.EditText;
import android.widget.FrameLayout;
@@ -37,6 +38,7 @@ import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.utils.LocaleUtils;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
import java.util.Locale;
@@ -244,7 +246,18 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
protected void changeLanguageWithoutWait(final String locale) {
mEditText.mCurrentLocale = LocaleUtils.constructLocaleFromString(locale);
- SubtypeSwitcher.getInstance().forceLocale(mEditText.mCurrentLocale);
+ final InputMethodSubtype subtype = new InputMethodSubtype(
+ R.string.subtype_no_language_qwerty, R.drawable.ic_ime_switcher_dark,
+ locale, "keyboard", "KeyboardLayoutSet="
+ // TODO: this is forcing a QWERTY keyboard for all locales, which is wrong.
+ // It's still better than using whatever keyboard is the current one, but we
+ // should actually use the default keyboard for this locale.
+ + SubtypeLocaleUtils.QWERTY
+ + "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
+ + "," + Constants.Subtype.ExtraValue.ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE
+ + Constants.Subtype.ExtraValue.EMOJI_CAPABLE,
+ false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */);
+ SubtypeSwitcher.getInstance().forceSubtype(subtype);
mLatinIME.loadKeyboard();
runMessages();
mKeyboard = mLatinIME.mKeyboardSwitcher.getKeyboard();