Merge "Enable DEBUG mode for logic tests."
This commit is contained in:
commit
482588c5a2
1 changed files with 16 additions and 0 deletions
|
@ -18,6 +18,8 @@ package com.android.inputmethod.latin;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.test.ServiceTestCase;
|
import android.test.ServiceTestCase;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -35,6 +37,8 @@ import com.android.inputmethod.keyboard.KeyboardActionListener;
|
||||||
|
|
||||||
public class InputLogicTests extends ServiceTestCase<LatinIME> {
|
public class InputLogicTests extends ServiceTestCase<LatinIME> {
|
||||||
|
|
||||||
|
private static final String PREF_DEBUG_MODE = "debug_mode";
|
||||||
|
|
||||||
private LatinIME mLatinIME;
|
private LatinIME mLatinIME;
|
||||||
private TextView mTextView;
|
private TextView mTextView;
|
||||||
|
|
||||||
|
@ -42,6 +46,16 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
|
||||||
super(LatinIME.class);
|
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
|
@Override
|
||||||
protected void setUp() {
|
protected void setUp() {
|
||||||
try {
|
try {
|
||||||
|
@ -54,7 +68,9 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
|
||||||
mTextView.setEnabled(true);
|
mTextView.setEnabled(true);
|
||||||
setupService();
|
setupService();
|
||||||
mLatinIME = getService();
|
mLatinIME = getService();
|
||||||
|
final boolean previousDebugSetting = setDebugMode(true);
|
||||||
mLatinIME.onCreate();
|
mLatinIME.onCreate();
|
||||||
|
setDebugMode(previousDebugSetting);
|
||||||
final EditorInfo ei = new EditorInfo();
|
final EditorInfo ei = new EditorInfo();
|
||||||
final InputConnection ic = mTextView.onCreateInputConnection(ei);
|
final InputConnection ic = mTextView.onCreateInputConnection(ei);
|
||||||
final LayoutInflater inflater =
|
final LayoutInflater inflater =
|
||||||
|
|
Loading…
Reference in a new issue