aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java')
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java31
1 files changed, 14 insertions, 17 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
index 75bd60999..ab7d1b28d 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
@@ -18,9 +18,7 @@ package com.android.inputmethod.keyboard;
import android.content.Context;
import android.content.res.Resources;
-import android.preference.PreferenceManager;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
import android.view.ContextThemeWrapper;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodInfo;
@@ -32,32 +30,30 @@ import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.RichInputMethodManager;
import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils;
-import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.ResourceUtils;
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
import java.util.ArrayList;
import java.util.Locale;
-@SmallTest
-public class KeyboardLayoutSetTestsBase extends AndroidTestCase {
+public abstract class KeyboardLayoutSetTestsBase extends AndroidTestCase {
// All input method subtypes of LatinIME.
- private final ArrayList<InputMethodSubtype> mAllSubtypesList = CollectionUtils.newArrayList();
- private final ArrayList<InputMethodSubtype> mAsciiCapableSubtypesList =
- CollectionUtils.newArrayList();
- private final ArrayList<InputMethodSubtype> mAdditionalSubtypesList =
- CollectionUtils.newArrayList();
+ private final ArrayList<InputMethodSubtype> mAllSubtypesList = new ArrayList<>();
+ private final ArrayList<InputMethodSubtype> mAsciiCapableSubtypesList = new ArrayList<>();
+ private final ArrayList<InputMethodSubtype> mAdditionalSubtypesList = new ArrayList<>();
private Context mThemeContext;
private int mScreenMetrics;
+ protected abstract int getKeyboardThemeForTests();
+
@Override
protected void setUp() throws Exception {
super.setUp();
mScreenMetrics = mContext.getResources().getInteger(R.integer.config_screen_metrics);
- final KeyboardTheme keyboardTheme = KeyboardTheme.getKeyboardTheme(
- PreferenceManager.getDefaultSharedPreferences(mContext));
+ final KeyboardTheme keyboardTheme = KeyboardTheme.searchKeyboardThemeById(
+ getKeyboardThemeForTests());
mThemeContext = new ContextThemeWrapper(mContext, keyboardTheme.mStyleId);
RichInputMethodManager.init(mThemeContext);
final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
@@ -118,13 +114,13 @@ public class KeyboardLayoutSetTestsBase extends AndroidTestCase {
protected final KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
final EditorInfo editorInfo) {
- return createKeyboardLayoutSet(subtype, editorInfo, false /* isShortcutImeEnabled */,
- false /* showsVoiceInputKey */, false /* isLanguageSwitchKeyEnabled */);
+ return createKeyboardLayoutSet(subtype, editorInfo, false /* voiceInputKeyEnabled */,
+ false /* languageSwitchKeyEnabled */);
}
protected final KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
- final EditorInfo editorInfo, final boolean isShortcutImeEnabled,
- final boolean showsVoiceInputKey, final boolean isLanguageSwitchKeyEnabled) {
+ final EditorInfo editorInfo, final boolean voiceInputKeyEnabled,
+ final boolean languageSwitchKeyEnabled) {
final Context context = mThemeContext;
final Resources res = context.getResources();
final int keyboardWidth = ResourceUtils.getDefaultKeyboardWidth(res);
@@ -132,7 +128,8 @@ public class KeyboardLayoutSetTestsBase extends AndroidTestCase {
final Builder builder = new Builder(context, editorInfo);
builder.setKeyboardGeometry(keyboardWidth, keyboardHeight)
.setSubtype(subtype)
- .setOptions(isShortcutImeEnabled, showsVoiceInputKey, isLanguageSwitchKeyEnabled);
+ .setVoiceInputKeyEnabled(voiceInputKeyEnabled)
+ .setLanguageSwitchKeyEnabled(languageSwitchKeyEnabled);
return builder.build();
}
}