aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-04-05 19:17:30 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-05 19:17:30 -0700
commitfc169c726a12f47c3641fc2570d16aa26825710c (patch)
tree0bb14631cb79c283adbc99991432d990bddbf842 /tests/src/com/android/inputmethod
parent0cedde120b02629ab86efd1ef015ad1ee2d8783a (diff)
parent11d9ee742f8ff3fb31b0e3beb32ee4870c63d8e3 (diff)
downloadlatinime-fc169c726a12f47c3641fc2570d16aa26825710c.tar.gz
latinime-fc169c726a12f47c3641fc2570d16aa26825710c.tar.xz
latinime-fc169c726a12f47c3641fc2570d16aa26825710c.zip
Merge "Use keyboardSet extra value of subtype to specify layout type"
Diffstat (limited to 'tests/src/com/android/inputmethod')
-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(