aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputTestsBase.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputTestsBase.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputTestsBase.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
index 9276b40df..838effe2c 100644
--- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java
+++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
@@ -90,14 +90,21 @@ public class InputTestsBase extends ServiceTestCase<LatinIME> {
super(LatinIME.class);
}
- // returns the previous setting value
- protected boolean setDebugMode(final boolean mode) {
+ // TODO: Isn't there a way to make this generic somehow? We can take a <T> and return a <T>
+ // but we'd have to dispatch types on editor.put...() functions
+ protected boolean setBooleanPreference(final String key, final boolean value,
+ final boolean defaultValue) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mLatinIME);
- final boolean previousDebugSetting = prefs.getBoolean(PREF_DEBUG_MODE, false);
+ final boolean previousSetting = prefs.getBoolean(key, defaultValue);
final SharedPreferences.Editor editor = prefs.edit();
- editor.putBoolean(PREF_DEBUG_MODE, mode);
+ editor.putBoolean(key, value);
editor.commit();
- return previousDebugSetting;
+ return previousSetting;
+ }
+
+ // returns the previous setting value
+ protected boolean setDebugMode(final boolean value) {
+ return setBooleanPreference(PREF_DEBUG_MODE, value, false);
}
// overload this to configure preferences in a way specific to a subclass's tests
@@ -271,6 +278,11 @@ public class InputTestsBase extends ServiceTestCase<LatinIME> {
waitForDictionaryToBeLoaded();
}
+ protected void pickSuggestionManually(final int index, final CharSequence suggestion) {
+ mLatinIME.pickSuggestionManually(index, suggestion,
+ KeyboardActionListener.NOT_A_TOUCH_COORDINATE,
+ KeyboardActionListener.NOT_A_TOUCH_COORDINATE);
+ }
// Helper to avoid writing the try{}catch block each time
protected static void sleep(final int milliseconds) {