aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-05-18 19:10:48 +0900
committerJean Chalard <jchalard@google.com>2012-05-22 18:28:05 +0900
commitf83a6821bbf3863415378ea39d3b705954318e41 (patch)
tree6a10ea21900ba6ad9eaab4da3b90bf41dc21b284 /tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java
parent1fc0c71fad468cdda7eaea573ae14fd6ee81e180 (diff)
downloadlatinime-f83a6821bbf3863415378ea39d3b705954318e41.tar.gz
latinime-f83a6821bbf3863415378ea39d3b705954318e41.tar.xz
latinime-f83a6821bbf3863415378ea39d3b705954318e41.zip
Fix some of the input logic tests
This behavior has been changed for bug#6105732 Bug: 6516976 Change-Id: Ief8225b26d831cd92a051ce25cc005270b6b1776
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java31
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);
}
}