aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/SuggestTestsBase.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-01-13 17:51:21 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-01-13 19:14:42 +0900
commit4cabb049718003341edc75be23fbd87a7eea9cc6 (patch)
treef319f0c7d7c87d7da7dd2a6c5482366ae45f30f3 /tests/src/com/android/inputmethod/latin/SuggestTestsBase.java
parentca132ce8e224eaae6d7d9b01fb6183708779684b (diff)
downloadlatinime-4cabb049718003341edc75be23fbd87a7eea9cc6.tar.gz
latinime-4cabb049718003341edc75be23fbd87a7eea9cc6.tar.xz
latinime-4cabb049718003341edc75be23fbd87a7eea9cc6.zip
Use KeyboardSet for unit test
Change-Id: I6a08e04628bac0222140e5b1b108f6bcb39859a2
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/SuggestTestsBase.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/SuggestTestsBase.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/src/com/android/inputmethod/latin/SuggestTestsBase.java b/tests/src/com/android/inputmethod/latin/SuggestTestsBase.java
index 9dd61d78c..73e34ba6f 100644
--- a/tests/src/com/android/inputmethod/latin/SuggestTestsBase.java
+++ b/tests/src/com/android/inputmethod/latin/SuggestTestsBase.java
@@ -22,8 +22,9 @@ import android.test.AndroidTestCase;
import android.text.InputType;
import android.text.TextUtils;
import android.util.DisplayMetrics;
+import android.view.inputmethod.EditorInfo;
-import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.KeyboardSet;
import java.io.File;
import java.io.InputStream;
@@ -38,7 +39,12 @@ public class SuggestTestsBase extends AndroidTestCase {
mTestPackageFile = new File(getTestContext().getApplicationInfo().sourceDir);
}
- protected KeyboardId createKeyboardId(Locale locale, int orientation) {
+ protected KeyboardSet createKeyboardSet(Locale locale, int orientation) {
+ return createKeyboardSet(locale, orientation, false);
+ }
+
+ protected KeyboardSet createKeyboardSet(Locale locale, int orientation,
+ boolean touchPositionCorrectionEnabled) {
final DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
final int width;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
@@ -50,8 +56,12 @@ public class SuggestTestsBase extends AndroidTestCase {
+ "orientation=" + orientation);
return null;
}
- return new KeyboardId(KeyboardId.ELEMENT_ALPHABET, locale, orientation, width,
- KeyboardId.MODE_TEXT, InputType.TYPE_CLASS_TEXT, 0, false, false, false, false);
+ final EditorInfo editorInfo = new EditorInfo();
+ editorInfo.inputType = InputType.TYPE_CLASS_TEXT;
+ final KeyboardSet.Builder builder = new KeyboardSet.Builder(getContext(), editorInfo);
+ builder.setScreenGeometry(orientation, width);
+ builder.setSubtype(locale, true, touchPositionCorrectionEnabled);
+ return builder.build();
}
protected InputStream openTestRawResource(int resIdInTest) {