aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-10-10 17:02:55 +0900
committerTadashi G. Takaoka <takaoka@google.com>2014-10-10 17:42:03 +0900
commit4f17f3df461df13ecda64732e15f40ab9d534d1d (patch)
treea4e681a496d9f759b97106a5ea54ca4cc9f6fec6 /tests
parent5d2d852eb0caaf7416c159f83d51e07b1ca87e30 (diff)
downloadlatinime-4f17f3df461df13ecda64732e15f40ab9d534d1d.tar.gz
latinime-4f17f3df461df13ecda64732e15f40ab9d534d1d.tar.xz
latinime-4f17f3df461df13ecda64732e15f40ab9d534d1d.zip
Fixing keyboard theme selection
Bug: 17937287 Change-Id: I476045980843c5897820cd544daea06fa991acb5
Diffstat (limited to 'tests')
-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() {