diff options
author | 2012-05-22 02:40:08 -0700 | |
---|---|---|
committer | 2012-05-22 02:40:08 -0700 | |
commit | 37e9eb2b5630ea9fd27d25c4f07e5f28f7081eb3 (patch) | |
tree | 9d644ae6112ebd2532267e7382ed25a2302f9117 /tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java | |
parent | 204f024818ac73281a1495d8a61acc4b3e679fe2 (diff) | |
parent | e0f8476f71be89e78530f739bee91dd78cdbbc44 (diff) | |
download | latinime-37e9eb2b5630ea9fd27d25c4f07e5f28f7081eb3.tar.gz latinime-37e9eb2b5630ea9fd27d25c4f07e5f28f7081eb3.tar.xz latinime-37e9eb2b5630ea9fd27d25c4f07e5f28f7081eb3.zip |
am e0f8476f: am ab619812: Merge "Fix some of the input logic tests" into jb-dev
* commit 'e0f8476f71be89e78530f739bee91dd78cdbbc44':
Fix some of the input logic tests
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java b/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java index 81f744da9..a9947c1bd 100644 --- a/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java +++ b/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java @@ -18,6 +18,9 @@ package com.android.inputmethod.latin; import com.android.inputmethod.keyboard.Keyboard; +import android.text.style.SuggestionSpan; +import android.text.style.UnderlineSpan; + public class BlueUnderlineTests extends InputTestsBase { public void testBlueUnderline() { @@ -27,7 +30,7 @@ public class BlueUnderlineTests extends InputTestsBase { type(STRING_TO_TYPE); sleep(DELAY_TO_WAIT_FOR_UNDERLINE); runMessages(); - final Span span = new Span(mTextView.getText()); + final SpanGetter span = new SpanGetter(mTextView.getText(), SuggestionSpan.class); assertEquals("show blue underline, span start", EXPECTED_SPAN_START, span.mStart); assertEquals("show blue underline, span end", EXPECTED_SPAN_END, span.mEnd); assertEquals("show blue underline, span color", true, span.isAutoCorrectionIndicator()); @@ -44,7 +47,7 @@ public class BlueUnderlineTests extends InputTestsBase { type(STRING_2_TO_TYPE); // We haven't have time to look into the dictionary yet, so the line should still be // blue to avoid any flicker. - final Span spanBefore = new Span(mTextView.getText()); + final SpanGetter spanBefore = new SpanGetter(mTextView.getText(), SuggestionSpan.class); assertEquals("extend blue underline, span start", EXPECTED_SPAN_START, spanBefore.mStart); assertEquals("extend blue underline, span end", EXPECTED_SPAN_END, spanBefore.mEnd); assertEquals("extend blue underline, span color", true, @@ -52,14 +55,15 @@ public class BlueUnderlineTests extends InputTestsBase { sleep(DELAY_TO_WAIT_FOR_UNDERLINE); runMessages(); // Now we have been able to re-evaluate the word, there shouldn't be an auto-correction span - final Span spanAfter = new Span(mTextView.getText()); + final SpanGetter spanAfter = new SpanGetter(mTextView.getText(), SuggestionSpan.class); assertNull("hide blue underline", spanAfter.mSpan); } public void testBlueUnderlineOnBackspace() { final String STRING_TO_TYPE = "tgis"; - final int EXPECTED_SPAN_START = 0; - final int EXPECTED_SPAN_END = 4; + final int EXPECTED_SUGGESTION_SPAN_START = -1; + final int EXPECTED_UNDERLINE_SPAN_START = 0; + final int EXPECTED_UNDERLINE_SPAN_END = 4; type(STRING_TO_TYPE); sleep(DELAY_TO_WAIT_FOR_UNDERLINE); runMessages(); @@ -72,13 +76,14 @@ public class BlueUnderlineTests extends InputTestsBase { type(Keyboard.CODE_DELETE); sleep(DELAY_TO_WAIT_FOR_UNDERLINE); runMessages(); - final Span span = new Span(mTextView.getText()); - assertEquals("show blue underline after backspace, span start", - EXPECTED_SPAN_START, span.mStart); - assertEquals("show blue underline after backspace, span end", - EXPECTED_SPAN_END, span.mEnd); - assertEquals("show blue underline after backspace, span color", true, - span.isAutoCorrectionIndicator()); + final SpanGetter suggestionSpan = new SpanGetter(mTextView.getText(), SuggestionSpan.class); + assertEquals("show no blue underline after backspace, span start should be -1", + EXPECTED_SUGGESTION_SPAN_START, suggestionSpan.mStart); + final SpanGetter underlineSpan = new SpanGetter(mTextView.getText(), UnderlineSpan.class); + assertEquals("should be composing, so should have an underline span", + EXPECTED_UNDERLINE_SPAN_START, underlineSpan.mStart); + assertEquals("should be composing, so should have an underline span", + EXPECTED_UNDERLINE_SPAN_END, underlineSpan.mEnd); } public void testBlueUnderlineDisappearsWhenCursorMoved() { @@ -96,7 +101,7 @@ public class BlueUnderlineTests extends InputTestsBase { mLatinIME.onUpdateSelection(0, 0, NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1); sleep(DELAY_TO_WAIT_FOR_UNDERLINE); runMessages(); - final Span span = new Span(mTextView.getText()); + final SpanGetter span = new SpanGetter(mTextView.getText(), SuggestionSpan.class); assertNull("blue underline removed when cursor is moved", span.mSpan); } } |