Loading core/tests/coretests/src/android/view/inputmethod/CursorAnchorInfoTest.java +39 −27 Original line number Diff line number Diff line Loading @@ -16,21 +16,33 @@ package android.view.inputmethod; import static android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION; import static android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION; import static android.view.inputmethod.CursorAnchorInfo.FLAG_IS_RTL; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import android.graphics.Matrix; import android.graphics.RectF; import android.os.Parcel; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.text.TextUtils; import android.view.inputmethod.CursorAnchorInfo.Builder; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Objects; import static android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION; import static android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION; import static android.view.inputmethod.CursorAnchorInfo.FLAG_IS_RTL; @SmallTest @RunWith(AndroidJUnit4.class) public class CursorAnchorInfoTest { private static final float EPSILON = 0.0000001f; public class CursorAnchorInfoTest extends InstrumentationTestCase { private static final RectF[] MANY_BOUNDS = new RectF[] { new RectF(101.0f, 201.0f, 301.0f, 401.0f), new RectF(102.0f, 202.0f, 302.0f, 402.0f), Loading Loading @@ -74,7 +86,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { FLAG_HAS_INVISIBLE_REGION | FLAG_IS_RTL, }; @SmallTest @Test public void testBuilder() throws Exception { final int SELECTION_START = 30; final int SELECTION_END = 40; Loading Loading @@ -109,10 +121,10 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(COMPOSING_TEXT_START, info.getComposingTextStart()); assertTrue(TextUtils.equals(COMPOSING_TEXT, info.getComposingText())); assertEquals(INSERTION_MARKER_FLAGS, info.getInsertionMarkerFlags()); assertEquals(INSERTION_MARKER_HORIZONTAL, info.getInsertionMarkerHorizontal()); assertEquals(INSERTION_MARKER_TOP, info.getInsertionMarkerTop()); assertEquals(INSERTION_MARKER_BASELINE, info.getInsertionMarkerBaseline()); assertEquals(INSERTION_MARKER_BOTOM, info.getInsertionMarkerBottom()); assertEquals(INSERTION_MARKER_HORIZONTAL, info.getInsertionMarkerHorizontal(), EPSILON); assertEquals(INSERTION_MARKER_TOP, info.getInsertionMarkerTop(), EPSILON); assertEquals(INSERTION_MARKER_BASELINE, info.getInsertionMarkerBaseline(), EPSILON); assertEquals(INSERTION_MARKER_BOTOM, info.getInsertionMarkerBottom(), EPSILON); assertEquals(TRANSFORM_MATRIX, info.getMatrix()); for (int i = 0; i < MANY_BOUNDS.length; i++) { final RectF expectedBounds = MANY_BOUNDS[i]; Loading @@ -134,10 +146,10 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(COMPOSING_TEXT_START, info2.getComposingTextStart()); assertTrue(TextUtils.equals(COMPOSING_TEXT, info2.getComposingText())); assertEquals(INSERTION_MARKER_FLAGS, info2.getInsertionMarkerFlags()); assertEquals(INSERTION_MARKER_HORIZONTAL, info2.getInsertionMarkerHorizontal()); assertEquals(INSERTION_MARKER_TOP, info2.getInsertionMarkerTop()); assertEquals(INSERTION_MARKER_BASELINE, info2.getInsertionMarkerBaseline()); assertEquals(INSERTION_MARKER_BOTOM, info2.getInsertionMarkerBottom()); assertEquals(INSERTION_MARKER_HORIZONTAL, info2.getInsertionMarkerHorizontal(), EPSILON); assertEquals(INSERTION_MARKER_TOP, info2.getInsertionMarkerTop(), EPSILON); assertEquals(INSERTION_MARKER_BASELINE, info2.getInsertionMarkerBaseline(), EPSILON); assertEquals(INSERTION_MARKER_BOTOM, info2.getInsertionMarkerBottom(), EPSILON); assertEquals(TRANSFORM_MATRIX, info2.getMatrix()); for (int i = 0; i < MANY_BOUNDS.length; i++) { final RectF expectedBounds = MANY_BOUNDS[i]; Loading @@ -161,10 +173,10 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(COMPOSING_TEXT_START, info3.getComposingTextStart()); assertTrue(TextUtils.equals(COMPOSING_TEXT, info3.getComposingText())); assertEquals(INSERTION_MARKER_FLAGS, info3.getInsertionMarkerFlags()); assertEquals(INSERTION_MARKER_HORIZONTAL, info3.getInsertionMarkerHorizontal()); assertEquals(INSERTION_MARKER_TOP, info3.getInsertionMarkerTop()); assertEquals(INSERTION_MARKER_BASELINE, info3.getInsertionMarkerBaseline()); assertEquals(INSERTION_MARKER_BOTOM, info3.getInsertionMarkerBottom()); assertEquals(INSERTION_MARKER_HORIZONTAL, info3.getInsertionMarkerHorizontal(), EPSILON); assertEquals(INSERTION_MARKER_TOP, info3.getInsertionMarkerTop(), EPSILON); assertEquals(INSERTION_MARKER_BASELINE, info3.getInsertionMarkerBaseline(), EPSILON); assertEquals(INSERTION_MARKER_BOTOM, info3.getInsertionMarkerBottom(), EPSILON); assertEquals(TRANSFORM_MATRIX, info3.getMatrix()); for (int i = 0; i < MANY_BOUNDS.length; i++) { final RectF expectedBounds = MANY_BOUNDS[i]; Loading @@ -187,10 +199,10 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(-1, uninitializedInfo.getComposingTextStart()); assertNull(uninitializedInfo.getComposingText()); assertEquals(0, uninitializedInfo.getInsertionMarkerFlags()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerHorizontal()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerTop()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerBaseline()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerBottom()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerHorizontal(), EPSILON); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerTop(), EPSILON); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerBaseline(), EPSILON); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerBottom(), EPSILON); assertEquals(Matrix.IDENTITY_MATRIX, uninitializedInfo.getMatrix()); } Loading @@ -199,7 +211,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertFalse(Objects.equals(reference, actual)); } @SmallTest @Test public void testEquality() throws Exception { final Matrix MATRIX1 = new Matrix(); MATRIX1.setTranslate(10.0f, 20.0f); Loading Loading @@ -357,7 +369,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { INSERTION_MARKER_FLAGS2).build()); } @SmallTest @Test public void testMatrixIsCopied() throws Exception { final Matrix MATRIX1 = new Matrix(); MATRIX1.setTranslate(10.0f, 20.0f); Loading Loading @@ -385,7 +397,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(MATRIX2, secondInstance.getMatrix()); } @SmallTest @Test public void testMatrixIsRequired() throws Exception { final int SELECTION_START = 30; final int SELECTION_END = 40; Loading Loading @@ -434,7 +446,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { } } @SmallTest @Test public void testBuilderAddCharacterBounds() throws Exception { // A negative index should be rejected. try { Loading core/tests/coretests/src/android/view/inputmethod/InputMethodSubtypeArrayTest.java +13 −5 Original line number Diff line number Diff line Loading @@ -16,16 +16,24 @@ package android.view.inputmethod; import static org.junit.Assert.assertEquals; import android.os.Parcel; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder; import org.junit.Test; import org.junit.runner.RunWith; import java.util.ArrayList; public class InputMethodSubtypeArrayTest extends InstrumentationTestCase { @SmallTest public void testInstanciate() throws Exception { @RunWith(AndroidJUnit4.class) public class InputMethodSubtypeArrayTest { @Test public void testInstantiate() throws Exception { final ArrayList<InputMethodSubtype> subtypes = new ArrayList<InputMethodSubtype>(); subtypes.add(createDummySubtype(0, "en_US")); subtypes.add(createDummySubtype(1, "en_US")); Loading core/tests/coretests/src/android/view/inputmethod/InputMethodSubtypeTest.java +19 −8 Original line number Diff line number Diff line Loading @@ -16,15 +16,26 @@ package android.view.inputmethod; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import android.os.Parcel; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Locale; import java.util.Objects; public class InputMethodSubtypeTest extends InstrumentationTestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class InputMethodSubtypeTest { public void verifyLocale(final String localeString) { // InputMethodSubtype#getLocale() returns exactly the same string that is passed to the Loading @@ -48,7 +59,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { cloneViaParcel(cloneViaParcel(createDummySubtype(localeString))).hashCode()); } @SmallTest @Test public void testLocaleObj_locale() { final InputMethodSubtype usSubtype = createDummySubtype("en_US"); Locale localeObject = usSubtype.getLocaleObject(); Loading @@ -59,7 +70,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { assertTrue(localeObject == usSubtype.getLocaleObject()); } @SmallTest @Test public void testLocaleObj_languageTag() { final InputMethodSubtype usSubtype = createDummySubtypeUsingLanguageTag("en-US"); Locale localeObject = usSubtype.getLocaleObject(); Loading @@ -71,7 +82,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { assertTrue(localeObject == usSubtype.getLocaleObject()); } @SmallTest @Test public void testLocaleObj_emptyLocale() { final InputMethodSubtype emptyLocaleSubtype = createDummySubtype(""); assertNull(emptyLocaleSubtype.getLocaleObject()); Loading @@ -80,7 +91,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { assertNull(emptyLocaleSubtype.getLocaleObject()); } @SmallTest @Test public void testLocaleString() throws Exception { // The locale string in InputMethodSubtype has accepted an arbitrary text actually, // regardless of the validity of the text as a locale string. Loading @@ -95,7 +106,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { verifyLocale("fil_PH"); } @SmallTest @Test public void testDeprecatedLocaleString() throws Exception { // Make sure "iw" is not automatically replaced with "he". final InputMethodSubtype subtypeIw = createDummySubtype("iw"); Loading core/tests/coretests/src/android/view/inputmethod/SparseRectFArrayTest.java +16 −6 Original line number Diff line number Diff line Loading @@ -16,15 +16,25 @@ package android.view.inputmethod; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import android.graphics.RectF; import android.os.Parcel; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.inputmethod.SparseRectFArray.SparseRectFArrayBuilder; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Objects; public class SparseRectFArrayTest extends InstrumentationTestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class SparseRectFArrayTest { // A test data for {@link SparseRectFArray}. null represents the gap of indices. private static final RectF[] MANY_RECTS = new RectF[] { null, Loading @@ -49,7 +59,7 @@ public class SparseRectFArrayTest extends InstrumentationTestCase { new RectF(118.0f, 218.0f, 318.0f, 418.0f), }; @SmallTest @Test public void testBuilder() throws Exception { final RectF TEMP_RECT = new RectF(10.0f, 20.0f, 30.0f, 40.0f); final int TEMP_FLAGS = 0x1234; Loading Loading @@ -128,7 +138,7 @@ public class SparseRectFArrayTest extends InstrumentationTestCase { assertNull(builder.build().get(0)); } @SmallTest @Test public void testEquality() throws Exception { // Empty array should be equal. assertEqualRects(new SparseRectFArrayBuilder().build(), Loading Loading @@ -225,7 +235,7 @@ public class SparseRectFArrayTest extends InstrumentationTestCase { .build()); } @SmallTest @Test public void testBuilderAppend() throws Exception { // Key should be appended in ascending order. try { Loading core/tests/coretests/src/com/android/internal/inputmethod/InputMethodSubtypeSwitchingControllerTest.java +16 −7 Original line number Diff line number Diff line Loading @@ -16,11 +16,15 @@ package com.android.internal.inputmethod; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.content.pm.ApplicationInfo; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder; Loading @@ -28,11 +32,16 @@ import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder; import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ControllerImpl; import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem; import org.junit.Test; import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class InputMethodSubtypeSwitchingControllerTest { private static final String DUMMY_PACKAGE_NAME = "dummy package name"; private static final String DUMMY_IME_LABEL = "dummy ime label"; private static final String DUMMY_SETTING_ACTIVITY_NAME = ""; Loading Loading @@ -190,7 +199,7 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe controller.onUserActionLocked(subtypeListItem.mImi, subtype); } @SmallTest @Test public void testControllerImpl() throws Exception { final List<ImeSubtypeListItem> disabledItems = createDisabledImeSubtypes(); final ImeSubtypeListItem disabledIme_en_US = disabledItems.get(0); Loading Loading @@ -250,7 +259,7 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe disabledSubtypeUnawareIme, null, null); } @SmallTest @Test public void testControllerImplWithUserAction() throws Exception { final List<ImeSubtypeListItem> enabledItems = createEnabledImeSubtypes(); final ImeSubtypeListItem latinIme_en_US = enabledItems.get(0); Loading Loading @@ -331,7 +340,7 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe switchingUnawarelatinIme_en_UK, switchUnawareJapaneseIme_ja_JP); } @SmallTest @Test public void testImeSubtypeListItem() throws Exception { final List<ImeSubtypeListItem> items = new ArrayList<>(); addDummyImeSubtypeListItems(items, "LatinIme", "LatinIme", Loading Loading @@ -360,7 +369,7 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe assertFalse(item_EN_US.mIsSystemLocale); } @SmallTest @Test public void testImeSubtypeListComparator() throws Exception { { final List<ImeSubtypeListItem> items = Arrays.asList( Loading Loading
core/tests/coretests/src/android/view/inputmethod/CursorAnchorInfoTest.java +39 −27 Original line number Diff line number Diff line Loading @@ -16,21 +16,33 @@ package android.view.inputmethod; import static android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION; import static android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION; import static android.view.inputmethod.CursorAnchorInfo.FLAG_IS_RTL; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import android.graphics.Matrix; import android.graphics.RectF; import android.os.Parcel; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.text.TextUtils; import android.view.inputmethod.CursorAnchorInfo.Builder; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Objects; import static android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION; import static android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION; import static android.view.inputmethod.CursorAnchorInfo.FLAG_IS_RTL; @SmallTest @RunWith(AndroidJUnit4.class) public class CursorAnchorInfoTest { private static final float EPSILON = 0.0000001f; public class CursorAnchorInfoTest extends InstrumentationTestCase { private static final RectF[] MANY_BOUNDS = new RectF[] { new RectF(101.0f, 201.0f, 301.0f, 401.0f), new RectF(102.0f, 202.0f, 302.0f, 402.0f), Loading Loading @@ -74,7 +86,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { FLAG_HAS_INVISIBLE_REGION | FLAG_IS_RTL, }; @SmallTest @Test public void testBuilder() throws Exception { final int SELECTION_START = 30; final int SELECTION_END = 40; Loading Loading @@ -109,10 +121,10 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(COMPOSING_TEXT_START, info.getComposingTextStart()); assertTrue(TextUtils.equals(COMPOSING_TEXT, info.getComposingText())); assertEquals(INSERTION_MARKER_FLAGS, info.getInsertionMarkerFlags()); assertEquals(INSERTION_MARKER_HORIZONTAL, info.getInsertionMarkerHorizontal()); assertEquals(INSERTION_MARKER_TOP, info.getInsertionMarkerTop()); assertEquals(INSERTION_MARKER_BASELINE, info.getInsertionMarkerBaseline()); assertEquals(INSERTION_MARKER_BOTOM, info.getInsertionMarkerBottom()); assertEquals(INSERTION_MARKER_HORIZONTAL, info.getInsertionMarkerHorizontal(), EPSILON); assertEquals(INSERTION_MARKER_TOP, info.getInsertionMarkerTop(), EPSILON); assertEquals(INSERTION_MARKER_BASELINE, info.getInsertionMarkerBaseline(), EPSILON); assertEquals(INSERTION_MARKER_BOTOM, info.getInsertionMarkerBottom(), EPSILON); assertEquals(TRANSFORM_MATRIX, info.getMatrix()); for (int i = 0; i < MANY_BOUNDS.length; i++) { final RectF expectedBounds = MANY_BOUNDS[i]; Loading @@ -134,10 +146,10 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(COMPOSING_TEXT_START, info2.getComposingTextStart()); assertTrue(TextUtils.equals(COMPOSING_TEXT, info2.getComposingText())); assertEquals(INSERTION_MARKER_FLAGS, info2.getInsertionMarkerFlags()); assertEquals(INSERTION_MARKER_HORIZONTAL, info2.getInsertionMarkerHorizontal()); assertEquals(INSERTION_MARKER_TOP, info2.getInsertionMarkerTop()); assertEquals(INSERTION_MARKER_BASELINE, info2.getInsertionMarkerBaseline()); assertEquals(INSERTION_MARKER_BOTOM, info2.getInsertionMarkerBottom()); assertEquals(INSERTION_MARKER_HORIZONTAL, info2.getInsertionMarkerHorizontal(), EPSILON); assertEquals(INSERTION_MARKER_TOP, info2.getInsertionMarkerTop(), EPSILON); assertEquals(INSERTION_MARKER_BASELINE, info2.getInsertionMarkerBaseline(), EPSILON); assertEquals(INSERTION_MARKER_BOTOM, info2.getInsertionMarkerBottom(), EPSILON); assertEquals(TRANSFORM_MATRIX, info2.getMatrix()); for (int i = 0; i < MANY_BOUNDS.length; i++) { final RectF expectedBounds = MANY_BOUNDS[i]; Loading @@ -161,10 +173,10 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(COMPOSING_TEXT_START, info3.getComposingTextStart()); assertTrue(TextUtils.equals(COMPOSING_TEXT, info3.getComposingText())); assertEquals(INSERTION_MARKER_FLAGS, info3.getInsertionMarkerFlags()); assertEquals(INSERTION_MARKER_HORIZONTAL, info3.getInsertionMarkerHorizontal()); assertEquals(INSERTION_MARKER_TOP, info3.getInsertionMarkerTop()); assertEquals(INSERTION_MARKER_BASELINE, info3.getInsertionMarkerBaseline()); assertEquals(INSERTION_MARKER_BOTOM, info3.getInsertionMarkerBottom()); assertEquals(INSERTION_MARKER_HORIZONTAL, info3.getInsertionMarkerHorizontal(), EPSILON); assertEquals(INSERTION_MARKER_TOP, info3.getInsertionMarkerTop(), EPSILON); assertEquals(INSERTION_MARKER_BASELINE, info3.getInsertionMarkerBaseline(), EPSILON); assertEquals(INSERTION_MARKER_BOTOM, info3.getInsertionMarkerBottom(), EPSILON); assertEquals(TRANSFORM_MATRIX, info3.getMatrix()); for (int i = 0; i < MANY_BOUNDS.length; i++) { final RectF expectedBounds = MANY_BOUNDS[i]; Loading @@ -187,10 +199,10 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(-1, uninitializedInfo.getComposingTextStart()); assertNull(uninitializedInfo.getComposingText()); assertEquals(0, uninitializedInfo.getInsertionMarkerFlags()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerHorizontal()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerTop()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerBaseline()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerBottom()); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerHorizontal(), EPSILON); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerTop(), EPSILON); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerBaseline(), EPSILON); assertEquals(Float.NaN, uninitializedInfo.getInsertionMarkerBottom(), EPSILON); assertEquals(Matrix.IDENTITY_MATRIX, uninitializedInfo.getMatrix()); } Loading @@ -199,7 +211,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertFalse(Objects.equals(reference, actual)); } @SmallTest @Test public void testEquality() throws Exception { final Matrix MATRIX1 = new Matrix(); MATRIX1.setTranslate(10.0f, 20.0f); Loading Loading @@ -357,7 +369,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { INSERTION_MARKER_FLAGS2).build()); } @SmallTest @Test public void testMatrixIsCopied() throws Exception { final Matrix MATRIX1 = new Matrix(); MATRIX1.setTranslate(10.0f, 20.0f); Loading Loading @@ -385,7 +397,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { assertEquals(MATRIX2, secondInstance.getMatrix()); } @SmallTest @Test public void testMatrixIsRequired() throws Exception { final int SELECTION_START = 30; final int SELECTION_END = 40; Loading Loading @@ -434,7 +446,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { } } @SmallTest @Test public void testBuilderAddCharacterBounds() throws Exception { // A negative index should be rejected. try { Loading
core/tests/coretests/src/android/view/inputmethod/InputMethodSubtypeArrayTest.java +13 −5 Original line number Diff line number Diff line Loading @@ -16,16 +16,24 @@ package android.view.inputmethod; import static org.junit.Assert.assertEquals; import android.os.Parcel; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder; import org.junit.Test; import org.junit.runner.RunWith; import java.util.ArrayList; public class InputMethodSubtypeArrayTest extends InstrumentationTestCase { @SmallTest public void testInstanciate() throws Exception { @RunWith(AndroidJUnit4.class) public class InputMethodSubtypeArrayTest { @Test public void testInstantiate() throws Exception { final ArrayList<InputMethodSubtype> subtypes = new ArrayList<InputMethodSubtype>(); subtypes.add(createDummySubtype(0, "en_US")); subtypes.add(createDummySubtype(1, "en_US")); Loading
core/tests/coretests/src/android/view/inputmethod/InputMethodSubtypeTest.java +19 −8 Original line number Diff line number Diff line Loading @@ -16,15 +16,26 @@ package android.view.inputmethod; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import android.os.Parcel; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Locale; import java.util.Objects; public class InputMethodSubtypeTest extends InstrumentationTestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class InputMethodSubtypeTest { public void verifyLocale(final String localeString) { // InputMethodSubtype#getLocale() returns exactly the same string that is passed to the Loading @@ -48,7 +59,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { cloneViaParcel(cloneViaParcel(createDummySubtype(localeString))).hashCode()); } @SmallTest @Test public void testLocaleObj_locale() { final InputMethodSubtype usSubtype = createDummySubtype("en_US"); Locale localeObject = usSubtype.getLocaleObject(); Loading @@ -59,7 +70,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { assertTrue(localeObject == usSubtype.getLocaleObject()); } @SmallTest @Test public void testLocaleObj_languageTag() { final InputMethodSubtype usSubtype = createDummySubtypeUsingLanguageTag("en-US"); Locale localeObject = usSubtype.getLocaleObject(); Loading @@ -71,7 +82,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { assertTrue(localeObject == usSubtype.getLocaleObject()); } @SmallTest @Test public void testLocaleObj_emptyLocale() { final InputMethodSubtype emptyLocaleSubtype = createDummySubtype(""); assertNull(emptyLocaleSubtype.getLocaleObject()); Loading @@ -80,7 +91,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { assertNull(emptyLocaleSubtype.getLocaleObject()); } @SmallTest @Test public void testLocaleString() throws Exception { // The locale string in InputMethodSubtype has accepted an arbitrary text actually, // regardless of the validity of the text as a locale string. Loading @@ -95,7 +106,7 @@ public class InputMethodSubtypeTest extends InstrumentationTestCase { verifyLocale("fil_PH"); } @SmallTest @Test public void testDeprecatedLocaleString() throws Exception { // Make sure "iw" is not automatically replaced with "he". final InputMethodSubtype subtypeIw = createDummySubtype("iw"); Loading
core/tests/coretests/src/android/view/inputmethod/SparseRectFArrayTest.java +16 −6 Original line number Diff line number Diff line Loading @@ -16,15 +16,25 @@ package android.view.inputmethod; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import android.graphics.RectF; import android.os.Parcel; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.inputmethod.SparseRectFArray.SparseRectFArrayBuilder; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Objects; public class SparseRectFArrayTest extends InstrumentationTestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class SparseRectFArrayTest { // A test data for {@link SparseRectFArray}. null represents the gap of indices. private static final RectF[] MANY_RECTS = new RectF[] { null, Loading @@ -49,7 +59,7 @@ public class SparseRectFArrayTest extends InstrumentationTestCase { new RectF(118.0f, 218.0f, 318.0f, 418.0f), }; @SmallTest @Test public void testBuilder() throws Exception { final RectF TEMP_RECT = new RectF(10.0f, 20.0f, 30.0f, 40.0f); final int TEMP_FLAGS = 0x1234; Loading Loading @@ -128,7 +138,7 @@ public class SparseRectFArrayTest extends InstrumentationTestCase { assertNull(builder.build().get(0)); } @SmallTest @Test public void testEquality() throws Exception { // Empty array should be equal. assertEqualRects(new SparseRectFArrayBuilder().build(), Loading Loading @@ -225,7 +235,7 @@ public class SparseRectFArrayTest extends InstrumentationTestCase { .build()); } @SmallTest @Test public void testBuilderAppend() throws Exception { // Key should be appended in ascending order. try { Loading
core/tests/coretests/src/com/android/internal/inputmethod/InputMethodSubtypeSwitchingControllerTest.java +16 −7 Original line number Diff line number Diff line Loading @@ -16,11 +16,15 @@ package com.android.internal.inputmethod; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.content.pm.ApplicationInfo; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder; Loading @@ -28,11 +32,16 @@ import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder; import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ControllerImpl; import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem; import org.junit.Test; import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class InputMethodSubtypeSwitchingControllerTest { private static final String DUMMY_PACKAGE_NAME = "dummy package name"; private static final String DUMMY_IME_LABEL = "dummy ime label"; private static final String DUMMY_SETTING_ACTIVITY_NAME = ""; Loading Loading @@ -190,7 +199,7 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe controller.onUserActionLocked(subtypeListItem.mImi, subtype); } @SmallTest @Test public void testControllerImpl() throws Exception { final List<ImeSubtypeListItem> disabledItems = createDisabledImeSubtypes(); final ImeSubtypeListItem disabledIme_en_US = disabledItems.get(0); Loading Loading @@ -250,7 +259,7 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe disabledSubtypeUnawareIme, null, null); } @SmallTest @Test public void testControllerImplWithUserAction() throws Exception { final List<ImeSubtypeListItem> enabledItems = createEnabledImeSubtypes(); final ImeSubtypeListItem latinIme_en_US = enabledItems.get(0); Loading Loading @@ -331,7 +340,7 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe switchingUnawarelatinIme_en_UK, switchUnawareJapaneseIme_ja_JP); } @SmallTest @Test public void testImeSubtypeListItem() throws Exception { final List<ImeSubtypeListItem> items = new ArrayList<>(); addDummyImeSubtypeListItems(items, "LatinIme", "LatinIme", Loading Loading @@ -360,7 +369,7 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe assertFalse(item_EN_US.mIsSystemLocale); } @SmallTest @Test public void testImeSubtypeListComparator() throws Exception { { final List<ImeSubtypeListItem> items = Arrays.asList( Loading