From f2c2657566e882c01c7af189be7f6c2946fddd9f Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Fri, 23 May 2014 22:42:58 +0900 Subject: [PATCH] Update RichInputConnectionAndTextRangeTests. Bug: 14119293 Change-Id: I952daaa8e938c67bd9e0e699d71a77a3b0bf8b0d --- .../RichInputConnectionAndTextRangeTests.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java b/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java index f3351ff84..c471eca57 100644 --- a/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java +++ b/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java @@ -157,10 +157,10 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase { // If one of the following cases breaks, the bigram suggestions won't work. assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( "abc def", mSpacingAndPunctuations, 2).mPrevWord, "abc"); - assertNull(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( - "abc", mSpacingAndPunctuations, 2).mPrevWord); - assertNull(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( - "abc. def", mSpacingAndPunctuations, 2).mPrevWord); + assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( + "abc", mSpacingAndPunctuations, 2), PrevWordsInfo.BEGINNING_OF_SENTENCE); + assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( + "abc. def", mSpacingAndPunctuations, 2), PrevWordsInfo.BEGINNING_OF_SENTENCE); assertFalse(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( "abc def", mSpacingAndPunctuations, 2).mIsBeginningOfSentence); @@ -180,16 +180,22 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase { assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( "abc def .", mSpacingAndPunctuations, 2).mPrevWord, "def"); assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( - "abc ", mSpacingAndPunctuations, 2).mPrevWord, null); + "abc ", mSpacingAndPunctuations, 2), PrevWordsInfo.BEGINNING_OF_SENTENCE); assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( "abc def", mSpacingAndPunctuations, 1).mPrevWord, "def"); assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( "abc def ", mSpacingAndPunctuations, 1).mPrevWord, "def"); - assertNull(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( - "abc def.", mSpacingAndPunctuations, 1).mPrevWord); - assertNull(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( - "abc def .", mSpacingAndPunctuations, 1).mPrevWord); + assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( + "abc def.", mSpacingAndPunctuations, 1), PrevWordsInfo.BEGINNING_OF_SENTENCE); + assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( + "abc def .", mSpacingAndPunctuations, 1), PrevWordsInfo.BEGINNING_OF_SENTENCE); + assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( + "abc, def", mSpacingAndPunctuations, 2), PrevWordsInfo.EMPTY_PREV_WORDS_INFO); + assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( + "abc? def", mSpacingAndPunctuations, 2), PrevWordsInfo.EMPTY_PREV_WORDS_INFO); + assertEquals(RichInputConnection.getPrevWordsInfoFromNthPreviousWord( + "abc! def", mSpacingAndPunctuations, 2), PrevWordsInfo.EMPTY_PREV_WORDS_INFO); } /**