aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/common/InputPointersTests.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2018-07-06 10:10:54 -0700
committerYohei Yukawa <yukawa@google.com>2018-07-06 10:10:54 -0700
commitd3b93cc95061ada6a162d7989e313f818e6d4e15 (patch)
treea4e3eaee6b84d20817d82b2a263e0e47bcc98753 /tests/src/com/android/inputmethod/latin/common/InputPointersTests.java
parenta497886dda70bbd401652560d11d8f4010985e96 (diff)
downloadlatinime-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/common/InputPointersTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/common/InputPointersTests.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/tests/src/com/android/inputmethod/latin/common/InputPointersTests.java b/tests/src/com/android/inputmethod/latin/common/InputPointersTests.java
index 6b3490de8..9ead0ae25 100644
--- a/tests/src/com/android/inputmethod/latin/common/InputPointersTests.java
+++ b/tests/src/com/android/inputmethod/latin/common/InputPointersTests.java
@@ -16,15 +16,27 @@
package com.android.inputmethod.latin.common;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Arrays;
@SmallTest
-public class InputPointersTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class InputPointersTests {
private static final int DEFAULT_CAPACITY = 48;
+ @Test
public void testNewInstance() {
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
assertEquals("new instance size", 0, src.getPointerSize());
@@ -34,6 +46,7 @@ public class InputPointersTests extends AndroidTestCase {
assertNotNull("new instance times", src.getTimes());
}
+ @Test
public void testReset() {
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int[] xCoordinates = src.getXCoordinates();
@@ -49,6 +62,7 @@ public class InputPointersTests extends AndroidTestCase {
assertNotSame("times after reset", times, src.getTimes());
}
+ @Test
public void testAdd() {
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = src.getXCoordinates().length * 2 + 10;
@@ -72,6 +86,7 @@ public class InputPointersTests extends AndroidTestCase {
}
}
+ @Test
public void testAddAt() {
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = 1000, step = 100;
@@ -95,6 +110,7 @@ public class InputPointersTests extends AndroidTestCase {
}
}
+ @Test
public void testSet() {
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = src.getXCoordinates().length * 2 + 10;
@@ -114,6 +130,7 @@ public class InputPointersTests extends AndroidTestCase {
assertSame("times after set", dst.getTimes(), src.getTimes());
}
+ @Test
public void testCopy() {
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = 100;
@@ -142,6 +159,7 @@ public class InputPointersTests extends AndroidTestCase {
dst.getTimes(), 0, src.getTimes(), 0, size);
}
+ @Test
public void testAppend() {
final int dstLength = 50;
final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
@@ -211,6 +229,7 @@ public class InputPointersTests extends AndroidTestCase {
srcTimes.getPrimitiveArray(), startPos, dst.getTimes(), dstLength, srcLength);
}
+ @Test
public void testAppendResizableIntArray() {
final int dstLength = 50;
final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
@@ -296,6 +315,7 @@ public class InputPointersTests extends AndroidTestCase {
}
}
+ @Test
public void testShift() {
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = 100;