aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-07-06 03:02:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-07-06 03:02:05 +0000
commit231a28a3f712793fc1daa064e80e3e1773f6fe7b (patch)
tree35bbfd11de27c50c2f5491152845c3cc614cb840 /tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
parent9c49581eeb96ebf6ca4dc2110ea986d784c48912 (diff)
parentbfa5581857086948ffa5d732e4a095d548b218f6 (diff)
downloadlatinime-231a28a3f712793fc1daa064e80e3e1773f6fe7b.tar.gz
latinime-231a28a3f712793fc1daa064e80e3e1773f6fe7b.tar.xz
latinime-231a28a3f712793fc1daa064e80e3e1773f6fe7b.zip
Merge "Migrate to Android Testing Support Lib (part 2/N)"
Diffstat (limited to 'tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java')
-rw-r--r--tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java b/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
index 2d6d28f2b..820648d23 100644
--- a/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
+++ b/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
@@ -16,10 +16,15 @@
package com.android.inputmethod.compat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import android.annotation.TargetApi;
+import android.content.Context;
import android.os.Build;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.SuggestionSpan;
@@ -33,8 +38,16 @@ import java.util.Locale;
import javax.annotation.Nullable;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class SuggestionSpanUtilsTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class SuggestionSpanUtilsTest {
+
+ private Context getContext() {
+ return InstrumentationRegistry.getTargetContext();
+ }
/**
* Helper method to create a dummy {@link SuggestedWordInfo}.
@@ -91,6 +104,7 @@ public class SuggestionSpanUtilsTest extends AndroidTestCase {
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
+ @Test
public void testGetTextWithAutoCorrectionIndicatorUnderline() {
final String ORIGINAL_TEXT = "Hey!";
final Locale NONNULL_LOCALE = new Locale("en", "GB");
@@ -107,6 +121,7 @@ public class SuggestionSpanUtilsTest extends AndroidTestCase {
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
+ @Test
public void testGetTextWithAutoCorrectionIndicatorUnderlineRootLocale() {
final String ORIGINAL_TEXT = "Hey!";
final CharSequence text = SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(
@@ -121,6 +136,7 @@ public class SuggestionSpanUtilsTest extends AndroidTestCase {
new String[]{}, Locale.ROOT, text);
}
+ @Test
public void testGetTextWithSuggestionSpan() {
final SuggestedWordInfo prediction1 =
createWordInfo("Quality", SuggestedWordInfo.KIND_PREDICTION);
@@ -218,6 +234,7 @@ public class SuggestionSpanUtilsTest extends AndroidTestCase {
}
}
+ @Test
public void testFindFirstLocaleFromSuggestionSpans() {
final String[] suggestions = new String[] {"Quality", "Speed", "Price"};
final SuggestionSpan nullLocaleSpan = new SuggestionSpan((Locale)null, suggestions, 0);