diff options
author | 2018-07-06 10:10:54 -0700 | |
---|---|---|
committer | 2018-07-06 10:10:54 -0700 | |
commit | d3b93cc95061ada6a162d7989e313f818e6d4e15 (patch) | |
tree | a4e3eaee6b84d20817d82b2a263e0e47bcc98753 /tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java | |
parent | a497886dda70bbd401652560d11d8f4010985e96 (diff) | |
download | latinime-d3b93cc95061ada6a162d7989e313f818e6d4e15.tar.gz latinime-d3b93cc95061ada6a162d7989e313f818e6d4e15.tar.xz latinime-d3b93cc95061ada6a162d7989e313f818e6d4e15.zip |
Migrate to Android Testing Support Lib (part 5/N)
This CL converts 19 test classes under com.android.inputmethod.latin
to Android Testing Support Library.
Bug: 110805255
Test: verified as follows. No new test failures.
tapas adb LatinIME LatinIMETests arm64 userdebug && \
DISABLE_PROGUARD=true make -j LatinIME && \
adb install -r $OUT/system/app/LatinIME/LatinIME.apk && \
atest LatinIMETests:com.android.inputmethod.latin
Change-Id: I878fcae0126f57c43a644af341e5a0a8ac8f5cc9
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java b/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java index ed632db68..52ed2ae10 100644 --- a/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java +++ b/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java @@ -16,9 +16,16 @@ package com.android.inputmethod.latin.settings; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import android.content.Context; import android.content.res.Resources; -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 com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.common.Constants; @@ -28,13 +35,22 @@ import junit.framework.AssertionFailedError; import java.util.Locale; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + @SmallTest -public class SpacingAndPunctuationsTests extends AndroidTestCase { +@RunWith(AndroidJUnit4.class) +public class SpacingAndPunctuationsTests { private static final int ARMENIAN_FULL_STOP = '\u0589'; private static final int ARMENIAN_COMMA = '\u055D'; private int mScreenMetrics; + private Context getContext() { + return InstrumentationRegistry.getTargetContext(); + } + private boolean isPhone() { return Constants.isPhone(mScreenMetrics); } @@ -63,10 +79,8 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { private SpacingAndPunctuations CAMBODIA_KHMER; private SpacingAndPunctuations LAOS_LAO; - @Override - protected void setUp() throws Exception { - super.setUp(); - + @Before + public void setUp() throws Exception { mScreenMetrics = Settings.readScreenMetrics(getContext().getResources()); // Language only @@ -140,6 +154,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { assertFalse("Tilde", sp.isWordSeparator('~')); } + @Test public void testWordSeparator() { testingStandardWordSeparator(ENGLISH); testingStandardWordSeparator(FRENCH); @@ -192,6 +207,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { } + @Test public void testWordConnector() { testingStandardWordConnector(ENGLISH); testingStandardWordConnector(FRENCH); @@ -245,6 +261,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { assertFalse("Question", sp.isUsuallyPrecededBySpace('?')); } + @Test public void testIsUsuallyPrecededBySpace() { testingStandardPrecededBySpace(ENGLISH); testingCommonPrecededBySpace(FRENCH); @@ -298,6 +315,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { assertFalse("Tilde", sp.isUsuallyFollowedBySpace('~')); } + @Test public void testIsUsuallyFollowedBySpace() { testingStandardFollowedBySpace(ENGLISH); testingStandardFollowedBySpace(FRENCH); @@ -345,7 +363,8 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { assertFalse("Tilde", sp.isUsuallyFollowedBySpace('~')); } - public void isSentenceSeparator() { + @Test + public void testIsSentenceSeparator() { testingStandardSentenceSeparator(ENGLISH); try { testingStandardSentenceSeparator(ARMENIA_ARMENIAN); @@ -357,6 +376,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { assertFalse(ARMENIA_ARMENIAN.isSentenceSeparator(ARMENIAN_COMMA)); } + @Test public void testLanguageHasSpace() { assertTrue(ENGLISH.mCurrentLanguageHasSpaces); assertTrue(FRENCH.mCurrentLanguageHasSpaces); @@ -369,6 +389,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { assertTrue(LAO.mCurrentLanguageHasSpaces); } + @Test public void testUsesAmericanTypography() { assertTrue(ENGLISH.mUsesAmericanTypography); assertTrue(UNITED_STATES.mUsesAmericanTypography); @@ -379,6 +400,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { assertFalse(SWISS_GERMAN.mUsesAmericanTypography); } + @Test public void testUsesGermanRules() { assertFalse(ENGLISH.mUsesGermanRules); assertFalse(FRENCH.mUsesGermanRules); @@ -436,6 +458,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { } } + @Test public void testPhonePunctuationSuggestions() { if (!isPhone()) { return; @@ -454,6 +477,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase { PUNCTUATION_LABELS_PHONE, PUNCTUATION_WORDS_PHONE_HEBREW); } + @Test public void testTabletPunctuationSuggestions() { if (!isTablet()) { return; |