Skip to content
Snippets Groups Projects
Commit 553fd662 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Add some info to test crashes to help diagnose flakiness"

parents b68dd6cd dfbe2bfe
No related branches found
No related tags found
No related merge requests found
......@@ -3253,8 +3253,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// TODO: can this be removed somehow without breaking the tests?
@UsedForTesting
/* package for test */ String getFirstSuggestedWord() {
return mSuggestedWords.size() > 0 ? mSuggestedWords.getWord(0) : null;
/* package for test */ SuggestedWords getSuggestedWords() {
// You may not use this method for anything else than debug
return DEBUG ? mSuggestedWords : null;
}
// DO NOT USE THIS for any other purpose than testing. This is information private to LatinIME.
......@@ -3263,12 +3264,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return mSuggest.isCurrentlyWaitingForMainDictionary();
}
// DO NOT USE THIS for any other purpose than testing. This is information private to LatinIME.
@UsedForTesting
/* package for test */ boolean hasMainDictionary() {
return mSuggest.hasMainDictionary();
}
// DO NOT USE THIS for any other purpose than testing. This can break the keyboard badly.
@UsedForTesting
/* package for test */ void replaceMainDictionaryForTest(final Locale locale) {
......
......@@ -99,7 +99,8 @@ public class InputLogicTestsLanguageWithoutSpaces extends InputTestsBase {
assertEquals("predictions in lang without spaces", "Barack",
mEditText.getText().toString());
// Test the first prediction is displayed
final SuggestedWords suggestedWords = mLatinIME.getSuggestedWords();
assertEquals("predictions in lang without spaces", "Obama",
mLatinIME.getFirstSuggestedWord());
suggestedWords.size() > 0 ? suggestedWords.getWord(0) : null);
}
}
......@@ -84,8 +84,9 @@ public class InputLogicTestsNonEnglish extends InputTestsBase {
type(WORD_TO_TYPE);
sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
runMessages();
final SuggestedWords suggestedWords = mLatinIME.getSuggestedWords();
assertEquals("type word then type space yields predictions for French",
EXPECTED_RESULT, mLatinIME.getFirstSuggestedWord());
EXPECTED_RESULT, suggestedWords.size() > 0 ? suggestedWords.getWord(0) : null);
} finally {
setBooleanPreference(NEXT_WORD_PREDICTION_OPTION, previousNextWordPredictionOption,
defaultNextWordPredictionOption);
......
......@@ -16,6 +16,7 @@
package com.android.inputmethod.latin;
import android.provider.Settings.Secure;
import android.test.suitebuilder.annotation.LargeTest;
import com.android.inputmethod.latin.R;
......@@ -153,7 +154,9 @@ public class PunctuationTests extends InputTestsBase {
final String WORD_TO_TYPE = "you'f ";
final String EXPECTED_RESULT = "you'd ";
type(WORD_TO_TYPE);
assertEquals("auto-correction with single quote inside",
assertEquals("auto-correction with single quote inside. ID = "
+ Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID)
+ " ; Suggestions = " + mLatinIME.getSuggestedWords(),
EXPECTED_RESULT, mEditText.getText().toString());
}
......@@ -161,7 +164,9 @@ public class PunctuationTests extends InputTestsBase {
final String WORD_TO_TYPE = "'tgis' ";
final String EXPECTED_RESULT = "'this' ";
type(WORD_TO_TYPE);
assertEquals("auto-correction with single quotes around",
assertEquals("auto-correction with single quotes around. ID = "
+ Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID)
+ " ; Suggestions = " + mLatinIME.getSuggestedWords(),
EXPECTED_RESULT, mEditText.getText().toString());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment