aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-10-10 09:32:23 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-10 09:32:23 +0000
commit287d2dcab5f83cea51fc78efa684b209205efdba (patch)
tree38404dcc60c1dba8f6e7070c47940449ce14e3cf /tests/src
parente3bd12a8270783b5d5e1f9e9bb8d8efdca25dce4 (diff)
parent6e565332df385d67d58543879f9d81263e667c06 (diff)
downloadlatinime-287d2dcab5f83cea51fc78efa684b209205efdba.tar.gz
latinime-287d2dcab5f83cea51fc78efa684b209205efdba.tar.xz
latinime-287d2dcab5f83cea51fc78efa684b209205efdba.zip
am 6e565332: Merge "Fixing keyboard theme selection"
* commit '6e565332df385d67d58543879f9d81263e667c06': Fixing keyboard theme selection
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
index 34cf4072f..d642a1073 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
@@ -348,6 +348,31 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
/*
+ * Test that KeyboardTheme array should be sorted by descending order of
+ * {@link KeyboardTheme#mMinApiVersion}.
+ */
+ private static void assertSortedKeyboardThemeArray(final KeyboardTheme[] array) {
+ assertNotNull(array);
+ final int length = array.length;
+ assertTrue("array length=" + length, length > 0);
+ for (int index = 0; index < length - 1; index++) {
+ final KeyboardTheme theme = array[index];
+ final KeyboardTheme nextTheme = array[index + 1];
+ assertTrue("sorted MinApiVersion: "
+ + theme.mThemeName + ": minApiVersion=" + theme.mMinApiVersion,
+ theme.mMinApiVersion >= nextTheme.mMinApiVersion);
+ }
+ }
+
+ public void testSortedKeyboardTheme() {
+ assertSortedKeyboardThemeArray(KeyboardTheme.KEYBOARD_THEMES);
+ }
+
+ public void testSortedAvailableKeyboardTheme() {
+ assertSortedKeyboardThemeArray(KeyboardTheme.getAvailableThemeArray(getContext()));
+ }
+
+ /*
* Test for missing selected theme.
*/
private static KeyboardTheme[] LIMITED_THEMES = {
@@ -356,6 +381,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
};
static {
Arrays.sort(LIMITED_THEMES);
+ assertSortedKeyboardThemeArray(LIMITED_THEMES);
}
public void testMissingSelectedThemeIcs() {