diff options
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputTestsBase.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputTestsBase.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java index ab4060a86..dead53da2 100644 --- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java +++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java @@ -66,7 +66,8 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { protected static final int DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS = 200; // We wait for gesture computation for this delay protected static final int DELAY_TO_WAIT_FOR_GESTURE_MILLIS = 200; - private final int TIMEOUT_TO_WAIT_FOR_LOADING_MAIN_DICTIONARY_IN_SECONDS = 60; + // If a dictionary takes longer to load, we could have serious problems. + private final int TIMEOUT_TO_WAIT_FOR_LOADING_MAIN_DICTIONARY_IN_SECONDS = 5; // Type for a test phony dictionary private static final String TYPE_TEST = "test"; @@ -106,12 +107,15 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { throw new RuntimeException("Expected one span, found " + spans.length); } } + public SuggestionSpan getSpan() { + return (SuggestionSpan) mSpan; + } public boolean isAutoCorrectionIndicator() { return (mSpan instanceof SuggestionSpan) && - 0 != (SuggestionSpan.FLAG_AUTO_CORRECTION & ((SuggestionSpan)mSpan).getFlags()); + 0 != (SuggestionSpan.FLAG_AUTO_CORRECTION & getSpan().getFlags()); } public String[] getSuggestions() { - return ((SuggestionSpan)mSpan).getSuggestions(); + return getSpan().getSuggestions(); } } @@ -152,8 +156,6 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { super(LatinIMEForTests.class); } - // 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); @@ -409,7 +411,8 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { } protected void pickSuggestionManually(final String suggestion) { - mLatinIME.pickSuggestionManually(new SuggestedWordInfo(suggestion, 1, + mLatinIME.pickSuggestionManually(new SuggestedWordInfo(suggestion, + "" /* prevWordsContext */, 1 /* score */, SuggestedWordInfo.KIND_CORRECTION, DICTIONARY_TEST, SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */, SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */)); |