am f356a25f: [DO NOT MERGE] Fix a bug where autocaps would jam auto-commit

* commit 'f356a25f36952f59e9918daa35f7ff6e5235a37d':
  [DO NOT MERGE] Fix a bug where autocaps would jam auto-commit
This commit is contained in:
Jean Chalard 2013-10-21 23:36:49 -07:00 committed by Android Git Automerger
commit 238941991d
2 changed files with 9 additions and 3 deletions

View file

@ -475,7 +475,7 @@ public final class Suggest {
} }
return new SuggestedWordInfo(sb.toString(), wordInfo.mScore, wordInfo.mKind, return new SuggestedWordInfo(sb.toString(), wordInfo.mScore, wordInfo.mKind,
wordInfo.mSourceDict, wordInfo.mIndexOfTouchPointOfSecondWord, wordInfo.mSourceDict, wordInfo.mIndexOfTouchPointOfSecondWord,
SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */); wordInfo.mAutoCommitFirstWordConfidence);
} }
public void close() { public void close() {

View file

@ -25,6 +25,7 @@ import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import java.util.Random;
@SmallTest @SmallTest
public class SuggestedWordsTests extends AndroidTestCase { public class SuggestedWordsTests extends AndroidTestCase {
@ -72,15 +73,20 @@ public class SuggestedWordsTests extends AndroidTestCase {
return new SuggestedWordInfo(s, 100, return new SuggestedWordInfo(s, 100,
SuggestedWordInfo.KIND_TYPED, null /* sourceDict */, SuggestedWordInfo.KIND_TYPED, null /* sourceDict */,
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */, SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */); new Random().nextInt(1000000) /* autoCommitFirstWordConfidence */);
} }
// Helper for testGetTransformedWordInfo // Helper for testGetTransformedWordInfo
private SuggestedWordInfo transformWordInfo(final String info, private SuggestedWordInfo transformWordInfo(final String info,
final int trailingSingleQuotesCount) { final int trailingSingleQuotesCount) {
return Suggest.getTransformedSuggestedWordInfo(createWordInfo(info), final SuggestedWordInfo suggestedWordInfo = createWordInfo(info);
final SuggestedWordInfo returnedWordInfo =
Suggest.getTransformedSuggestedWordInfo(suggestedWordInfo,
Locale.ENGLISH, false /* isAllUpperCase */, false /* isFirstCharCapitalized */, Locale.ENGLISH, false /* isAllUpperCase */, false /* isFirstCharCapitalized */,
trailingSingleQuotesCount); trailingSingleQuotesCount);
assertEquals(suggestedWordInfo.mAutoCommitFirstWordConfidence,
returnedWordInfo.mAutoCommitFirstWordConfidence);
return returnedWordInfo;
} }
public void testGetTransformedSuggestedWordInfo() { public void testGetTransformedSuggestedWordInfo() {