From 11d9ee742f8ff3fb31b0e3beb32ee4870c63d8e3 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 4 Apr 2012 14:30:42 +0900 Subject: Use keyboardSet extra value of subtype to specify layout type Change-Id: Ice1f345a08a8d760e3b847c885c4072e3e142c97 --- .../inputmethod/latin/SubtypeLocaleTests.java | 26 +++++++--------------- 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'tests/src') diff --git a/tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java b/tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java index 6180ff5f9..4ac765782 100644 --- a/tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java +++ b/tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java @@ -22,6 +22,8 @@ import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; +import com.android.inputmethod.keyboard.KeyboardLayoutSet; + import java.util.ArrayList; import java.util.Locale; @@ -58,29 +60,17 @@ public class SubtypeLocaleTests extends AndroidTestCase { assertTrue("Can not find keyboard subtype", mSubtypesList.size() > 0); } - private static Locale getSubtypeLocale(InputMethodSubtype subtype) { - return LocaleUtils.constructLocaleFromString(subtype.getLocale()); - } - - private static Locale getKeyboardLocale(InputMethodSubtype subtype) { - final String subtypeLocaleString = subtype.containsExtraValueKey( - LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LOCALE) - ? subtype.getExtraValueOf(LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LOCALE) - : subtype.getLocale(); - return LocaleUtils.constructLocaleFromString(subtypeLocaleString); - } - public void testFullDisplayName() { final StringBuilder messages = new StringBuilder(); int failedCount = 0; for (final InputMethodSubtype subtype : mSubtypesList) { - final Locale locale = getKeyboardLocale(subtype); + final Locale locale = KeyboardLayoutSet.getKeyboardLayoutSetLocale(subtype); if (locale.getLanguage().equals(SubtypeLocale.NO_LANGUAGE)) { // This is special language name for language agnostic usage. continue; } final String keyboardName = SubtypeLocale.getFullDisplayName(locale); - final String languageName = SubtypeLocale.toTitleCase( + final String languageName = StringUtils.toTitleCase( locale.getDisplayLanguage(locale), locale); if (!keyboardName.contains(languageName)) { failedCount++; @@ -104,13 +94,13 @@ public class SubtypeLocaleTests extends AndroidTestCase { final StringBuilder messages = new StringBuilder(); int failedCount = 0; for (final InputMethodSubtype subtype : mSubtypesList) { - final Locale locale = getKeyboardLocale(subtype); + final Locale locale = KeyboardLayoutSet.getKeyboardLayoutSetLocale(subtype); if (locale.getLanguage().equals(SubtypeLocale.NO_LANGUAGE)) { // This is special language name for language agnostic usage. continue; } final String keyboardName = SubtypeLocale.getMiddleDisplayName(locale); - final String languageName = SubtypeLocale.toTitleCase( + final String languageName = StringUtils.toTitleCase( locale.getDisplayLanguage(locale), locale); if (!keyboardName.equals(languageName)) { failedCount++; @@ -131,13 +121,13 @@ public class SubtypeLocaleTests extends AndroidTestCase { final StringBuilder messages = new StringBuilder(); int failedCount = 0; for (final InputMethodSubtype subtype : mSubtypesList) { - final Locale locale = getKeyboardLocale(subtype); + final Locale locale = KeyboardLayoutSet.getKeyboardLayoutSetLocale(subtype); if (locale.getCountry().equals(SubtypeLocale.QWERTY)) { // This is special country code for QWERTY keyboard. continue; } final String keyboardName = SubtypeLocale.getShortDisplayName(locale); - final String languageCode = SubtypeLocale.toTitleCase(locale.getLanguage(), locale); + final String languageCode = StringUtils.toTitleCase(locale.getLanguage(), locale); if (!keyboardName.equals(languageCode)) { failedCount++; messages.append(String.format( -- cgit v1.2.3-83-g751a