diff options
author | 2014-10-03 23:48:53 +0000 | |
---|---|---|
committer | 2014-10-03 23:48:53 +0000 | |
commit | faefad5b0fd5b188d7eefa66dfaf33c47e181c03 (patch) | |
tree | 3e2be7dda60aa1863ca851c2944a2cde9b5b2a72 /tests | |
parent | 15dbd38283fc9c8fdfd2540f1d94d4dbf2eabcb5 (diff) | |
download | latinime-faefad5b0fd5b188d7eefa66dfaf33c47e181c03.tar.gz latinime-faefad5b0fd5b188d7eefa66dfaf33c47e181c03.tar.xz latinime-faefad5b0fd5b188d7eefa66dfaf33c47e181c03.zip |
Revert "[ML14] Forward the locale list to relevant places"
This reverts commit 15dbd38283fc9c8fdfd2540f1d94d4dbf2eabcb5.
Bug: 11230254
Reverting due to unit test breakage.
Change-Id: Icf29ba5c808c754515aef2d1b4162d72f606acfe
Diffstat (limited to 'tests')
4 files changed, 20 insertions, 37 deletions
diff --git a/tests/src/com/android/inputmethod/latin/personalization/ContextualDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/ContextualDictionaryTests.java index 011309942..565fadb2a 100644 --- a/tests/src/com/android/inputmethod/latin/personalization/ContextualDictionaryTests.java +++ b/tests/src/com/android/inputmethod/latin/personalization/ContextualDictionaryTests.java @@ -42,9 +42,8 @@ public class ContextualDictionaryTests extends AndroidTestCase { final ArrayList<String> dictTypes = new ArrayList<>(); dictTypes.add(Dictionary.TYPE_CONTEXTUAL); final DictionaryFacilitator dictionaryFacilitator = new DictionaryFacilitator(); - dictionaryFacilitator.resetDictionariesForTesting(getContext(), - new Locale[] { LOCALE_EN_US }, dictTypes, new HashMap<String, File>(), - new HashMap<String, Map<String, String>>()); + dictionaryFacilitator.resetDictionariesForTesting(getContext(), LOCALE_EN_US, dictTypes, + new HashMap<String, File>(), new HashMap<String, Map<String, String>>()); return dictionaryFacilitator; } diff --git a/tests/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryTests.java index afabbbd38..4e7e8140a 100644 --- a/tests/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryTests.java +++ b/tests/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryTests.java @@ -55,9 +55,8 @@ public class PersonalizationDictionaryTests extends AndroidTestCase { dictTypes.add(Dictionary.TYPE_MAIN); dictTypes.add(Dictionary.TYPE_PERSONALIZATION); final DictionaryFacilitator dictionaryFacilitator = new DictionaryFacilitator(getContext()); - dictionaryFacilitator.resetDictionariesForTesting(getContext(), - new Locale[] { LOCALE_EN_US }, dictTypes, new HashMap<String, File>(), - new HashMap<String, Map<String, String>>()); + dictionaryFacilitator.resetDictionariesForTesting(getContext(), LOCALE_EN_US, dictTypes, + new HashMap<String, File>(), new HashMap<String, Map<String, String>>()); // Set subtypes. RichInputMethodManager.init(getContext()); final RichInputMethodManager richImm = RichInputMethodManager.getInstance(); diff --git a/tests/src/com/android/inputmethod/latin/utils/SpacebarLanguageUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/SpacebarLanguageUtilsTests.java index 8810eaf37..b766ab2e7 100644 --- a/tests/src/com/android/inputmethod/latin/utils/SpacebarLanguageUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/SpacebarLanguageUtilsTests.java @@ -119,17 +119,12 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { final String subtypeName = SubtypeLocaleUtils .getSubtypeDisplayNameInSystemLocale(subtype.getRawSubtype()); final String spacebarText = subtype.getFullDisplayName(); - final Locale[] locales = subtype.getLocales(); - if (1 == locales.length) { - final String languageName = SubtypeLocaleUtils - .getSubtypeLocaleDisplayName(locales[0].toString()); - if (subtype.isNoLanguage()) { - assertFalse(subtypeName, spacebarText.contains(languageName)); - } else { - assertTrue(subtypeName, spacebarText.contains(languageName)); - } + final String languageName = SubtypeLocaleUtils + .getSubtypeLocaleDisplayName(subtype.getLocale()); + if (subtype.isNoLanguage()) { + assertFalse(subtypeName, spacebarText.contains(languageName)); } else { - // TODO: test multi-lingual subtype spacebar display + assertTrue(subtypeName, spacebarText.contains(languageName)); } } } @@ -138,14 +133,8 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { for (final RichInputMethodSubtype subtype : mSubtypesList) { final String subtypeName = SubtypeLocaleUtils .getSubtypeDisplayNameInSystemLocale(subtype.getRawSubtype()); - final Locale[] locales = subtype.getLocales(); - if (locales.length > 1) { - // TODO: test multi-lingual subtype spacebar display - continue; - } - final Locale locale = locales[0]; if (SubtypeLocaleUtils.sExceptionalLocaleDisplayedInRootLocale.contains( - locale.toString())) { + subtype.getLocale())) { // Skip test because the language part of this locale string doesn't represent // the locale to be displayed on the spacebar (for example hi_ZZ and Hinglish). continue; @@ -155,6 +144,7 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { assertEquals(subtypeName, SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName( subtype.getRawSubtype()), spacebarText); } else { + final Locale locale = SubtypeLocaleUtils.getSubtypeLocale(subtype); assertEquals(subtypeName, SubtypeLocaleUtils.getSubtypeLocaleDisplayName(locale.getLanguage()), spacebarText); diff --git a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java index 02be5138f..c095e6831 100644 --- a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java @@ -111,19 +111,14 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { for (final RichInputMethodSubtype subtype : mSubtypesList) { final String subtypeName = SubtypeLocaleUtils .getSubtypeDisplayNameInSystemLocale(subtype.getRawSubtype()); - final Locale[] locales = subtype.getLocales(); - if (1 == locales.length) { - if (subtype.isNoLanguage()) { - final String layoutName = SubtypeLocaleUtils - .getKeyboardLayoutSetDisplayName(subtype.getRawSubtype()); - assertTrue(subtypeName, subtypeName.contains(layoutName)); - } else { - final String languageName = SubtypeLocaleUtils - .getSubtypeLocaleDisplayNameInSystemLocale(locales[0].toString()); - assertTrue(subtypeName, subtypeName.contains(languageName)); - } + if (subtype.isNoLanguage()) { + final String layoutName = SubtypeLocaleUtils + .getKeyboardLayoutSetDisplayName(subtype.getRawSubtype()); + assertTrue(subtypeName, subtypeName.contains(layoutName)); } else { - // TODO: test multi-lingual subtype spacebar display + final String languageName = SubtypeLocaleUtils + .getSubtypeLocaleDisplayNameInSystemLocale(subtype.getLocale()); + assertTrue(subtypeName, subtypeName.contains(languageName)); } } } @@ -320,9 +315,9 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { .getSubtypeDisplayNameInSystemLocale(rawSubtype); if (rawSubtype.equals(ARABIC) || rawSubtype.equals(FARSI) || rawSubtype.equals(HEBREW)) { - assertTrue(subtypeName, subtype.isRtlSubtype()); + assertTrue(subtypeName, SubtypeLocaleUtils.isRtlLanguage(subtype)); } else { - assertFalse(subtypeName, subtype.isRtlSubtype()); + assertFalse(subtypeName, SubtypeLocaleUtils.isRtlLanguage(subtype)); } } } |