diff options
author | 2019-07-01 21:00:09 +0000 | |
---|---|---|
committer | 2019-07-01 21:00:09 +0000 | |
commit | 7c33185b41d774123ab565fa8b6d7afac44c1b18 (patch) | |
tree | c1d7ddd47896f4047d307169973e794f2941b029 /tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java | |
parent | e4c638b34727c03a1adfba594d95e3f469c56a34 (diff) | |
parent | 751578eb61b47ba3e85054dd57c1df3e4b94f1fb (diff) | |
download | latinime-7c33185b41d774123ab565fa8b6d7afac44c1b18.tar.gz latinime-7c33185b41d774123ab565fa8b6d7afac44c1b18.tar.xz latinime-7c33185b41d774123ab565fa8b6d7afac44c1b18.zip |
DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-master
Bug: 134405016
Change-Id: If86628b9fc81ba5a599ae42e2901066c6bccf173
Diffstat (limited to 'tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java')
-rw-r--r-- | tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java | 24 |
1 files changed, 21 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..a0544d62a 100644 --- a/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java +++ b/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java @@ -16,17 +16,26 @@ 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.text.Spanned; import android.text.TextUtils; import android.text.style.SuggestionSpan; +import androidx.test.InstrumentationRegistry; +import androidx.test.filters.SmallTest; +import androidx.test.runner.AndroidJUnit4; + import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; +import org.junit.Test; +import org.junit.runner.RunWith; + import java.util.ArrayList; import java.util.Arrays; import java.util.Locale; @@ -34,7 +43,12 @@ import java.util.Locale; import javax.annotation.Nullable; @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 +105,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 +122,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 +137,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 +235,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); |