aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-04-04 14:30:42 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-04-05 17:25:15 +0900
commit11d9ee742f8ff3fb31b0e3beb32ee4870c63d8e3 (patch)
treed508dde42b24796c16e809e62a6fda9434489271 /tests
parentcb389ef0d6e6eec737c249e1729c2a2cdc30f341 (diff)
downloadlatinime-11d9ee742f8ff3fb31b0e3beb32ee4870c63d8e3.tar.gz
latinime-11d9ee742f8ff3fb31b0e3beb32ee4870c63d8e3.tar.xz
latinime-11d9ee742f8ff3fb31b0e3beb32ee4870c63d8e3.zip
Use keyboardSet extra value of subtype to specify layout type
Change-Id: Ice1f345a08a8d760e3b847c885c4072e3e142c97
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/inputmethod/latin/SubtypeLocaleTests.java26
1 files changed, 8 insertions, 18 deletions
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(