diff options
author | Yohei Yukawa <yukawa@google.com> | 2014-09-11 23:50:21 +0900 |
---|---|---|
committer | Yohei Yukawa <yukawa@google.com> | 2014-09-12 00:07:41 +0900 |
commit | d77adfe52d44396c54a4ce3a7f1e823e8618f27c (patch) | |
tree | c1bc68c5894f49ecefaf571bdb1cbaad940925a1 /core/tests/inputmethodtests | |
parent | 91f49ed13c52fb9eaa59cf6930c391c2457217fa (diff) | |
download | frameworks_base-d77adfe52d44396c54a4ce3a7f1e823e8618f27c.zip frameworks_base-d77adfe52d44396c54a4ce3a7f1e823e8618f27c.tar.gz frameworks_base-d77adfe52d44396c54a4ce3a7f1e823e8618f27c.tar.bz2 |
Enrich test cases when enabling default IMEs part 3
This is another groundwork for subsequent fixes.
Notable changes in test cases are:
- A dummy Hinglish IME ("en_US" + "hi") is added
- Added test cases where system locale is "en_GB",
"en_IN", and "hi" as well as "en_US".
BUG: 17347871
Change-Id: Iacf0f47c4dbc147f8153df50ba58fc4da4dacd29
Diffstat (limited to 'core/tests/inputmethodtests')
-rw-r--r-- | core/tests/inputmethodtests/src/android/os/InputMethodTest.java | 143 |
1 files changed, 133 insertions, 10 deletions
diff --git a/core/tests/inputmethodtests/src/android/os/InputMethodTest.java b/core/tests/inputmethodtests/src/android/os/InputMethodTest.java index bd3d6da..30eb939 100644 --- a/core/tests/inputmethodtests/src/android/os/InputMethodTest.java +++ b/core/tests/inputmethodtests/src/android/os/InputMethodTest.java @@ -42,6 +42,9 @@ public class InputMethodTest extends InstrumentationTestCase { private static final boolean IS_SYSTEM_READY = true; private static final ArrayList<InputMethodSubtype> NO_SUBTYPE = null; private static final Locale LOCALE_EN_US = new Locale("en", "US"); + private static final Locale LOCALE_EN_GB = new Locale("en", "GB"); + private static final Locale LOCALE_EN_IN = new Locale("en", "IN"); + private static final Locale LOCALE_HI = new Locale("hi"); @SmallTest public void testDefaultEnabledImesWithDefaultVoiceIme() throws Exception { @@ -54,19 +57,76 @@ public class InputMethodTest extends InstrumentationTestCase { imis.add(createDefaultDummyLatinKeyboardIme()); imis.add(createNonDefaultDummyJaJPKeyboardIme()); imis.add(createNonDefaultDummyJaJPKeyboardImeWithoutSubtypes()); + imis.add(createDefaultDummyHinglishKeyboardIme()); - final ArrayList<InputMethodInfo> enabledImisForSystemNotReady = + // locale: en_US, system: not ready + final ArrayList<InputMethodInfo> enabledImisForSystemNotReadyLocaleEnUs = callGetDefaultEnabledImesUnderWithLocale(context, !IS_SYSTEM_READY, imis, LOCALE_EN_US); assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme", - "DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1"), - getPackageNames(enabledImisForSystemNotReady)); + "DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemNotReadyLocaleEnUs)); - final ArrayList<InputMethodInfo> enabledImisForSystemReady = + // locale: en_US, system: ready + final ArrayList<InputMethodInfo> enabledImisForSystemReadyLocaleEnUs = callGetDefaultEnabledImesUnderWithLocale(context, IS_SYSTEM_READY, imis, LOCALE_EN_US); - assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme"), - getPackageNames(enabledImisForSystemReady)); + assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme", + "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemReadyLocaleEnUs)); + + // locale: en_GB, system: not ready + final ArrayList<InputMethodInfo> enabledImisForSystemNotReadyLocaleEnGB = + callGetDefaultEnabledImesUnderWithLocale(context, !IS_SYSTEM_READY, imis, + LOCALE_EN_GB); + assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme", + "DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemNotReadyLocaleEnGB)); + + // locale: en_GB, system: ready + final ArrayList<InputMethodInfo> enabledImisForSystemReadyLocaleEnGB = + callGetDefaultEnabledImesUnderWithLocale(context, IS_SYSTEM_READY, imis, + LOCALE_EN_GB); + assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme", + "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemReadyLocaleEnGB)); + + // locale: en_IN, system: not ready + final ArrayList<InputMethodInfo> enabledImisForSystemNotReadyLocaleEnIN = + callGetDefaultEnabledImesUnderWithLocale(context, !IS_SYSTEM_READY, imis, + LOCALE_EN_IN); + assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme", + "DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemNotReadyLocaleEnIN)); + + // locale: en_IN, system: ready + final ArrayList<InputMethodInfo> enabledImisForSystemReadyLocaleEnIN = + callGetDefaultEnabledImesUnderWithLocale(context, IS_SYSTEM_READY, imis, + LOCALE_EN_IN); + assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme", + "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemReadyLocaleEnIN)); + + // locale: hi, system: not ready + final ArrayList<InputMethodInfo> enabledImisForSystemNotReadyLocaleHi = + callGetDefaultEnabledImesUnderWithLocale(context, !IS_SYSTEM_READY, imis, + LOCALE_HI); + assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme", + "DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemNotReadyLocaleHi)); + + // locale: hi, system: ready + final ArrayList<InputMethodInfo> enabledImisForSystemReadyLocaleHi = + callGetDefaultEnabledImesUnderWithLocale(context, IS_SYSTEM_READY, imis, + LOCALE_HI); + assertEquals(toSet("DummyDefaultAutoVoiceIme", "DummyDefaultEnKeyboardIme", + "DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemReadyLocaleHi)); } @SmallTest @@ -79,18 +139,71 @@ public class InputMethodTest extends InstrumentationTestCase { imis.add(createDefaultDummyLatinKeyboardIme()); imis.add(createNonDefaultDummyJaJPKeyboardIme()); imis.add(createNonDefaultDummyJaJPKeyboardImeWithoutSubtypes()); + imis.add(createDefaultDummyHinglishKeyboardIme()); - final ArrayList<InputMethodInfo> enabledImisForSystemNotReady = + // locale: en_US, system: not ready + final ArrayList<InputMethodInfo> enabledImisForSystemNotReadyLocaleEnUs = callGetDefaultEnabledImesUnderWithLocale(context, !IS_SYSTEM_READY, imis, LOCALE_EN_US); assertEquals(toSet("DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", - "DummyDefaultEnKeyboardIme"), getPackageNames(enabledImisForSystemNotReady)); + "DummyDefaultEnKeyboardIme", "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemNotReadyLocaleEnUs)); - final ArrayList<InputMethodInfo> enabledImisForSystemReady = + // locale: en_US, system: ready + final ArrayList<InputMethodInfo> enabledImisForSystemReadyLocaleEnUs = callGetDefaultEnabledImesUnderWithLocale(context, IS_SYSTEM_READY, imis, LOCALE_EN_US); assertEquals(toSet("DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", - "DummyDefaultEnKeyboardIme"), getPackageNames(enabledImisForSystemReady)); + "DummyDefaultEnKeyboardIme", "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemReadyLocaleEnUs)); + + // locale: en_GB, system: not ready + final ArrayList<InputMethodInfo> enabledImisForSystemNotReadyLocaleEnGB = + callGetDefaultEnabledImesUnderWithLocale(context, !IS_SYSTEM_READY, imis, + LOCALE_EN_GB); + assertEquals(toSet("DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultEnKeyboardIme", "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemNotReadyLocaleEnGB)); + + // locale: en_GB, system: ready + final ArrayList<InputMethodInfo> enabledImisForSystemReadyLocaleEnGB = + callGetDefaultEnabledImesUnderWithLocale(context, IS_SYSTEM_READY, imis, + LOCALE_EN_GB); + assertEquals(toSet("DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultEnKeyboardIme", "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemReadyLocaleEnGB)); + + // locale: en_IN, system: not ready + final ArrayList<InputMethodInfo> enabledImisForSystemNotReadyLocaleEnIN = + callGetDefaultEnabledImesUnderWithLocale(context, !IS_SYSTEM_READY, imis, + LOCALE_EN_IN); + assertEquals(toSet("DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultEnKeyboardIme", "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemNotReadyLocaleEnIN)); + + // locale: en_IN, system: ready + final ArrayList<InputMethodInfo> enabledImisForSystemReadyLocaleEnIN = + callGetDefaultEnabledImesUnderWithLocale(context, IS_SYSTEM_READY, imis, + LOCALE_EN_IN); + assertEquals(toSet("DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultEnKeyboardIme", "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemReadyLocaleEnIN)); + + // locale: hi, system: not ready + final ArrayList<InputMethodInfo> enabledImisForSystemNotReadyLocaleHi = + callGetDefaultEnabledImesUnderWithLocale(context, !IS_SYSTEM_READY, imis, + LOCALE_HI); + assertEquals(toSet("DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultEnKeyboardIme", "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemNotReadyLocaleHi)); + + // locale: hi, system: ready + final ArrayList<InputMethodInfo> enabledImisForSystemReadyLocaleHi = + callGetDefaultEnabledImesUnderWithLocale(context, IS_SYSTEM_READY, imis, + LOCALE_HI); + assertEquals(toSet("DummyNonDefaultAutoVoiceIme0", "DummyNonDefaultAutoVoiceIme1", + "DummyDefaultEnKeyboardIme", "DummyDefaultHinglishKeyboardIme"), + getPackageNames(enabledImisForSystemReadyLocaleHi)); } @SmallTest @@ -271,4 +384,14 @@ public class InputMethodTest extends InstrumentationTestCase { return createDummyInputMethodInfo("DummyNonDefaultJaJPKeyboardImeWithoutSubtypes", "dummy.keyboard2", "DummyKeyboard2", !IS_AUX, !IS_DEFAULT, NO_SUBTYPE); } + + private static InputMethodInfo createDefaultDummyHinglishKeyboardIme() { + final ArrayList<InputMethodSubtype> subtypes = new ArrayList<InputMethodSubtype>(); + subtypes.add(createDummyInputMethodSubtype("en_IN", "keyboard", !IS_AUX, !IS_AUTO, + IS_ASCII_CAPABLE)); + subtypes.add(createDummyInputMethodSubtype("hi", "keyboard", !IS_AUX, !IS_AUTO, + !IS_ASCII_CAPABLE)); // not AsciiCapable! + return createDummyInputMethodInfo("DummyDefaultHinglishKeyboardIme", "dummy.keyboard2", + "DummyKeyboard2", !IS_AUX, IS_DEFAULT, subtypes); + } } |