am bd0591ce: Merge "Make InputLogicTest more robust"
* commit 'bd0591ce62b3b6f084ad560ddbddf20505d3157d': Make InputLogicTest more robustmain
commit
e6cd4aba1e
|
@ -55,8 +55,8 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
|
||||||
stopTestModeInNativeCode();
|
stopTestModeInNativeCode();
|
||||||
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addUnigramWord(final BinaryDictionary binaryDictionary, final String word,
|
private void addUnigramWord(final BinaryDictionary binaryDictionary, final String word,
|
||||||
|
|
|
@ -43,16 +43,6 @@ public class BinaryDictionaryTests extends AndroidTestCase {
|
||||||
private static final String TEST_DICT_FILE_EXTENSION = ".testDict";
|
private static final String TEST_DICT_FILE_EXTENSION = ".testDict";
|
||||||
private static final String TEST_LOCALE = "test";
|
private static final String TEST_LOCALE = "test";
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setUp() throws Exception {
|
|
||||||
super.setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tearDown() throws Exception {
|
|
||||||
super.tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
private File createEmptyDictionaryAndGetFile(final String dictId,
|
private File createEmptyDictionaryAndGetFile(final String dictId,
|
||||||
final int formatVersion) throws IOException {
|
final int formatVersion) throws IOException {
|
||||||
if (formatVersion == FormatSpec.VERSION4) {
|
if (formatVersion == FormatSpec.VERSION4) {
|
||||||
|
|
|
@ -21,16 +21,6 @@ import android.test.suitebuilder.annotation.SmallTest;
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public class EditDistanceTests extends AndroidTestCase {
|
public class EditDistanceTests extends AndroidTestCase {
|
||||||
@Override
|
|
||||||
protected void setUp() throws Exception {
|
|
||||||
super.setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tearDown() throws Exception {
|
|
||||||
super.tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dist(kitten, sitting) == 3
|
* dist(kitten, sitting) == 3
|
||||||
*
|
*
|
||||||
|
|
|
@ -38,6 +38,8 @@ import android.widget.FrameLayout;
|
||||||
import com.android.inputmethod.keyboard.Key;
|
import com.android.inputmethod.keyboard.Key;
|
||||||
import com.android.inputmethod.keyboard.Keyboard;
|
import com.android.inputmethod.keyboard.Keyboard;
|
||||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||||
|
import com.android.inputmethod.latin.settings.DebugSettings;
|
||||||
|
import com.android.inputmethod.latin.settings.Settings;
|
||||||
import com.android.inputmethod.latin.utils.LocaleUtils;
|
import com.android.inputmethod.latin.utils.LocaleUtils;
|
||||||
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
|
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
|
||||||
|
|
||||||
|
@ -47,8 +49,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
||||||
private static final String TAG = InputTestsBase.class.getSimpleName();
|
private static final String TAG = InputTestsBase.class.getSimpleName();
|
||||||
|
|
||||||
private static final String PREF_DEBUG_MODE = "debug_mode";
|
|
||||||
private static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold";
|
|
||||||
// Default value for auto-correction threshold. This is the string representation of the
|
// Default value for auto-correction threshold. This is the string representation of the
|
||||||
// index in the resources array of auto-correction threshold settings.
|
// index in the resources array of auto-correction threshold settings.
|
||||||
private static final String DEFAULT_AUTO_CORRECTION_THRESHOLD = "1";
|
private static final String DEFAULT_AUTO_CORRECTION_THRESHOLD = "1";
|
||||||
|
@ -65,6 +65,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
||||||
protected View mInputView;
|
protected View mInputView;
|
||||||
protected InputConnection mInputConnection;
|
protected InputConnection mInputConnection;
|
||||||
private boolean mPreviousDebugSetting;
|
private boolean mPreviousDebugSetting;
|
||||||
|
private boolean mPreviousBigramPredictionSettings;
|
||||||
private String mPreviousAutoCorrectSetting;
|
private String mPreviousAutoCorrectSetting;
|
||||||
|
|
||||||
// A helper class to ease span tests
|
// A helper class to ease span tests
|
||||||
|
@ -163,7 +164,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
||||||
|
|
||||||
// returns the previous setting value
|
// returns the previous setting value
|
||||||
protected boolean setDebugMode(final boolean value) {
|
protected boolean setDebugMode(final boolean value) {
|
||||||
return setBooleanPreference(PREF_DEBUG_MODE, value, false);
|
return setBooleanPreference(DebugSettings.PREF_DEBUG_MODE, value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EditorInfo enrichEditorInfo(final EditorInfo ei) {
|
protected EditorInfo enrichEditorInfo(final EditorInfo ei) {
|
||||||
|
@ -184,7 +185,9 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
||||||
setupService();
|
setupService();
|
||||||
mLatinIME = getService();
|
mLatinIME = getService();
|
||||||
mPreviousDebugSetting = setDebugMode(true);
|
mPreviousDebugSetting = setDebugMode(true);
|
||||||
mPreviousAutoCorrectSetting = setStringPreference(PREF_AUTO_CORRECTION_THRESHOLD,
|
mPreviousBigramPredictionSettings = setBooleanPreference(Settings.PREF_BIGRAM_PREDICTIONS,
|
||||||
|
true, true /* defaultValue */);
|
||||||
|
mPreviousAutoCorrectSetting = setStringPreference(Settings.PREF_AUTO_CORRECTION_THRESHOLD,
|
||||||
DEFAULT_AUTO_CORRECTION_THRESHOLD, DEFAULT_AUTO_CORRECTION_THRESHOLD);
|
DEFAULT_AUTO_CORRECTION_THRESHOLD, DEFAULT_AUTO_CORRECTION_THRESHOLD);
|
||||||
mLatinIME.onCreate();
|
mLatinIME.onCreate();
|
||||||
EditorInfo ei = new EditorInfo();
|
EditorInfo ei = new EditorInfo();
|
||||||
|
@ -209,11 +212,14 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() {
|
protected void tearDown() throws Exception {
|
||||||
mLatinIME.mHandler.removeAllMessages();
|
mLatinIME.mHandler.removeAllMessages();
|
||||||
setStringPreference(PREF_AUTO_CORRECTION_THRESHOLD, mPreviousAutoCorrectSetting,
|
setBooleanPreference(Settings.PREF_BIGRAM_PREDICTIONS, mPreviousBigramPredictionSettings,
|
||||||
|
true /* defaultValue */);
|
||||||
|
setStringPreference(Settings.PREF_AUTO_CORRECTION_THRESHOLD, mPreviousAutoCorrectSetting,
|
||||||
DEFAULT_AUTO_CORRECTION_THRESHOLD);
|
DEFAULT_AUTO_CORRECTION_THRESHOLD);
|
||||||
setDebugMode(mPreviousDebugSetting);
|
setDebugMode(mPreviousDebugSetting);
|
||||||
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to run the messages added to the handler from LatinIME. The only way to do
|
// We need to run the messages added to the handler from LatinIME. The only way to do
|
||||||
|
|
|
@ -115,9 +115,9 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
|
||||||
// Quit test mode.
|
// Quit test mode.
|
||||||
BinaryDictionary.setCurrentTimeForTest(-1);
|
BinaryDictionary.setCurrentTimeForTest(-1);
|
||||||
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateWords(final int number, final Random random) {
|
private void generateWords(final int number, final Random random) {
|
||||||
|
|
Loading…
Reference in New Issue