diff options
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputTestsBase.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputTestsBase.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java index 4dfe22800..9276b40df 100644 --- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java +++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java @@ -100,6 +100,17 @@ public class InputTestsBase extends ServiceTestCase<LatinIME> { return previousDebugSetting; } + // overload this to configure preferences in a way specific to a subclass's tests + protected void configurePreferences() { + // please avoid changing preferences any more than is necessary, as an interruption + // during a test will leave the user's preferences in a bad state. + } + + // restore any preferences set in configurePreferences() + protected void restorePreferences() { + // undo any effects from configurePreferences() + } + @Override protected void setUp() { try { @@ -113,6 +124,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIME> { setupService(); mLatinIME = getService(); final boolean previousDebugSetting = setDebugMode(true); + configurePreferences(); mLatinIME.onCreate(); setDebugMode(previousDebugSetting); initSubtypeMap(); @@ -134,6 +146,12 @@ public class InputTestsBase extends ServiceTestCase<LatinIME> { changeLanguage("en_US"); } + @Override + protected void tearDown() throws Exception { + super.tearDown(); + restorePreferences(); + } + private void initSubtypeMap() { final InputMethodManager imm = (InputMethodManager)mLatinIME.getSystemService( Context.INPUT_METHOD_SERVICE); |