am 2a2d324e: am 8380f921: Fix a bug where the top prediction would disappear.
* commit '2a2d324eb627807a9d09b491fbb4ac78ffb253fc': Fix a bug where the top prediction would disappear.main
commit
96522da9eb
|
@ -68,7 +68,7 @@ public final class SuggestionSpanUtils {
|
||||||
public static CharSequence getTextWithSuggestionSpan(final Context context,
|
public static CharSequence getTextWithSuggestionSpan(final Context context,
|
||||||
final String pickedWord, final SuggestedWords suggestedWords) {
|
final String pickedWord, final SuggestedWords suggestedWords) {
|
||||||
if (TextUtils.isEmpty(pickedWord) || suggestedWords.isEmpty()
|
if (TextUtils.isEmpty(pickedWord) || suggestedWords.isEmpty()
|
||||||
|| suggestedWords.mIsPrediction || suggestedWords.isPunctuationSuggestions()) {
|
|| suggestedWords.isPrediction() || suggestedWords.isPunctuationSuggestions()) {
|
||||||
return pickedWord;
|
return pickedWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1052,7 +1052,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
applicationSpecifiedCompletions);
|
applicationSpecifiedCompletions);
|
||||||
final SuggestedWords suggestedWords = new SuggestedWords(applicationSuggestedWords,
|
final SuggestedWords suggestedWords = new SuggestedWords(applicationSuggestedWords,
|
||||||
null /* rawSuggestions */, false /* typedWordValid */, false /* willAutoCorrect */,
|
null /* rawSuggestions */, false /* typedWordValid */, false /* willAutoCorrect */,
|
||||||
false /* isObsoleteSuggestions */, false /* isPrediction */,
|
false /* isObsoleteSuggestions */,
|
||||||
SuggestedWords.INPUT_STYLE_APPLICATION_SPECIFIED /* inputStyle */);
|
SuggestedWords.INPUT_STYLE_APPLICATION_SPECIFIED /* inputStyle */);
|
||||||
// When in fullscreen mode, show completions generated by the application forcibly
|
// When in fullscreen mode, show completions generated by the application forcibly
|
||||||
setSuggestedWords(suggestedWords);
|
setSuggestedWords(suggestedWords);
|
||||||
|
|
|
@ -35,7 +35,6 @@ public final class PunctuationSuggestions extends SuggestedWords {
|
||||||
false /* typedWordValid */,
|
false /* typedWordValid */,
|
||||||
false /* hasAutoCorrectionCandidate */,
|
false /* hasAutoCorrectionCandidate */,
|
||||||
false /* isObsoleteSuggestions */,
|
false /* isObsoleteSuggestions */,
|
||||||
false /* isPrediction */,
|
|
||||||
INPUT_STYLE_NONE /* inputStyle */);
|
INPUT_STYLE_NONE /* inputStyle */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,9 +120,9 @@ public final class Suggest {
|
||||||
// and calls the callback function with the suggestions.
|
// and calls the callback function with the suggestions.
|
||||||
private void getSuggestedWordsForNonBatchInput(final WordComposer wordComposer,
|
private void getSuggestedWordsForNonBatchInput(final WordComposer wordComposer,
|
||||||
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
final PrevWordsInfo prevWordsInfo, final ProximityInfo proximityInfo,
|
||||||
final SettingsValuesForSuggestion settingsValuesForSuggestion, final int inputStyle,
|
final SettingsValuesForSuggestion settingsValuesForSuggestion,
|
||||||
final boolean isCorrectionEnabled, final int sequenceNumber,
|
final int inputStyleIfNotPrediction, final boolean isCorrectionEnabled,
|
||||||
final OnGetSuggestedWordsCallback callback) {
|
final int sequenceNumber, final OnGetSuggestedWordsCallback callback) {
|
||||||
final String typedWord = wordComposer.getTypedWord();
|
final String typedWord = wordComposer.getTypedWord();
|
||||||
final int trailingSingleQuotesCount = StringUtils.getTrailingSingleQuotesCount(typedWord);
|
final int trailingSingleQuotesCount = StringUtils.getTrailingSingleQuotesCount(typedWord);
|
||||||
final String consideredWord = trailingSingleQuotesCount > 0
|
final String consideredWord = trailingSingleQuotesCount > 0
|
||||||
|
@ -186,6 +186,8 @@ public final class Suggest {
|
||||||
suggestionsList = suggestionsContainer;
|
suggestionsList = suggestionsContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int inputStyle = resultsArePredictions ? SuggestedWords.INPUT_STYLE_PREDICTION :
|
||||||
|
inputStyleIfNotPrediction;
|
||||||
callback.onGetSuggestedWords(new SuggestedWords(suggestionsList,
|
callback.onGetSuggestedWords(new SuggestedWords(suggestionsList,
|
||||||
suggestionResults.mRawSuggestions,
|
suggestionResults.mRawSuggestions,
|
||||||
// TODO: this first argument is lying. If this is a whitelisted word which is an
|
// TODO: this first argument is lying. If this is a whitelisted word which is an
|
||||||
|
@ -193,8 +195,7 @@ public final class Suggest {
|
||||||
// rename the attribute or change the value.
|
// rename the attribute or change the value.
|
||||||
!resultsArePredictions && !allowsToBeAutoCorrected /* typedWordValid */,
|
!resultsArePredictions && !allowsToBeAutoCorrected /* typedWordValid */,
|
||||||
hasAutoCorrection /* willAutoCorrect */,
|
hasAutoCorrection /* willAutoCorrect */,
|
||||||
false /* isObsoleteSuggestions */, resultsArePredictions,
|
false /* isObsoleteSuggestions */, inputStyle, sequenceNumber));
|
||||||
inputStyle, sequenceNumber));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieves suggestions for the batch input
|
// Retrieves suggestions for the batch input
|
||||||
|
@ -244,7 +245,6 @@ public final class Suggest {
|
||||||
true /* typedWordValid */,
|
true /* typedWordValid */,
|
||||||
false /* willAutoCorrect */,
|
false /* willAutoCorrect */,
|
||||||
false /* isObsoleteSuggestions */,
|
false /* isObsoleteSuggestions */,
|
||||||
false /* isPrediction */,
|
|
||||||
inputStyle, sequenceNumber));
|
inputStyle, sequenceNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,14 +38,15 @@ public class SuggestedWords {
|
||||||
public static final int INPUT_STYLE_TAIL_BATCH = 3;
|
public static final int INPUT_STYLE_TAIL_BATCH = 3;
|
||||||
public static final int INPUT_STYLE_APPLICATION_SPECIFIED = 4;
|
public static final int INPUT_STYLE_APPLICATION_SPECIFIED = 4;
|
||||||
public static final int INPUT_STYLE_RECORRECTION = 5;
|
public static final int INPUT_STYLE_RECORRECTION = 5;
|
||||||
|
public static final int INPUT_STYLE_PREDICTION = 6;
|
||||||
|
|
||||||
// The maximum number of suggestions available.
|
// The maximum number of suggestions available.
|
||||||
public static final int MAX_SUGGESTIONS = 18;
|
public static final int MAX_SUGGESTIONS = 18;
|
||||||
|
|
||||||
private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST = new ArrayList<>(0);
|
private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST = new ArrayList<>(0);
|
||||||
public static final SuggestedWords EMPTY = new SuggestedWords(
|
public static final SuggestedWords EMPTY = new SuggestedWords(
|
||||||
EMPTY_WORD_INFO_LIST, null /* rawSuggestions */, false, false, false, false,
|
EMPTY_WORD_INFO_LIST, null /* rawSuggestions */, false /* typedWordValid */,
|
||||||
INPUT_STYLE_NONE);
|
false /* willAutoCorrect */, false /* isObsoleteSuggestions */, INPUT_STYLE_NONE);
|
||||||
|
|
||||||
public final String mTypedWord;
|
public final String mTypedWord;
|
||||||
public final boolean mTypedWordValid;
|
public final boolean mTypedWordValid;
|
||||||
|
@ -54,7 +55,6 @@ public class SuggestedWords {
|
||||||
// whether this exactly matches the user entry or not.
|
// whether this exactly matches the user entry or not.
|
||||||
public final boolean mWillAutoCorrect;
|
public final boolean mWillAutoCorrect;
|
||||||
public final boolean mIsObsoleteSuggestions;
|
public final boolean mIsObsoleteSuggestions;
|
||||||
public final boolean mIsPrediction;
|
|
||||||
// How the input for these suggested words was done by the user. Must be one of the
|
// How the input for these suggested words was done by the user. Must be one of the
|
||||||
// INPUT_STYLE_* constants above.
|
// INPUT_STYLE_* constants above.
|
||||||
public final int mInputStyle;
|
public final int mInputStyle;
|
||||||
|
@ -67,10 +67,9 @@ public class SuggestedWords {
|
||||||
final boolean typedWordValid,
|
final boolean typedWordValid,
|
||||||
final boolean willAutoCorrect,
|
final boolean willAutoCorrect,
|
||||||
final boolean isObsoleteSuggestions,
|
final boolean isObsoleteSuggestions,
|
||||||
final boolean isPrediction,
|
|
||||||
final int inputStyle) {
|
final int inputStyle) {
|
||||||
this(suggestedWordInfoList, rawSuggestions, typedWordValid, willAutoCorrect,
|
this(suggestedWordInfoList, rawSuggestions, typedWordValid, willAutoCorrect,
|
||||||
isObsoleteSuggestions, isPrediction, inputStyle, NOT_A_SEQUENCE_NUMBER);
|
isObsoleteSuggestions, inputStyle, NOT_A_SEQUENCE_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList,
|
public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList,
|
||||||
|
@ -78,13 +77,12 @@ public class SuggestedWords {
|
||||||
final boolean typedWordValid,
|
final boolean typedWordValid,
|
||||||
final boolean willAutoCorrect,
|
final boolean willAutoCorrect,
|
||||||
final boolean isObsoleteSuggestions,
|
final boolean isObsoleteSuggestions,
|
||||||
final boolean isPrediction,
|
|
||||||
final int inputStyle,
|
final int inputStyle,
|
||||||
final int sequenceNumber) {
|
final int sequenceNumber) {
|
||||||
this(suggestedWordInfoList, rawSuggestions,
|
this(suggestedWordInfoList, rawSuggestions,
|
||||||
(suggestedWordInfoList.isEmpty() || isPrediction) ? null
|
(suggestedWordInfoList.isEmpty() || INPUT_STYLE_PREDICTION == inputStyle) ? null
|
||||||
: suggestedWordInfoList.get(INDEX_OF_TYPED_WORD).mWord,
|
: suggestedWordInfoList.get(INDEX_OF_TYPED_WORD).mWord,
|
||||||
typedWordValid, willAutoCorrect, isObsoleteSuggestions, isPrediction, inputStyle,
|
typedWordValid, willAutoCorrect, isObsoleteSuggestions, inputStyle,
|
||||||
sequenceNumber);
|
sequenceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +92,6 @@ public class SuggestedWords {
|
||||||
final boolean typedWordValid,
|
final boolean typedWordValid,
|
||||||
final boolean willAutoCorrect,
|
final boolean willAutoCorrect,
|
||||||
final boolean isObsoleteSuggestions,
|
final boolean isObsoleteSuggestions,
|
||||||
final boolean isPrediction,
|
|
||||||
final int inputStyle,
|
final int inputStyle,
|
||||||
final int sequenceNumber) {
|
final int sequenceNumber) {
|
||||||
mSuggestedWordInfoList = suggestedWordInfoList;
|
mSuggestedWordInfoList = suggestedWordInfoList;
|
||||||
|
@ -102,7 +99,6 @@ public class SuggestedWords {
|
||||||
mTypedWordValid = typedWordValid;
|
mTypedWordValid = typedWordValid;
|
||||||
mWillAutoCorrect = willAutoCorrect;
|
mWillAutoCorrect = willAutoCorrect;
|
||||||
mIsObsoleteSuggestions = isObsoleteSuggestions;
|
mIsObsoleteSuggestions = isObsoleteSuggestions;
|
||||||
mIsPrediction = isPrediction;
|
|
||||||
mInputStyle = inputStyle;
|
mInputStyle = inputStyle;
|
||||||
mSequenceNumber = sequenceNumber;
|
mSequenceNumber = sequenceNumber;
|
||||||
mTypedWord = typedWord;
|
mTypedWord = typedWord;
|
||||||
|
@ -381,9 +377,14 @@ public class SuggestedWords {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPrediction() {
|
||||||
|
return INPUT_STYLE_PREDICTION == mInputStyle;
|
||||||
|
}
|
||||||
|
|
||||||
// SuggestedWords is an immutable object, as much as possible. We must not just remove
|
// SuggestedWords is an immutable object, as much as possible. We must not just remove
|
||||||
// words from the member ArrayList as some other parties may expect the object to never change.
|
// words from the member ArrayList as some other parties may expect the object to never change.
|
||||||
public SuggestedWords getSuggestedWordsExcludingTypedWord(final int inputStyle) {
|
// This is only ever called by recorrection at the moment, hence the ForRecorrection moniker.
|
||||||
|
public SuggestedWords getSuggestedWordsExcludingTypedWordForRecorrection() {
|
||||||
final ArrayList<SuggestedWordInfo> newSuggestions = new ArrayList<>();
|
final ArrayList<SuggestedWordInfo> newSuggestions = new ArrayList<>();
|
||||||
String typedWord = null;
|
String typedWord = null;
|
||||||
for (int i = 0; i < mSuggestedWordInfoList.size(); ++i) {
|
for (int i = 0; i < mSuggestedWordInfoList.size(); ++i) {
|
||||||
|
@ -399,7 +400,7 @@ public class SuggestedWords {
|
||||||
// no auto-correction should take place hence willAutoCorrect = false.
|
// no auto-correction should take place hence willAutoCorrect = false.
|
||||||
return new SuggestedWords(newSuggestions, null /* rawSuggestions */, typedWord,
|
return new SuggestedWords(newSuggestions, null /* rawSuggestions */, typedWord,
|
||||||
true /* typedWordValid */, false /* willAutoCorrect */, mIsObsoleteSuggestions,
|
true /* typedWordValid */, false /* willAutoCorrect */, mIsObsoleteSuggestions,
|
||||||
mIsPrediction, inputStyle, NOT_A_SEQUENCE_NUMBER);
|
SuggestedWords.INPUT_STYLE_RECORRECTION, NOT_A_SEQUENCE_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new SuggestedWordInfo from the currently suggested words that removes all but the
|
// Creates a new SuggestedWordInfo from the currently suggested words that removes all but the
|
||||||
|
@ -418,8 +419,7 @@ public class SuggestedWords {
|
||||||
SuggestedWordInfo.NOT_A_CONFIDENCE));
|
SuggestedWordInfo.NOT_A_CONFIDENCE));
|
||||||
}
|
}
|
||||||
return new SuggestedWords(newSuggestions, null /* rawSuggestions */, mTypedWordValid,
|
return new SuggestedWords(newSuggestions, null /* rawSuggestions */, mTypedWordValid,
|
||||||
mWillAutoCorrect, mIsObsoleteSuggestions, mIsPrediction,
|
mWillAutoCorrect, mIsObsoleteSuggestions, INPUT_STYLE_TAIL_BATCH);
|
||||||
INPUT_STYLE_TAIL_BATCH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -638,7 +638,7 @@ public final class InputLogic {
|
||||||
case Constants.CODE_SHIFT:
|
case Constants.CODE_SHIFT:
|
||||||
performRecapitalization(inputTransaction.mSettingsValues);
|
performRecapitalization(inputTransaction.mSettingsValues);
|
||||||
inputTransaction.requireShiftUpdate(InputTransaction.SHIFT_UPDATE_NOW);
|
inputTransaction.requireShiftUpdate(InputTransaction.SHIFT_UPDATE_NOW);
|
||||||
if (mSuggestedWords.mIsPrediction) {
|
if (mSuggestedWords.isPrediction()) {
|
||||||
inputTransaction.setRequiresUpdateSuggestions();
|
inputTransaction.setRequiresUpdateSuggestions();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1466,11 +1466,10 @@ public final class InputLogic {
|
||||||
&& !shouldIncludeResumedWordInSuggestions) {
|
&& !shouldIncludeResumedWordInSuggestions) {
|
||||||
// We were able to compute new suggestions for this word.
|
// We were able to compute new suggestions for this word.
|
||||||
// Remove the typed word, since we don't want to display it in this
|
// Remove the typed word, since we don't want to display it in this
|
||||||
// case. The #getSuggestedWordsExcludingTypedWord() method sets
|
// case. The #getSuggestedWordsExcludingTypedWordForRecorrection()
|
||||||
// willAutoCorrect to false.
|
// method sets willAutoCorrect to false.
|
||||||
suggestedWords = suggestedWordsIncludingTypedWord
|
suggestedWords = suggestedWordsIncludingTypedWord
|
||||||
.getSuggestedWordsExcludingTypedWord(SuggestedWords
|
.getSuggestedWordsExcludingTypedWordForRecorrection();
|
||||||
.INPUT_STYLE_RECORRECTION);
|
|
||||||
} else {
|
} else {
|
||||||
// No saved suggestions, and we were unable to compute any good one
|
// No saved suggestions, and we were unable to compute any good one
|
||||||
// either. Rather than displaying an empty suggestion strip, we'll
|
// either. Rather than displaying an empty suggestion strip, we'll
|
||||||
|
@ -1487,11 +1486,9 @@ public final class InputLogic {
|
||||||
// color of the word in the suggestion strip changes according to this parameter,
|
// color of the word in the suggestion strip changes according to this parameter,
|
||||||
// and false gives the correct color.
|
// and false gives the correct color.
|
||||||
final SuggestedWords suggestedWords = new SuggestedWords(suggestions,
|
final SuggestedWords suggestedWords = new SuggestedWords(suggestions,
|
||||||
null /* rawSuggestions */, typedWord,
|
null /* rawSuggestions */, typedWord, false /* typedWordValid */,
|
||||||
false /* typedWordValid */, false /* willAutoCorrect */,
|
false /* willAutoCorrect */, false /* isObsoleteSuggestions */,
|
||||||
false /* isObsoleteSuggestions */, false /* isPrediction */,
|
SuggestedWords.INPUT_STYLE_RECORRECTION, SuggestedWords.NOT_A_SEQUENCE_NUMBER);
|
||||||
SuggestedWords.INPUT_STYLE_RECORRECTION,
|
|
||||||
SuggestedWords.NOT_A_SEQUENCE_NUMBER);
|
|
||||||
mIsAutoCorrectionIndicatorOn = false;
|
mIsAutoCorrectionIndicatorOn = false;
|
||||||
mLatinIME.mHandler.showSuggestionStrip(suggestedWords);
|
mLatinIME.mHandler.showSuggestionStrip(suggestedWords);
|
||||||
}
|
}
|
||||||
|
@ -1787,8 +1784,7 @@ public final class InputLogic {
|
||||||
SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, oldSuggestedWords);
|
SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, oldSuggestedWords);
|
||||||
return new SuggestedWords(typedWordAndPreviousSuggestions, null /* rawSuggestions */,
|
return new SuggestedWords(typedWordAndPreviousSuggestions, null /* rawSuggestions */,
|
||||||
false /* typedWordValid */, false /* hasAutoCorrectionCandidate */,
|
false /* typedWordValid */, false /* hasAutoCorrectionCandidate */,
|
||||||
true /* isObsoleteSuggestions */, false /* isPrediction */,
|
true /* isObsoleteSuggestions */, oldSuggestedWords.mInputStyle);
|
||||||
oldSuggestedWords.mInputStyle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class SuggestedWordsTests extends AndroidTestCase {
|
||||||
public void testGetSuggestedWordsExcludingTypedWord() {
|
public void testGetSuggestedWordsExcludingTypedWord() {
|
||||||
final String TYPED_WORD = "typed";
|
final String TYPED_WORD = "typed";
|
||||||
final int NUMBER_OF_ADDED_SUGGESTIONS = 5;
|
final int NUMBER_OF_ADDED_SUGGESTIONS = 5;
|
||||||
|
final int KIND_OF_SECOND_CORRECTION = SuggestedWordInfo.KIND_CORRECTION;
|
||||||
final ArrayList<SuggestedWordInfo> list = new ArrayList<>();
|
final ArrayList<SuggestedWordInfo> list = new ArrayList<>();
|
||||||
list.add(createTypedWordInfo(TYPED_WORD));
|
list.add(createTypedWordInfo(TYPED_WORD));
|
||||||
for (int i = 0; i < NUMBER_OF_ADDED_SUGGESTIONS; ++i) {
|
for (int i = 0; i < NUMBER_OF_ADDED_SUGGESTIONS; ++i) {
|
||||||
|
@ -73,21 +74,23 @@ public class SuggestedWordsTests extends AndroidTestCase {
|
||||||
false /* typedWordValid */,
|
false /* typedWordValid */,
|
||||||
false /* willAutoCorrect */,
|
false /* willAutoCorrect */,
|
||||||
false /* isObsoleteSuggestions */,
|
false /* isObsoleteSuggestions */,
|
||||||
false /* isPrediction*/,
|
|
||||||
SuggestedWords.INPUT_STYLE_NONE);
|
SuggestedWords.INPUT_STYLE_NONE);
|
||||||
assertEquals(NUMBER_OF_ADDED_SUGGESTIONS + 1, words.size());
|
assertEquals(NUMBER_OF_ADDED_SUGGESTIONS + 1, words.size());
|
||||||
assertEquals("typed", words.getWord(0));
|
assertEquals("typed", words.getWord(0));
|
||||||
assertTrue(words.getInfo(0).isKindOf(SuggestedWordInfo.KIND_TYPED));
|
assertTrue(words.getInfo(0).isKindOf(SuggestedWordInfo.KIND_TYPED));
|
||||||
assertEquals("0", words.getWord(1));
|
assertEquals("0", words.getWord(1));
|
||||||
assertTrue(words.getInfo(1).isKindOf(SuggestedWordInfo.KIND_CORRECTION));
|
assertTrue(words.getInfo(1).isKindOf(KIND_OF_SECOND_CORRECTION));
|
||||||
assertEquals("4", words.getWord(5));
|
assertEquals("4", words.getWord(5));
|
||||||
assertTrue(words.getInfo(5).isKindOf(SuggestedWordInfo.KIND_CORRECTION));
|
assertTrue(words.getInfo(5).isKindOf(KIND_OF_SECOND_CORRECTION));
|
||||||
|
|
||||||
final SuggestedWords wordsWithoutTyped = words.getSuggestedWordsExcludingTypedWord(
|
final SuggestedWords wordsWithoutTyped =
|
||||||
SuggestedWords.INPUT_STYLE_NONE);
|
words.getSuggestedWordsExcludingTypedWordForRecorrection();
|
||||||
|
// Make sure that the typed word has indeed been excluded, by testing the size of the
|
||||||
|
// suggested words, the string and the kind of the top suggestion, which should match
|
||||||
|
// the string and kind of what we inserted after the typed word.
|
||||||
assertEquals(words.size() - 1, wordsWithoutTyped.size());
|
assertEquals(words.size() - 1, wordsWithoutTyped.size());
|
||||||
assertEquals("0", wordsWithoutTyped.getWord(0));
|
assertEquals("0", wordsWithoutTyped.getWord(0));
|
||||||
assertTrue(wordsWithoutTyped.getInfo(0).isKindOf(SuggestedWordInfo.KIND_CORRECTION));
|
assertTrue(wordsWithoutTyped.getInfo(0).isKindOf(KIND_OF_SECOND_CORRECTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for testGetTransformedWordInfo
|
// Helper for testGetTransformedWordInfo
|
||||||
|
@ -133,7 +136,6 @@ public class SuggestedWordsTests extends AndroidTestCase {
|
||||||
false /* typedWordValid */,
|
false /* typedWordValid */,
|
||||||
false /* willAutoCorrect */,
|
false /* willAutoCorrect */,
|
||||||
false /* isObsoleteSuggestions */,
|
false /* isObsoleteSuggestions */,
|
||||||
false /* isPrediction*/,
|
|
||||||
SuggestedWords.INPUT_STYLE_NONE);
|
SuggestedWords.INPUT_STYLE_NONE);
|
||||||
final SuggestedWordInfo typedWord = wordsWithTypedWord.getTypedWordInfoOrNull();
|
final SuggestedWordInfo typedWord = wordsWithTypedWord.getTypedWordInfoOrNull();
|
||||||
assertNotNull(typedWord);
|
assertNotNull(typedWord);
|
||||||
|
@ -141,8 +143,7 @@ public class SuggestedWordsTests extends AndroidTestCase {
|
||||||
|
|
||||||
// Make sure getTypedWordInfoOrNull() returns null.
|
// Make sure getTypedWordInfoOrNull() returns null.
|
||||||
final SuggestedWords wordsWithoutTypedWord =
|
final SuggestedWords wordsWithoutTypedWord =
|
||||||
wordsWithTypedWord.getSuggestedWordsExcludingTypedWord(
|
wordsWithTypedWord.getSuggestedWordsExcludingTypedWordForRecorrection();
|
||||||
SuggestedWords.INPUT_STYLE_NONE);
|
|
||||||
assertNull(wordsWithoutTypedWord.getTypedWordInfoOrNull());
|
assertNull(wordsWithoutTypedWord.getTypedWordInfoOrNull());
|
||||||
|
|
||||||
// Make sure getTypedWordInfoOrNull() returns null.
|
// Make sure getTypedWordInfoOrNull() returns null.
|
||||||
|
|
|
@ -429,7 +429,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
|
||||||
assertFalse("willAutoCorrect", suggestedWords.mWillAutoCorrect);
|
assertFalse("willAutoCorrect", suggestedWords.mWillAutoCorrect);
|
||||||
assertTrue("isPunctuationSuggestions", suggestedWords.isPunctuationSuggestions());
|
assertTrue("isPunctuationSuggestions", suggestedWords.isPunctuationSuggestions());
|
||||||
assertFalse("isObsoleteSuggestions", suggestedWords.mIsObsoleteSuggestions);
|
assertFalse("isObsoleteSuggestions", suggestedWords.mIsObsoleteSuggestions);
|
||||||
assertFalse("isPrediction", suggestedWords.mIsPrediction);
|
assertFalse("isPrediction", suggestedWords.isPrediction());
|
||||||
assertEquals("size", punctuationLabels.length, suggestedWords.size());
|
assertEquals("size", punctuationLabels.length, suggestedWords.size());
|
||||||
for (int index = 0; index < suggestedWords.size(); index++) {
|
for (int index = 0; index < suggestedWords.size(); index++) {
|
||||||
assertEquals("punctuation label at " + index,
|
assertEquals("punctuation label at " + index,
|
||||||
|
|
Loading…
Reference in New Issue