aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputPointersTests.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-07-18 20:31:09 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-07-19 12:06:00 +0900
commit57f7de0ba664187e13bcea5adff7f5f65eddd823 (patch)
tree58781641ef6d5eb5cfdc625b3c76e2d9c9810741 /tests/src/com/android/inputmethod/latin/InputPointersTests.java
parent71b772ec585e74aeb7451dbe56f3be4eafa88bd2 (diff)
downloadlatinime-57f7de0ba664187e13bcea5adff7f5f65eddd823.tar.gz
latinime-57f7de0ba664187e13bcea5adff7f5f65eddd823.tar.xz
latinime-57f7de0ba664187e13bcea5adff7f5f65eddd823.zip
Add default capacity parameter to InputPointers' constructor
Change-Id: I02f23096f0682d30effe4dfc1ca57881a1e4aedc
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputPointersTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputPointersTests.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputPointersTests.java b/tests/src/com/android/inputmethod/latin/InputPointersTests.java
index 524921e25..0ab3cb970 100644
--- a/tests/src/com/android/inputmethod/latin/InputPointersTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputPointersTests.java
@@ -19,8 +19,10 @@ package com.android.inputmethod.latin;
import android.test.AndroidTestCase;
public class InputPointersTests extends AndroidTestCase {
+ private static final int DEFAULT_CAPACITY = 48;
+
public void testNewInstance() {
- final InputPointers src = new InputPointers();
+ final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
assertEquals("newInstance size", 0, src.getPointerSize());
assertNotNull("new instance xCoordinates", src.getXCoordinates());
assertNotNull("new instance yCoordinates", src.getYCoordinates());
@@ -29,7 +31,7 @@ public class InputPointersTests extends AndroidTestCase {
}
public void testReset() {
- final InputPointers src = new InputPointers();
+ final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int[] xCoordinates = src.getXCoordinates();
final int[] yCoordinates = src.getXCoordinates();
final int[] pointerIds = src.getXCoordinates();
@@ -44,7 +46,7 @@ public class InputPointersTests extends AndroidTestCase {
}
public void testAdd() {
- final InputPointers src = new InputPointers();
+ final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = src.getXCoordinates().length * 2 + 10;
for (int i = 0; i < limit; i++) {
src.addPointer(i, i * 2, i * 3, i * 4);
@@ -59,7 +61,7 @@ public class InputPointersTests extends AndroidTestCase {
}
public void testAddAt() {
- final InputPointers src = new InputPointers();
+ final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = 1000, step = 100;
for (int i = 0; i < limit; i += step) {
src.addPointer(i, i, i * 2, i * 3, i * 4);
@@ -74,12 +76,12 @@ public class InputPointersTests extends AndroidTestCase {
}
public void testSet() {
- final InputPointers src = new InputPointers();
+ final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = src.getXCoordinates().length * 2 + 10;
for (int i = 0; i < limit; i++) {
src.addPointer(i, i * 2, i * 3, i * 4);
}
- final InputPointers dst = new InputPointers();
+ final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
dst.set(src);
assertEquals("after set size", dst.getPointerSize(), src.getPointerSize());
assertSame("after set xCoordinates", dst.getXCoordinates(), src.getXCoordinates());
@@ -89,12 +91,12 @@ public class InputPointersTests extends AndroidTestCase {
}
public void testCopy() {
- final InputPointers src = new InputPointers();
+ final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int limit = 100;
for (int i = 0; i < limit; i++) {
src.addPointer(i, i * 2, i * 3, i * 4);
}
- final InputPointers dst = new InputPointers();
+ final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
dst.copy(src);
assertEquals("after copy size", dst.getPointerSize(), src.getPointerSize());
assertNotSame("after copy xCoordinates", dst.getXCoordinates(), src.getXCoordinates());
@@ -113,18 +115,18 @@ public class InputPointersTests extends AndroidTestCase {
}
public void testAppend() {
- final InputPointers src = new InputPointers();
+ final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
final int srcLen = 100;
for (int i = 0; i < srcLen; i++) {
src.addPointer(i, i * 2, i * 3, i * 4);
}
final int dstLen = 50;
- final InputPointers dst = new InputPointers();
+ final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
for (int i = 0; i < dstLen; i++) {
final int value = -i - 1;
dst.addPointer(value * 4, value * 3, value * 2, value);
}
- final InputPointers dstCopy = new InputPointers();
+ final InputPointers dstCopy = new InputPointers(DEFAULT_CAPACITY);
dstCopy.copy(dst);
dst.append(src, 0, 0);