aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputLogicTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-01-20 02:29:56 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-01-20 02:29:56 -0800
commite81b375a34ccfae000a25c56517004bb290a0996 (patch)
tree06a65f409385a81742ecb7212be30286320edd71 /tests/src/com/android/inputmethod/latin/InputLogicTests.java
parent141a554430f9f9d04e68a75bc22f015fad3ba47e (diff)
parent482588c5a2548d5f7647f2349b40dabf77b0ecc6 (diff)
downloadlatinime-e81b375a34ccfae000a25c56517004bb290a0996.tar.gz
latinime-e81b375a34ccfae000a25c56517004bb290a0996.tar.xz
latinime-e81b375a34ccfae000a25c56517004bb290a0996.zip
am 482588c5: Merge "Enable DEBUG mode for logic tests."
* commit '482588c5a2548d5f7647f2349b40dabf77b0ecc6': Enable DEBUG mode for logic tests.
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index 18afe1198..06ee5bffa 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -18,6 +18,8 @@ package com.android.inputmethod.latin;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
import android.test.ServiceTestCase;
import android.text.InputType;
import android.util.Log;
@@ -35,6 +37,8 @@ import com.android.inputmethod.keyboard.KeyboardActionListener;
public class InputLogicTests extends ServiceTestCase<LatinIME> {
+ private static final String PREF_DEBUG_MODE = "debug_mode";
+
private LatinIME mLatinIME;
private TextView mTextView;
@@ -42,6 +46,16 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
super(LatinIME.class);
}
+ // returns the previous setting value
+ private boolean setDebugMode(final boolean mode) {
+ final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mLatinIME);
+ final boolean previousDebugSetting = prefs.getBoolean(PREF_DEBUG_MODE, false);
+ final SharedPreferences.Editor editor = prefs.edit();
+ editor.putBoolean(PREF_DEBUG_MODE, true);
+ editor.commit();
+ return previousDebugSetting;
+ }
+
@Override
protected void setUp() {
try {
@@ -54,7 +68,9 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
mTextView.setEnabled(true);
setupService();
mLatinIME = getService();
+ final boolean previousDebugSetting = setDebugMode(true);
mLatinIME.onCreate();
+ setDebugMode(previousDebugSetting);
final EditorInfo ei = new EditorInfo();
final InputConnection ic = mTextView.onCreateInputConnection(ei);
final LayoutInflater inflater =