aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Android.bp2
-rw-r--r--tests/AndroidManifest.xml5
-rw-r--r--tests/AndroidTest.xml40
-rw-r--r--tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java18
-rw-r--r--tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java23
-rw-r--r--tests/src/com/android/inputmethod/compat/TextInfoCompatUtilsTests.java14
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardLayoutTest.java6
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java41
-rw-r--r--tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderAutoOrderTests.java156
-rw-r--r--tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderFixedOrderTests.java167
-rw-r--r--tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderMaxOrderTests.java153
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/HermiteInterpolatorTests.java141
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSetTests.java26
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/MatrixUtilsTests.java34
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecSplitTests.java32
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecStringReferenceTests.java38
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueueTests.java26
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/SmoothingUtilsTests.java16
-rw-r--r--tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java48
-rw-r--r--tests/src/com/android/inputmethod/latin/ContactsContentObserverTest.java5
-rw-r--r--tests/src/com/android/inputmethod/latin/ContactsDictionaryUtilsTest.java5
-rw-r--r--tests/src/com/android/inputmethod/latin/ContactsManagerTest.java30
-rw-r--r--tests/src/com/android/inputmethod/latin/DictionaryFacilitatorLruCacheTests.java18
-rw-r--r--tests/src/com/android/inputmethod/latin/NgramContextTests.java24
-rw-r--r--tests/src/com/android/inputmethod/latin/PersonalDictionaryLookupTest.java492
-rw-r--r--tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java40
-rw-r--r--tests/src/com/android/inputmethod/latin/RichInputMethodSubtypeTests.java39
-rw-r--r--tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java20
-rw-r--r--tests/src/com/android/inputmethod/latin/WordComposerTests.java17
-rw-r--r--tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java33
-rw-r--r--tests/src/com/android/inputmethod/latin/common/InputPointersTests.java26
-rw-r--r--tests/src/com/android/inputmethod/latin/common/ResizableIntArrayTests.java28
-rw-r--r--tests/src/com/android/inputmethod/latin/common/StringUtilsTests.java32
-rw-r--r--tests/src/com/android/inputmethod/latin/common/UnicodeSurrogateTests.java16
-rw-r--r--tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java24
-rw-r--r--tests/src/com/android/inputmethod/latin/network/HttpUrlConnectionBuilderTests.java33
-rw-r--r--tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java46
-rw-r--r--tests/src/com/android/inputmethod/latin/settings/AccountsSettingsFragmentTests.java48
-rw-r--r--tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java40
-rw-r--r--tests/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelperTests.java26
-rw-r--r--tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java15
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtilsTests.java23
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/AsyncResultHolderTests.java16
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java17
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java18
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/DictionaryInfoUtilsTests.java19
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/ExecutorUtilsTests.java13
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java32
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/JsonUtilsTests.java13
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/LanguageOnSpacebarUtilsTests.java27
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/RecapitalizeStatusTests.java14
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/ResourceUtilsTests.java17
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/SpannableStringUtilsTests.java23
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java39
54 files changed, 1452 insertions, 862 deletions
diff --git a/tests/Android.bp b/tests/Android.bp
index a99cc5b41..7a8359723 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -40,5 +40,7 @@ android_test {
instrumentation_for: "LatinIME",
+ min_sdk_version: "14",
+ target_sdk_version: "21",
sdk_version: "current",
}
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index c7a9e13a2..cf778c187 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -15,9 +15,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.inputmethod.latin.tests">
-
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
+ package="com.android.inputmethod.latin.tests"
+ android:versionCode="28">
<uses-permission android:name="android.permission.READ_CONTACTS" />
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
new file mode 100644
index 000000000..d560cb96e
--- /dev/null
+++ b/tests/AndroidTest.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs Tests for LatinIME.">
+ <!--
+ To run this test with atest, run the following commands:
+
+ tapas adb LatinIME LatinIMETests arm64 userdebug && \
+ DISABLE_PROGUARD=true make -j LatinIME && \
+ adb install -r $OUT/system/app/LatinIME/LatinIME.apk && \
+ atest LatinIMETests
+
+ currently tradefed does not look up files under $OUT/system/
+ hence we cannot rely on "test-file-name" to install LatinIME.apk
+ -->
+
+ <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="LatinIMETests.apk" />
+ </target_preparer>
+
+ <option name="test-tag" value="LatinIMETests" />
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="com.android.inputmethod.latin.tests" />
+ <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+ <option name="hidden-api-checks" value="false"/>
+ </test>
+</configuration>
diff --git a/tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java b/tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java
index 67e76464b..05c15ec21 100644
--- a/tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java
+++ b/tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java
@@ -16,18 +16,29 @@
package com.android.inputmethod.compat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import android.graphics.Typeface;
import android.os.Build;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.StyleSpan;
import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class LocaleSpanCompatUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class LocaleSpanCompatUtilsTests {
+ @Test
public void testInstantiatable() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
// LocaleSpan isn't yet available.
@@ -61,6 +72,7 @@ public class LocaleSpanCompatUtilsTests extends AndroidTestCase {
assertEquals(expectedCount, spans.length);
}
+ @Test
public void testUpdateLocaleSpan() {
if (!LocaleSpanCompatUtils.isLocaleSpanAvailable()) {
return;
diff --git a/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java b/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
index 2d6d28f2b..820648d23 100644
--- a/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
+++ b/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
@@ -16,10 +16,15 @@
package com.android.inputmethod.compat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import android.annotation.TargetApi;
+import android.content.Context;
import android.os.Build;
-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 android.text.Spanned;
import android.text.TextUtils;
import android.text.style.SuggestionSpan;
@@ -33,8 +38,16 @@ import java.util.Locale;
import javax.annotation.Nullable;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class SuggestionSpanUtilsTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class SuggestionSpanUtilsTest {
+
+ private Context getContext() {
+ return InstrumentationRegistry.getTargetContext();
+ }
/**
* Helper method to create a dummy {@link SuggestedWordInfo}.
@@ -91,6 +104,7 @@ public class SuggestionSpanUtilsTest extends AndroidTestCase {
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
+ @Test
public void testGetTextWithAutoCorrectionIndicatorUnderline() {
final String ORIGINAL_TEXT = "Hey!";
final Locale NONNULL_LOCALE = new Locale("en", "GB");
@@ -107,6 +121,7 @@ public class SuggestionSpanUtilsTest extends AndroidTestCase {
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
+ @Test
public void testGetTextWithAutoCorrectionIndicatorUnderlineRootLocale() {
final String ORIGINAL_TEXT = "Hey!";
final CharSequence text = SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(
@@ -121,6 +136,7 @@ public class SuggestionSpanUtilsTest extends AndroidTestCase {
new String[]{}, Locale.ROOT, text);
}
+ @Test
public void testGetTextWithSuggestionSpan() {
final SuggestedWordInfo prediction1 =
createWordInfo("Quality", SuggestedWordInfo.KIND_PREDICTION);
@@ -218,6 +234,7 @@ public class SuggestionSpanUtilsTest extends AndroidTestCase {
}
}
+ @Test
public void testFindFirstLocaleFromSuggestionSpans() {
final String[] suggestions = new String[] {"Quality", "Speed", "Price"};
final SuggestionSpan nullLocaleSpan = new SuggestionSpan((Locale)null, suggestions, 0);
diff --git a/tests/src/com/android/inputmethod/compat/TextInfoCompatUtilsTests.java b/tests/src/com/android/inputmethod/compat/TextInfoCompatUtilsTests.java
index c399cced6..ec7c2ab6e 100644
--- a/tests/src/com/android/inputmethod/compat/TextInfoCompatUtilsTests.java
+++ b/tests/src/com/android/inputmethod/compat/TextInfoCompatUtilsTests.java
@@ -16,10 +16,12 @@
package com.android.inputmethod.compat;
+import static org.junit.Assert.assertTrue;
+
import android.graphics.Typeface;
import android.os.Parcel;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
@@ -29,8 +31,13 @@ import android.view.textservice.TextInfo;
import java.util.Arrays;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class TextInfoCompatUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class TextInfoCompatUtilsTests {
final private static String TEST_TEXT = "0123456789";
final private static int TEST_COOKIE = 0x1234;
final private static int TEST_SEQUENCE_NUMBER = 0x4321;
@@ -45,6 +52,7 @@ public class TextInfoCompatUtilsTests extends AndroidTestCase {
final private static int TEST_URL_SPAN_END = 7;
final private static int TEST_URL_SPAN_FLAGS = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
+ @Test
public void testGetCharSequence() {
final SpannableString text = new SpannableString(TEST_TEXT);
text.setSpan(TEST_STYLE_SPAN, TEST_STYLE_SPAN_START, TEST_STYLE_SPAN_END,
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutTest.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutTest.java
index 1e1f82fc0..d620a777b 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutTest.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutTest.java
@@ -18,15 +18,17 @@ package com.android.inputmethod.keyboard;
import static org.junit.Assert.assertEquals;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import java.util.ArrayList;
import org.junit.Test;
+import org.junit.runner.RunWith;
@SmallTest
+@RunWith(AndroidJUnit4.class)
public class KeyboardLayoutTest {
-
@Test
public void testNewKeyboardLayout() {
KeyboardLayout keyboardLayout = KeyboardLayout
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
index 33e88c13b..594277356 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
@@ -16,22 +16,34 @@
package com.android.inputmethod.keyboard;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_ICS;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_KLP;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_DARK;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_LIGHT;
+import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.preference.PreferenceManager;
-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 java.util.Arrays;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class KeyboardThemeTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class KeyboardThemeTests {
private SharedPreferences mPrefs;
private static final int THEME_ID_NULL = -1;
@@ -39,9 +51,12 @@ public class KeyboardThemeTests extends AndroidTestCase {
private static final int THEME_ID_ILLEGAL = -3;
private static final String ILLEGAL_THEME_ID_STRING = "ThisCausesNumberFormatExecption";
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ private Context getContext() {
+ return InstrumentationRegistry.getTargetContext();
+ }
+
+ @Before
+ public void setUp() throws Exception {
mPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
}
@@ -110,6 +125,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
assertKeyboardThemePreference(sdkVersion, THEME_ID_ILLEGAL, defaultThemeId);
}
+ @Test
public void testKeyboardThemePreferenceOnKlp() {
assertKeyboardThemePreferenceOnKlp(VERSION_CODES.ICE_CREAM_SANDWICH);
assertKeyboardThemePreferenceOnKlp(VERSION_CODES.ICE_CREAM_SANDWICH_MR1);
@@ -130,6 +146,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
assertKeyboardThemePreference(sdkVersion, THEME_ID_ILLEGAL, defaultThemeId);
}
+ @Test
public void testKeyboardThemePreferenceOnLxx() {
assertKeyboardThemePreferenceOnLxx(Build.VERSION_CODES.LOLLIPOP);
}
@@ -165,6 +182,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
assertDefaultKeyboardTheme(sdkVersion, THEME_ID_ILLEGAL, THEME_ID_KLP);
}
+ @Test
public void testDefaultKeyboardThemeOnKlp() {
assertDefaultKeyboardThemeOnKlp(VERSION_CODES.ICE_CREAM_SANDWICH);
assertDefaultKeyboardThemeOnKlp(VERSION_CODES.ICE_CREAM_SANDWICH_MR1);
@@ -183,6 +201,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
assertDefaultKeyboardTheme(sdkVersion, THEME_ID_ILLEGAL, THEME_ID_LXX_LIGHT);
}
+ @Test
public void testDefaultKeyboardThemeOnLxx() {
assertDefaultKeyboardThemeOnLxx(Build.VERSION_CODES.LOLLIPOP);
}
@@ -231,6 +250,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
// Upgrading keyboard on I,J and K.
+ @Test
public void testUpgradeKeyboardToLxxOnKlp() {
assertUpgradeKeyboardToLxxOnKlp(VERSION_CODES.ICE_CREAM_SANDWICH);
assertUpgradeKeyboardToLxxOnKlp(VERSION_CODES.ICE_CREAM_SANDWICH_MR1);
@@ -250,6 +270,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
// Upgrading keyboard on L.
+ @Test
public void testUpgradeKeyboardToLxxOnLxx() {
assertUpgradeKeyboardToLxxOnLxx(Build.VERSION_CODES.LOLLIPOP);
}
@@ -293,6 +314,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
// Update platform from I,J, and K to I,J, and K
+ @Test
public void testUpgradePlatformToKlpFromKlp() {
assertUpgradePlatformToKlpFrom(VERSION_CODES.ICE_CREAM_SANDWICH);
assertUpgradePlatformToKlpFrom(VERSION_CODES.ICE_CREAM_SANDWICH_MR1);
@@ -318,6 +340,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
// Update platform from I,J, and K to L
+ @Test
public void testUpgradePlatformToLxx() {
assertUpgradePlatformToLxxFrom(VERSION_CODES.ICE_CREAM_SANDWICH);
assertUpgradePlatformToLxxFrom(VERSION_CODES.ICE_CREAM_SANDWICH_MR1);
@@ -328,6 +351,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
// Update platform from L to L.
+ @Test
public void testUpgradePlatformToLxxFromLxx() {
final int oldSdkVersion = Build.VERSION_CODES.LOLLIPOP;
final int newSdkVersion = Build.VERSION_CODES.LOLLIPOP;
@@ -364,10 +388,12 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
}
+ @Test
public void testSortedKeyboardTheme() {
assertSortedKeyboardThemeArray(KeyboardTheme.KEYBOARD_THEMES);
}
+ @Test
public void testSortedAvailableKeyboardTheme() {
assertSortedKeyboardThemeArray(KeyboardTheme.getAvailableThemeArray(getContext()));
}
@@ -384,6 +410,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
assertSortedKeyboardThemeArray(LIMITED_THEMES);
}
+ @Test
public void testMissingSelectedThemeIcs() {
// Clean up preferences.
setKeyboardThemePreference(KeyboardTheme.KLP_KEYBOARD_THEME_KEY, THEME_ID_NULL);
@@ -399,6 +426,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
assertEquals(THEME_ID_KLP, actualTheme.mThemeId);
}
+ @Test
public void testMissingSelectedThemeKlp() {
// Clean up preferences.
setKeyboardThemePreference(KeyboardTheme.KLP_KEYBOARD_THEME_KEY, THEME_ID_NULL);
@@ -414,6 +442,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
assertEquals(THEME_ID_KLP, actualTheme.mThemeId);
}
+ @Test
public void testMissingSelectedThemeLxx() {
// Clean up preferences.
setKeyboardThemePreference(KeyboardTheme.KLP_KEYBOARD_THEME_KEY, THEME_ID_NULL);
diff --git a/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderAutoOrderTests.java b/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderAutoOrderTests.java
index ebefe2d0e..2c15a0291 100644
--- a/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderAutoOrderTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderAutoOrderTests.java
@@ -16,13 +16,21 @@
package com.android.inputmethod.keyboard;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import android.support.test.filters.MediumTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.keyboard.MoreKeysKeyboard.MoreKeysKeyboardParams;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@MediumTest
-public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class MoreKeysKeyboardBuilderAutoOrderTests {
private static final int WIDTH = 10;
private static final int HEIGHT = 10;
@@ -38,11 +46,6 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
private static final int XPOS_R1 = WIDTH * 8 + WIDTH / 2;
private static final int XPOS_R0 = WIDTH * 9 + WIDTH / 2;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
private static MoreKeysKeyboardParams createParams(final int numKeys, final int columnNum,
final int coordXInParent) {
final MoreKeysKeyboardParams params = new MoreKeysKeyboardParams();
@@ -52,6 +55,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
return params;
}
+ @Test
public void testLayoutError() {
MoreKeysKeyboardParams params = null;
try {
@@ -69,6 +73,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// "<1>" is the default key.
// <1>
+ @Test
public void testLayout1KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_M0);
assertEquals("1 key auto 5 M0 columns", 1, params.mNumColumns);
@@ -81,6 +86,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |<1>
+ @Test
public void testLayout1KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L0);
assertEquals("1 key auto 5 L0 columns", 1, params.mNumColumns);
@@ -93,6 +99,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ <1>
+ @Test
public void testLayout1KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L1);
assertEquals("1 key auto 5 L1 columns", 1, params.mNumColumns);
@@ -105,6 +112,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ ___ <1>
+ @Test
public void testLayout1KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L2);
assertEquals("1 key auto 5 L2 columns", 1, params.mNumColumns);
@@ -117,6 +125,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// <1>|
+ @Test
public void testLayout1KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R0);
assertEquals("1 key auto 5 R0 columns", 1, params.mNumColumns);
@@ -129,6 +138,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// <1> ___|
+ @Test
public void testLayout1KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R1);
assertEquals("1 key auto 5 R1 columns", 1, params.mNumColumns);
@@ -141,6 +151,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// <1> ___ ___|
+ @Test
public void testLayout1KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R2);
assertEquals("1 key auto 5 R2 columns", 1, params.mNumColumns);
@@ -153,6 +164,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// <1> [2]
+ @Test
public void testLayout2KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_M0);
assertEquals("2 key auto 5 M0 columns", 2, params.mNumColumns);
@@ -166,6 +178,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |<1> [2]
+ @Test
public void testLayout2KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L0);
assertEquals("2 key auto 5 L0 columns", 2, params.mNumColumns);
@@ -179,6 +192,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ <1> [2]
+ @Test
public void testLayout2KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L1);
assertEquals("2 key auto 5 L1 columns", 2, params.mNumColumns);
@@ -192,6 +206,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ ___ <1> [2]
+ @Test
public void testLayout2KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L2);
assertEquals("2 key auto 5 L2 columns", 2, params.mNumColumns);
@@ -205,6 +220,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [2] <1>|
+ @Test
public void testLayout2KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R0);
assertEquals("2 key auto 5 R0 columns", 2, params.mNumColumns);
@@ -218,6 +234,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [2] <1> ___|
+ @Test
public void testLayout2KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R1);
assertEquals("2 key auto 5 R1 columns", 2, params.mNumColumns);
@@ -231,6 +248,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// <1> [2] ___|
+ @Test
public void testLayout2KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R2);
assertEquals("2 key auto 5 R2 columns", 2, params.mNumColumns);
@@ -244,6 +262,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [3] <1> [2]
+ @Test
public void testLayout3KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_M0);
assertEquals("3 key auto 5 M0 columns", 3, params.mNumColumns);
@@ -258,6 +277,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |<1> [2] [3]
+ @Test
public void testLayout3KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L0);
assertEquals("3 key auto 5 L0 columns", 3, params.mNumColumns);
@@ -272,6 +292,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3]
+ @Test
public void testLayout3KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L1);
assertEquals("3 key auto 5 L1 columns", 3, params.mNumColumns);
@@ -286,6 +307,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2]
+ @Test
public void testLayout3KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L2);
assertEquals("3 key auto 5 L2 columns", 3, params.mNumColumns);
@@ -300,6 +322,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [3] [2] <1>|
+ @Test
public void testLayout3KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R0);
assertEquals("3 key auto 5 R0 columns", 3, params.mNumColumns);
@@ -314,6 +337,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [3] [2] <1> ___|
+ @Test
public void testLayout3KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R1);
assertEquals("3 key auto 5 R1 columns", 3, params.mNumColumns);
@@ -328,6 +352,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [3] <1> [2] ___|
+ @Test
public void testLayout3KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R2);
assertEquals("3 key auto 5 R2 columns", 3, params.mNumColumns);
@@ -343,6 +368,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [3]
// <1> [2]
+ @Test
public void testLayout3KeyAuto2M0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_M0);
assertEquals("3 key auto 2 M0 columns", 2, params.mNumColumns);
@@ -358,6 +384,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[3]
// |<1> [2]
+ @Test
public void testLayout3KeyAuto2L0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L0);
assertEquals("3 key auto 2 L0 columns", 2, params.mNumColumns);
@@ -373,6 +400,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [3]
// |___ <1> [2]
+ @Test
public void testLayout3KeyAuto2L1() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L1);
assertEquals("3 key auto 2 L1 columns", 2, params.mNumColumns);
@@ -388,6 +416,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// | [3]
// |___ ___ <1> [2]
+ @Test
public void testLayout3KeyAuto2L2() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L2);
assertEquals("3 key auto 2 L2 columns", 2, params.mNumColumns);
@@ -403,6 +432,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [3]|
// [2] <1>|
+ @Test
public void testLayout3KeyAuto2R0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R0);
assertEquals("3 key auto 2 R0 columns", 2, params.mNumColumns);
@@ -418,6 +448,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [3] |
// [2] <1> ___|
+ @Test
public void testLayout3KeyAuto2R1() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R1);
assertEquals("3 key auto 2 R1 columns", 2, params.mNumColumns);
@@ -433,6 +464,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [3] |
// <1> [2] ___|
+ @Test
public void testLayout3KeyAuto2R2() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R2);
assertEquals("3 key auto 2 R2 columns", 2, params.mNumColumns);
@@ -448,6 +480,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [4]
// [3] <1> [2]
+ @Test
public void testLayout4KeyAuto3M0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_M0);
assertEquals("4 key auto 3 M0 columns", 3, params.mNumColumns);
@@ -464,6 +497,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[4]
// |<1> [2] [3]
+ @Test
public void testLayout4KeyAuto3L0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L0);
assertEquals("4 key auto 3 L0 columns", 3, params.mNumColumns);
@@ -480,6 +514,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [4]
// |___ <1> [2] [3]
+ @Test
public void testLayout4KeyAuto3L1() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L1);
assertEquals("4 key auto 3 L1 columns", 3, params.mNumColumns);
@@ -496,6 +531,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ ___ [4]
// |___ [3] <1> [2]
+ @Test
public void testLayout4KeyAuto3L2() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L2);
assertEquals("4 key auto 3 L2 columns", 3, params.mNumColumns);
@@ -512,6 +548,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [4]|
// [3] [2] <1>|
+ @Test
public void testLayout4KeyAuto3R0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R0);
assertEquals("4 key auto 3 R0 columns", 3, params.mNumColumns);
@@ -528,6 +565,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [4] ___|
// [3] [2] <1> ___|
+ @Test
public void testLayout4KeyAuto3R1() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R1);
assertEquals("4 key auto 3 R1 columns", 3, params.mNumColumns);
@@ -544,6 +582,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [4] ___|
// [3] <1> [2] ___|
+ @Test
public void testLayout4KeyAuto3R2() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R2);
assertEquals("4 key auto 3 R2 columns", 3, params.mNumColumns);
@@ -559,6 +598,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [3] <1> [2] [4]
+ @Test
public void testLayout4KeyAuto4M0() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_M0);
assertEquals("4 key auto 4 M0 columns", 4, params.mNumColumns);
@@ -574,6 +614,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4]
+ @Test
public void testLayout4KeyAuto4L0() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_L0);
assertEquals("4 key auto 4 L0 columns", 4, params.mNumColumns);
@@ -589,6 +630,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout4KeyAuto4L1() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_L1);
assertEquals("4 key auto 4 L1 columns", 4, params.mNumColumns);
@@ -604,6 +646,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2] [4]
+ @Test
public void testLayout4KeyAuto4L2() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_L2);
assertEquals("4 key auto 4 L2 columns", 4, params.mNumColumns);
@@ -619,6 +662,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [4] [3] [2] <1>|
+ @Test
public void testLayout4KeyAuto4R0() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_R0);
assertEquals("4 key auto 4 R0 columns", 4, params.mNumColumns);
@@ -634,6 +678,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [4] [3] [2] <1> ___|
+ @Test
public void testLayout4KeyAuto4R1() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_R1);
assertEquals("4 key auto 4 R1 columns", 4, params.mNumColumns);
@@ -649,6 +694,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [4] [3] <1> [2] ___|
+ @Test
public void testLayout4KeyAuto4R2() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_R2);
assertEquals("4 key auto 4 R2 columns", 4, params.mNumColumns);
@@ -664,6 +710,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [3] <1> [2] [4]
+ @Test
public void testLayout4KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_M0);
assertEquals("4 key auto 5 M0 columns", 4, params.mNumColumns);
@@ -679,6 +726,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4]
+ @Test
public void testLayout4KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L0);
assertEquals("4 key auto 5 L0 columns", 4, params.mNumColumns);
@@ -694,6 +742,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout4KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L1);
assertEquals("4 key auto 5 L1 columns", 4, params.mNumColumns);
@@ -709,6 +758,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2] [4]
+ @Test
public void testLayout4KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L2);
assertEquals("4 key auto 5 L2 columns", 4, params.mNumColumns);
@@ -724,6 +774,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [4] [3] [2] <1>|
+ @Test
public void testLayout4KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R0);
assertEquals("4 key auto 5 R0 columns", 4, params.mNumColumns);
@@ -739,6 +790,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [4] [3] [2] <1> ___|
+ @Test
public void testLayout4KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R1);
assertEquals("4 key auto 5 R1 columns", 4, params.mNumColumns);
@@ -754,6 +806,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [4] [3] <1> [2] ___|
+ @Test
public void testLayout4KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R2);
assertEquals("4 key auto 5 R2 columns", 4, params.mNumColumns);
@@ -770,6 +823,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [4] [5]
// [3] <1> [2]
+ @Test
public void testLayout5KeyAuto3M0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_M0);
assertEquals("5 key auto 3 M0 columns", 3, params.mNumColumns);
@@ -787,6 +841,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[4] [5]
// |<1> [2] [3]
+ @Test
public void testLayout5KeyAuto3L0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L0);
assertEquals("5 key auto 3 L0 columns", 3, params.mNumColumns);
@@ -804,6 +859,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [4] [5]
// |___ <1> [2] [3]
+ @Test
public void testLayout5KeyAuto3L1() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L1);
assertEquals("5 key auto 3 L1 columns", 3, params.mNumColumns);
@@ -821,6 +877,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [4] [5]
// |___ [3] <1> [2]
+ @Test
public void testLayout5KeyAuto3L2() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L2);
assertEquals("5 key auto 3 L2 columns", 3, params.mNumColumns);
@@ -838,6 +895,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [5] [4]|
// [3] [2] <1>|
+ @Test
public void testLayout5KeyAuto3R0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R0);
assertEquals("5 key auto 3 R0 columns", 3, params.mNumColumns);
@@ -855,6 +913,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [5] [4] ___|
// [3] [2] <1> ___|
+ @Test
public void testLayout5KeyAuto3R1() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R1);
assertEquals("5 key auto 3 R1 columns", 3, params.mNumColumns);
@@ -872,6 +931,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [4] [5] ___|
// [3] <1> [2] ___|
+ @Test
public void testLayout5KeyAuto3R2() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R2);
assertEquals("5 key auto 3 R2 columns", 3, params.mNumColumns);
@@ -889,6 +949,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [5]
// [3] <1> [2] [4]
+ @Test
public void testLayout5KeyAuto4M0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_M0);
assertEquals("5 key auto 4 M0 columns", 4, params.mNumColumns);
@@ -906,6 +967,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[5]
// |<1> [2] [3] [4]
+ @Test
public void testLayout5KeyAuto4L0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L0);
assertEquals("5 key auto 4 L0 columns", 4, params.mNumColumns);
@@ -923,6 +985,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [5]
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout5KeyAuto4L1() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L1);
assertEquals("5 key auto 4 L1 columns", 4, params.mNumColumns);
@@ -940,6 +1003,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [5]
// |___ [3] <1> [2] [4]
+ @Test
public void testLayout5KeyAuto4L2() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L2);
assertEquals("5 key auto 4 L2 columns", 4, params.mNumColumns);
@@ -957,6 +1021,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [5]|
// [4] [3] [2] <1>|
+ @Test
public void testLayout5KeyAuto4R0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R0);
assertEquals("5 key auto 4 R0 columns", 4, params.mNumColumns);
@@ -974,6 +1039,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [5] ___|
// [4] [3] [2] <1> ___|
+ @Test
public void testLayout5KeyAuto4R1() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R1);
assertEquals("5 key auto 4 R1 columns", 4, params.mNumColumns);
@@ -991,6 +1057,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [5] ___|
// [4] [3] <1> [2] ___|
+ @Test
public void testLayout5KeyAuto4R2() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R2);
assertEquals("5 key auto 4 R2 columns", 4, params.mNumColumns);
@@ -1007,6 +1074,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout5KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_M0);
assertEquals("5 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -1023,6 +1091,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout5KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L0);
assertEquals("5 key auto 5 L0 columns", 5, params.mNumColumns);
@@ -1039,6 +1108,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout5KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L1);
assertEquals("5 key auto 5 L1 columns", 5, params.mNumColumns);
@@ -1055,6 +1125,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout5KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L2);
assertEquals("5 key auto 5 L2 columns", 5, params.mNumColumns);
@@ -1071,6 +1142,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout5KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R0);
assertEquals("5 key auto 5 R0 columns", 5, params.mNumColumns);
@@ -1087,6 +1159,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout5KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R1);
assertEquals("5 key auto 5 R1 columns", 5, params.mNumColumns);
@@ -1103,6 +1176,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout5KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R2);
assertEquals("5 key auto 5 R2 columns", 5, params.mNumColumns);
@@ -1120,6 +1194,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [5] [6]
// [3] <1> [2] [4]
+ @Test
public void testLayout6KeyAuto4M0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_M0);
assertEquals("6 key auto 4 M0 columns", 4, params.mNumColumns);
@@ -1138,6 +1213,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[5] [6]
// |<1> [2] [3] [4]
+ @Test
public void testLayout6KeyAuto4L0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L0);
assertEquals("6 key auto 4 L0 columns", 4, params.mNumColumns);
@@ -1156,6 +1232,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [5] [6]
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout6KeyAuto4L1() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L1);
assertEquals("6 key auto 4 L1 columns", 4, params.mNumColumns);
@@ -1174,6 +1251,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [5] [6]
// |___ [3] <1> [2] [4]
+ @Test
public void testLayout6KeyAuto4L2() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L2);
assertEquals("6 key auto 4 L2 columns", 4, params.mNumColumns);
@@ -1192,6 +1270,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [6] [5]|
// [4] [3] [2] <1>|
+ @Test
public void testLayout6KeyAuto4R0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R0);
assertEquals("6 key auto 4 R0 columns", 4, params.mNumColumns);
@@ -1210,6 +1289,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [6] [5] ___|
// [4] [3] [2] <1> ___|
+ @Test
public void testLayout6KeyAuto4R1() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R1);
assertEquals("6 key auto 4 R1 columns", 4, params.mNumColumns);
@@ -1228,6 +1308,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [5] [6] ___|
// [4] [3] <1> [2] ___|
+ @Test
public void testLayout6KeyAuto4R2() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R2);
assertEquals("6 key auto 4 R2 columns", 4, params.mNumColumns);
@@ -1246,6 +1327,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [6]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout6KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_M0);
assertEquals("6 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -1264,6 +1346,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[6]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout6KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L0);
assertEquals("6 key auto 5 L0 columns", 5, params.mNumColumns);
@@ -1282,6 +1365,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [6]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout6KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L1);
assertEquals("6 key auto 5 L1 columns", 5, params.mNumColumns);
@@ -1300,6 +1384,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [6]
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout6KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L2);
assertEquals("6 key auto 5 L2 columns", 5, params.mNumColumns);
@@ -1318,6 +1403,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [6]|
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout6KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R0);
assertEquals("6 key auto 5 R0 columns", 5, params.mNumColumns);
@@ -1336,6 +1422,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [6] ___|
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout6KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R1);
assertEquals("6 key auto 5 R1 columns", 5, params.mNumColumns);
@@ -1354,6 +1441,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [6] ___|
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout6KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R2);
assertEquals("6 key auto 5 R2 columns", 5, params.mNumColumns);
@@ -1371,6 +1459,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4] [5] [6] [7] ___ ___ ___|
+ @Test
public void testLayout7KeyAuto7L0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L0);
assertEquals("7 key auto 7 L0 columns", 7, params.mNumColumns);
@@ -1389,6 +1478,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4] [5] [6] [7] ___ ___|
+ @Test
public void testLayout7KeyAuto7L1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L1);
assertEquals("7 key auto 7 L1 columns", 7, params.mNumColumns);
@@ -1407,6 +1497,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2] [4] [5] [6] [7] ___ ___|
+ @Test
public void testLayout7KeyAuto7L2() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L2);
assertEquals("7 key auto 7 L2 columns", 7, params.mNumColumns);
@@ -1425,6 +1516,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ [5] [3] <1> [2] [4] [6] [7] ___ ___|
+ @Test
public void testLayout7KeyAuto7L3() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L3);
assertEquals("7 key auto 7 L3 columns", 7, params.mNumColumns);
@@ -1443,6 +1535,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ [7] [5] [3] <1> [2] [4] [6] ___ ___|
+ @Test
public void testLayout7KeyAuto7M0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_M0);
assertEquals("7 key auto 7 M0 columns", 7, params.mNumColumns);
@@ -1461,6 +1554,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [5] [3] <1> [2] [4] [6] ___|
+ @Test
public void testLayout7KeyAuto7M1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_M1);
assertEquals("7 key auto 7 M1 columns", 7, params.mNumColumns);
@@ -1479,6 +1573,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [6] [5] [3] <1> [2] [4] ___|
+ @Test
public void testLayout7KeyAuto7R3() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R3);
assertEquals("7 key auto 7 R3 columns", 7, params.mNumColumns);
@@ -1497,6 +1592,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [6] [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout7KeyAuto7R2() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R2);
assertEquals("7 key auto 7 R2 columns", 7, params.mNumColumns);
@@ -1515,6 +1611,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [6] [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout7KeyAuto7R1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R1);
assertEquals("7 key auto 7 R1 columns", 7, params.mNumColumns);
@@ -1533,6 +1630,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [6] [5] [4] [3] [2] <1>|
+ @Test
public void testLayout7KeyAuto7R0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R0);
assertEquals("7 key auto 7 R0 columns", 7, params.mNumColumns);
@@ -1552,6 +1650,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [6] [7]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout7KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_M0);
assertEquals("7 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -1571,6 +1670,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[6] [7]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout7KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L0);
assertEquals("7 key auto 5 L0 columns", 5, params.mNumColumns);
@@ -1590,6 +1690,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [6] [7]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout7KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L1);
assertEquals("7 key auto 5 L1 columns", 5, params.mNumColumns);
@@ -1609,6 +1710,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [6] [7]
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout7KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L2);
assertEquals("7 key auto 5 L2 columns", 5, params.mNumColumns);
@@ -1628,6 +1730,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [7] [6]|
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout7KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R0);
assertEquals("7 key auto 5 R0 columns", 5, params.mNumColumns);
@@ -1647,6 +1750,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [7] [6] ___|
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout7KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R1);
assertEquals("7 key auto 5 R1 columns", 5, params.mNumColumns);
@@ -1666,6 +1770,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [6] [7] ___|
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout7KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R2);
assertEquals("7 key auto 5 R2 columns", 5, params.mNumColumns);
@@ -1686,6 +1791,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [7]
// [6] [4] [5]
// [3] <1> [2]
+ @Test
public void testLayout7KeyAuto3M0() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_M0);
assertEquals("7 key auto 3 M0 columns", 3, params.mNumColumns);
@@ -1706,6 +1812,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[7]
// |[4] [5] [6]
// |<1> [2] [3]
+ @Test
public void testLayout7KeyAuto3L0() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_L0);
assertEquals("7 key auto 3 L0 columns", 3, params.mNumColumns);
@@ -1726,6 +1833,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [7]
// |___ [4] [5] [6]
// |___ <1> [2] [3]
+ @Test
public void testLayout7KeyAuto3L1() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_L1);
assertEquals("7 key auto 3 L1 columns", 3, params.mNumColumns);
@@ -1746,6 +1854,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [7]
// |___ [6] [4] [5]
// |___ [3] <1> [2]
+ @Test
public void testLayout7KeyAuto3L2() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_L2);
assertEquals("7 key auto 3 L2 columns", 3, params.mNumColumns);
@@ -1766,6 +1875,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [7]|
// [6] [5] [4]|
// [3] [2] <1>|
+ @Test
public void testLayout7KeyAuto3R0() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_R0);
assertEquals("7 key auto 3 R0 columns", 3, params.mNumColumns);
@@ -1786,6 +1896,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [7] ___|
// [6] [5] [4] ___|
// [3] [2] <1> ___|
+ @Test
public void testLayout7KeyAuto3R1() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_R1);
assertEquals("7 key auto 3 R1 columns", 3, params.mNumColumns);
@@ -1806,6 +1917,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [7] ___|
// [6] [4] [5] ___|
// [3] <1> [2] ___|
+ @Test
public void testLayout7KeyAuto3R2() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_R2);
assertEquals("7 key auto 3 R2 columns", 3, params.mNumColumns);
@@ -1825,6 +1937,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [8] [6] [7]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout8KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_M0);
assertEquals("8 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -1845,6 +1958,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[6] [7] [8]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout8KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L0);
assertEquals("8 key auto 5 L0 columns", 5, params.mNumColumns);
@@ -1865,6 +1979,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [6] [7] [8]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout8KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L1);
assertEquals("8 key auto 5 L1 columns", 5, params.mNumColumns);
@@ -1885,6 +2000,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [8] [6] [7]
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout8KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L2);
assertEquals("8 key auto 5 L2 columns", 5, params.mNumColumns);
@@ -1905,6 +2021,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [8] [7] [6]|
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout8KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R0);
assertEquals("8 key auto 5 R0 columns", 5, params.mNumColumns);
@@ -1925,6 +2042,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [8] [7] [6] ___|
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout8KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R1);
assertEquals("8 key auto 5 R1 columns", 5, params.mNumColumns);
@@ -1945,6 +2063,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [8] [6] [7] ___|
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout8KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R2);
assertEquals("8 key auto 5 R2 columns", 5, params.mNumColumns);
@@ -1965,6 +2084,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout9KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_M0);
assertEquals("9 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -1986,6 +2106,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[6] [7] [8] [9]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout9KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L0);
assertEquals("9 key auto 5 L0 columns", 5, params.mNumColumns);
@@ -2007,6 +2128,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout9KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L1);
assertEquals("9 key auto 5 L1 columns", 5, params.mNumColumns);
@@ -2028,6 +2150,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9]
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout9KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L2);
assertEquals("9 key auto 5 L2 columns", 5, params.mNumColumns);
@@ -2049,6 +2172,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [9] [8] [7] [6]|
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout9KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R0);
assertEquals("9 key auto 5 R0 columns", 5, params.mNumColumns);
@@ -2070,6 +2194,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [9] [8] [7] [6] ___|
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout9KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R1);
assertEquals("9 key auto 5 R1 columns", 5, params.mNumColumns);
@@ -2091,6 +2216,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [9] [8] [6] [7] ___|
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout9KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R2);
assertEquals("9 key auto 5 R2 columns", 5, params.mNumColumns);
@@ -2112,6 +2238,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [A] [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout10KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_M0);
assertEquals("10 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -2134,6 +2261,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |[6] [7] [8] [9] [A]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout10KeyAuto5L0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L0);
assertEquals("10 key auto 5 L0 columns", 5, params.mNumColumns);
@@ -2156,6 +2284,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9] [A]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout10KeyAuto5L1() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L1);
assertEquals("10 key auto 5 L1 columns", 5, params.mNumColumns);
@@ -2178,6 +2307,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// |___ [8] [6] [7] [9] [A]
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout10KeyAuto5L2() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L2);
assertEquals("10 key auto 5 L2 columns", 5, params.mNumColumns);
@@ -2200,6 +2330,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [A] [9] [8] [7] [6]|
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout10KeyAuto5R0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R0);
assertEquals("10 key auto 5 R0 columns", 5, params.mNumColumns);
@@ -2222,6 +2353,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [A] [9] [8] [7] [6] ___|
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout10KeyAuto5R1() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R1);
assertEquals("10 key auto 5 R1 columns", 5, params.mNumColumns);
@@ -2244,6 +2376,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [A] [9] [8] [6] [7] ___|
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout10KeyAuto5R2() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R2);
assertEquals("10 key auto 5 R2 columns", 5, params.mNumColumns);
@@ -2267,6 +2400,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [B]
// [A] [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout11KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(11, 5, XPOS_M0);
assertEquals("11 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -2291,6 +2425,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [B] [C]
// [A] [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout12KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(12, 5, XPOS_M0);
assertEquals("12 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -2316,6 +2451,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [D] [B] [C]
// [A] [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout13KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(13, 5, XPOS_M0);
assertEquals("13 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -2342,6 +2478,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [D] [B] [C] [E]
// [A] [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout14KeyAuto5M0() {
MoreKeysKeyboardParams params = createParams(14, 5, XPOS_M0);
assertEquals("13 key auto 5 M0 columns", 5, params.mNumColumns);
@@ -2369,6 +2506,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [J] [I] [H] ___|
// [G] [F] [E] [D] [C] [B] [A] [9] ___|
// [8] [7] [6] [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout19KeyAuto8R1() {
MoreKeysKeyboardParams params = createParams(19, 8, XPOS_R1);
assertEquals("19 key auto 8 R1 columns", 8, params.mNumColumns);
@@ -2401,6 +2539,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [J] [H] [I] ___|
// [G] [F] [E] [D] [C] [B] [9] [A] ___|
// [8] [7] [6] [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout19KeyAuto8R2() {
MoreKeysKeyboardParams params = createParams(19, 8, XPOS_R2);
assertEquals("19 key auto 8 R2 columns", 8, params.mNumColumns);
@@ -2433,6 +2572,7 @@ public class MoreKeysKeyboardBuilderAutoOrderTests extends AndroidTestCase {
// [J] [H] [I] ___|
// [G] [F] [E] [D] [B] [9] [A] [C] ___|
// [8] [7] [6] [5] [3] <1> [2] [4] ___|
+ @Test
public void testLayout19KeyAuto8R3() {
MoreKeysKeyboardParams params = createParams(19, 8, XPOS_R3);
assertEquals("19 key auto 8 R3 columns", 8, params.mNumColumns);
diff --git a/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderFixedOrderTests.java b/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderFixedOrderTests.java
index 7e51d955d..2a30448dc 100644
--- a/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderFixedOrderTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderFixedOrderTests.java
@@ -16,13 +16,21 @@
package com.android.inputmethod.keyboard;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import android.support.test.filters.MediumTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.keyboard.MoreKeysKeyboard.MoreKeysKeyboardParams;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@MediumTest
-public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class MoreKeysKeyboardBuilderFixedOrderTests {
private static final int WIDTH = 10;
private static final int HEIGHT = 10;
@@ -38,11 +46,6 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
private static final int XPOS_R1 = WIDTH * 8 + WIDTH / 2;
private static final int XPOS_R0 = WIDTH * 9 + WIDTH / 2;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
private static MoreKeysKeyboardParams createParams(final int numKeys, final int columnNum,
final int coordXInParent) {
final MoreKeysKeyboardParams params = new MoreKeysKeyboardParams();
@@ -52,6 +55,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
return params;
}
+ @Test
public void testLayoutError() {
MoreKeysKeyboardParams params = null;
try {
@@ -69,6 +73,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// "<m>" is the default key.
// <1>
+ @Test
public void testLayout1KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_M0);
assertEquals("1 key fix 5 M0 columns", 1, params.mNumColumns);
@@ -81,6 +86,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |<1>
+ @Test
public void testLayout1KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L0);
assertEquals("1 key fix 5 L0 columns", 1, params.mNumColumns);
@@ -93,6 +99,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ <1>
+ @Test
public void testLayout1KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L1);
assertEquals("1 key fix 5 L1 columns", 1, params.mNumColumns);
@@ -105,6 +112,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ ___ <1>
+ @Test
public void testLayout1KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L2);
assertEquals("1 key fix 5 L2 columns", 1, params.mNumColumns);
@@ -117,6 +125,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// <1>|
+ @Test
public void testLayout1KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R0);
assertEquals("1 key fix 5 R0 columns", 1, params.mNumColumns);
@@ -129,6 +138,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// <1> ___|
+ @Test
public void testLayout1KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R1);
assertEquals("1 key fix 5 R1 columns", 1, params.mNumColumns);
@@ -141,6 +151,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// <1> ___ ___|
+ @Test
public void testLayout1KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R2);
assertEquals("1 key fix 5 R2 columns", 1, params.mNumColumns);
@@ -153,6 +164,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// <1> [2]
+ @Test
public void testLayout2KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_M0);
assertEquals("2 key fix 5 M0 columns", 2, params.mNumColumns);
@@ -166,6 +178,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |<1> [2]
+ @Test
public void testLayout2KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L0);
assertEquals("2 key fix 5 L0 columns", 2, params.mNumColumns);
@@ -179,6 +192,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ <1> [2]
+ @Test
public void testLayout2KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L1);
assertEquals("2 key fix 5 L1 columns", 2, params.mNumColumns);
@@ -192,6 +206,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ ___ <1> [2]
+ @Test
public void testLayout2KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L2);
assertEquals("2 key fix 5 L2 columns", 2, params.mNumColumns);
@@ -205,6 +220,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] <2>|
+ @Test
public void testLayout2KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R0);
assertEquals("2 key fix 5 R0 columns", 2, params.mNumColumns);
@@ -218,6 +234,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] <2> ___|
+ @Test
public void testLayout2KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R1);
assertEquals("2 key fix 5 R1 columns", 2, params.mNumColumns);
@@ -231,6 +248,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// <1> [2] ___|
+ @Test
public void testLayout2KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R2);
assertEquals("2 key fix 5 R2 columns", 2, params.mNumColumns);
@@ -245,6 +263,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [3]
// <1> [2]
+ @Test
public void testLayout3KeyFix2M0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_M0);
assertEquals("3 key fix 2 M0 columns", 2, params.mNumColumns);
@@ -260,6 +279,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[3]
// |<1> [2]
+ @Test
public void testLayout3KeyFix2L0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L0);
assertEquals("3 key fix 2 L0 columns", 2, params.mNumColumns);
@@ -275,6 +295,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [3]
// |___ <1> [2]
+ @Test
public void testLayout3KeyFix2L1() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L1);
assertEquals("3 key fix 2 L1 columns", 2, params.mNumColumns);
@@ -290,6 +311,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// | [3]
// |___ ___ <1> [2]
+ @Test
public void testLayout3KeyFix2L2() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L2);
assertEquals("3 key fix 2 L2 columns", 2, params.mNumColumns);
@@ -305,6 +327,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [3]|
// [1] <2>|
+ @Test
public void testLayout3KeyFix2R0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R0);
assertEquals("3 key fix 2 R0 columns", 2, params.mNumColumns);
@@ -320,6 +343,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [3] ___|
// [1] <2> ___|
+ @Test
public void testLayout3KeyFix2R1() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R1);
assertEquals("3 key fix 2 R1 columns", 2, params.mNumColumns);
@@ -335,6 +359,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [3] ___|
// <1> [2] ___|
+ @Test
public void testLayout3KeyFix2R2() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R2);
assertEquals("3 key fix 2 R2 columns", 2, params.mNumColumns);
@@ -350,6 +375,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [3] [4]
// <1> [2]
+ @Test
public void testLayout4KeyFix2M0() {
MoreKeysKeyboardParams params = createParams(4, 2, XPOS_M0);
assertEquals("3 key fix 2 M0 columns", 2, params.mNumColumns);
@@ -366,6 +392,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[3] [4]
// |<1> [2]
+ @Test
public void testLayout4KeyFix2L0() {
MoreKeysKeyboardParams params = createParams(4, 2, XPOS_L0);
assertEquals("3 key fix 2 L0 columns", 2, params.mNumColumns);
@@ -382,6 +409,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [3] [4]
// |___ <1> [2]
+ @Test
public void testLayout4KeyFix2L1() {
MoreKeysKeyboardParams params = createParams(4, 2, XPOS_L1);
assertEquals("3 key fix 2 L1 columns", 2, params.mNumColumns);
@@ -398,6 +426,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// | [3] [4]
// |___ ___ <1> [2]
+ @Test
public void testLayout4KeyFix2L2() {
MoreKeysKeyboardParams params = createParams(4, 2, XPOS_L2);
assertEquals("3 key fix 2 L2 columns", 2, params.mNumColumns);
@@ -414,6 +443,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [3] [4]|
// [1] <2>|
+ @Test
public void testLayout4KeyFix2R0() {
MoreKeysKeyboardParams params = createParams(4, 2, XPOS_R0);
assertEquals("3 key fix 2 R0 columns", 2, params.mNumColumns);
@@ -430,6 +460,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [3] [4] ___|
// [1] <2> ___|
+ @Test
public void testLayout4KeyFix2R1() {
MoreKeysKeyboardParams params = createParams(4, 2, XPOS_R1);
assertEquals("3 key fix 2 R1 columns", 2, params.mNumColumns);
@@ -446,6 +477,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [3] [4] ___|
// <1> [2] ___|
+ @Test
public void testLayout4KeyFix2R2() {
MoreKeysKeyboardParams params = createParams(4, 2, XPOS_R2);
assertEquals("3 key fix 2 R2 columns", 2, params.mNumColumns);
@@ -461,6 +493,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] <2> [3]
+ @Test
public void testLayout3KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_M0);
assertEquals("3 key fix 5 columns", 3, params.mNumColumns);
@@ -475,6 +508,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |<1> [2] [3]
+ @Test
public void testLayout3KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L0);
assertEquals("3 key fix 5 L0 columns", 3, params.mNumColumns);
@@ -489,6 +523,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3]
+ @Test
public void testLayout3KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L1);
assertEquals("3 key fix 5 L1 columns", 3, params.mNumColumns);
@@ -503,6 +538,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ [1] <2> [3]
+ @Test
public void testLayout3KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L2);
assertEquals("3 key fix 5 L2 columns", 3, params.mNumColumns);
@@ -517,6 +553,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] <3>|
+ @Test
public void testLayout3KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R0);
assertEquals("3 key fix 5 R0 columns", 3, params.mNumColumns);
@@ -531,6 +568,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] <3> ___|
+ @Test
public void testLayout3KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R1);
assertEquals("3 key fix 5 R1 columns", 3, params.mNumColumns);
@@ -545,6 +583,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] <2> [3] ___|
+ @Test
public void testLayout3KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R2);
assertEquals("3 key fix 5 R2 columns", 3, params.mNumColumns);
@@ -560,6 +599,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4]
// [1] <2> [3]
+ @Test
public void testLayout4KeyFix3M0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_M0);
assertEquals("4 key fix 3 M0 columns", 3, params.mNumColumns);
@@ -576,6 +616,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[4]
// |<1> [2] [3]
+ @Test
public void testLayout4KeyFix3L0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L0);
assertEquals("4 key fix 3 L0 columns", 3, params.mNumColumns);
@@ -592,6 +633,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [4]
// |___ <1> [2] [3]
+ @Test
public void testLayout4KeyFix3L1() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L1);
assertEquals("4 key fix 3 L1 columns", 3, params.mNumColumns);
@@ -608,6 +650,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ ___ [4]
// |___ ___ [1] <2> [3]
+ @Test
public void testLayout4KeyFix3L2() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L2);
assertEquals("4 key fix 3 L2 columns", 3, params.mNumColumns);
@@ -624,6 +667,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4]|
// [1] [2] <3>|
+ @Test
public void testLayout4KeyFix3R0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R0);
assertEquals("4 key fix 3 R0 columns", 3, params.mNumColumns);
@@ -640,6 +684,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] ___|
// [1] [2] <3> ___|
+ @Test
public void testLayout4KeyFix3R1() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R1);
assertEquals("4 key fix 3 R1 columns", 3, params.mNumColumns);
@@ -656,6 +701,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] ___|
// [1] <2> [3] ___|
+ @Test
public void testLayout4KeyFix3R2() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R2);
assertEquals("4 key fix 3 R2 columns", 3, params.mNumColumns);
@@ -672,6 +718,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] [5]
// [1] <2> [3]
+ @Test
public void testLayout5KeyFix3M0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_M0);
assertEquals("5 key fix 3 M0 columns", 3, params.mNumColumns);
@@ -689,6 +736,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[4] [5]
// |<1> [2] [3]
+ @Test
public void testLayout5KeyFix3L0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L0);
assertEquals("5 key fix 3 L0 columns", 3, params.mNumColumns);
@@ -706,6 +754,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [4] [5]
// |___ <1> [2] [3]
+ @Test
public void testLayout5KeyFix3L1() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L1);
assertEquals("5 key fix 3 L1 columns", 3, params.mNumColumns);
@@ -723,6 +772,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [4] [5]
// |___ [1] <2> [3]
+ @Test
public void testLayout5KeyFix3L2() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L2);
assertEquals("5 key fix 3 L2 columns", 3, params.mNumColumns);
@@ -740,6 +790,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] [5]|
// [1] [2] <3>|
+ @Test
public void testLayout5KeyFix3R0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R0);
assertEquals("5 key fix 3 R0 columns", 3, params.mNumColumns);
@@ -757,6 +808,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] [5] ___|
// [1] [2] <3> ___|
+ @Test
public void testLayout5KeyFix3R1() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R1);
assertEquals("5 key fix 3 R1 columns", 3, params.mNumColumns);
@@ -774,6 +826,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] [5] ___|
// [1] <2> [3] ___|
+ @Test
public void testLayout5KeyFix3R2() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R2);
assertEquals("5 key fix 3 R2 columns", 3, params.mNumColumns);
@@ -791,6 +844,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] [5] [6]
// [1] <2> [3]
+ @Test
public void testLayout6KeyFix3M0() {
MoreKeysKeyboardParams params = createParams(6, 3, XPOS_M0);
assertEquals("6 key fix 3 M0 columns", 3, params.mNumColumns);
@@ -809,6 +863,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[4] [5] [6]
// |<1> [2] [3]
+ @Test
public void testLayout6KeyFix3L0() {
MoreKeysKeyboardParams params = createParams(6, 3, XPOS_L0);
assertEquals("6 key fix 3 L0 columns", 3, params.mNumColumns);
@@ -827,6 +882,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [4] [5] [6]
// |___ <1> [2] [3]
+ @Test
public void testLayout6KeyFix3L1() {
MoreKeysKeyboardParams params = createParams(6, 3, XPOS_L1);
assertEquals("6 key fix 3 L1 columns", 3, params.mNumColumns);
@@ -845,6 +901,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [4] [5] [6]
// |___ [1] <2> [3]
+ @Test
public void testLayout6KeyFix3L2() {
MoreKeysKeyboardParams params = createParams(6, 3, XPOS_L2);
assertEquals("6 key fix 3 L2 columns", 3, params.mNumColumns);
@@ -863,6 +920,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] [5] [6]|
// [1] [2] <3>|
+ @Test
public void testLayout6KeyFix3R0() {
MoreKeysKeyboardParams params = createParams(6, 3, XPOS_R0);
assertEquals("6 key fix 3 R0 columns", 3, params.mNumColumns);
@@ -881,6 +939,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] [5] [6] ___|
// [1] [2] <3> ___|
+ @Test
public void testLayout6KeyFix3R1() {
MoreKeysKeyboardParams params = createParams(6, 3, XPOS_R1);
assertEquals("6 key fix 3 R1 columns", 3, params.mNumColumns);
@@ -899,6 +958,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [4] [5] [6] ___|
// [1] <2> [3] ___|
+ @Test
public void testLayout6KeyFix3R2() {
MoreKeysKeyboardParams params = createParams(6, 3, XPOS_R2);
assertEquals("6 key fix 3 R2 columns", 3, params.mNumColumns);
@@ -916,6 +976,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// <1> [2] [3] [4]
+ @Test
public void testLayout4KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_M0);
assertEquals("4 key fix 5 columns", 4, params.mNumColumns);
@@ -931,6 +992,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4]
+ @Test
public void testLayout4KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L0);
assertEquals("4 key fix 5 L0 columns", 4, params.mNumColumns);
@@ -946,6 +1008,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout4KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L1);
assertEquals("4 key fix 5 L1 columns", 4, params.mNumColumns);
@@ -961,6 +1024,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ [1] <2> [3] [4]
+ @Test
public void testLayout4KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L2);
assertEquals("4 key fix 5 L2 columns", 4, params.mNumColumns);
@@ -976,6 +1040,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] <4>|
+ @Test
public void testLayout4KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R0);
assertEquals("4 key fix 5 R0 columns", 4, params.mNumColumns);
@@ -991,6 +1056,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] <4> ___|
+ @Test
public void testLayout4KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R1);
assertEquals("4 key fix 5 R1 columns", 4, params.mNumColumns);
@@ -1006,6 +1072,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] <3> [4] ___|
+ @Test
public void testLayout4KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R2);
assertEquals("4 key fix 5 R2 columns", 4, params.mNumColumns);
@@ -1022,6 +1089,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5]
// [1] <2> [3] [4]
+ @Test
public void testLayout5KeyFix4M0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_M0);
assertEquals("5 key fix 4 M0 columns", 4, params.mNumColumns);
@@ -1039,6 +1107,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[5]
// |<1> [2] [3] [4]
+ @Test
public void testLayout5KeyFix4L0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L0);
assertEquals("5 key fix 4 L0 columns", 4, params.mNumColumns);
@@ -1056,6 +1125,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [5]
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout5KeyFix4L1() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L1);
assertEquals("5 key fix 4 L1 columns", 4, params.mNumColumns);
@@ -1073,6 +1143,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [5]
// |___ [1] <2> [3] [4]
+ @Test
public void testLayout5KeyFix4L2() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L2);
assertEquals("5 key fix 4 L2 columns", 4, params.mNumColumns);
@@ -1090,6 +1161,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5]|
// [1] [2] [3] <4>|
+ @Test
public void testLayout5KeyFix4R0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R0);
assertEquals("5 key fix 4 R0 columns", 4, params.mNumColumns);
@@ -1107,6 +1179,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] ___|
// [1] [2] [3] <4> ___|
+ @Test
public void testLayout5KeyFix4R1() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R1);
assertEquals("5 key fix 4 R1 columns", 4, params.mNumColumns);
@@ -1124,6 +1197,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] ___|
// [1] [2] <3> [4] ___|
+ @Test
public void testLayout5KeyFix4R2() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R2);
assertEquals("5 key fix 4 R2 columns", 4, params.mNumColumns);
@@ -1141,6 +1215,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6]
// [1] <2> [3] [4]
+ @Test
public void testLayout6KeyFix4M0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_M0);
assertEquals("6 key fix 4 M0 columns", 4, params.mNumColumns);
@@ -1159,6 +1234,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[5] [6]
// |<1> [2] [3] [4]
+ @Test
public void testLayout6KeyFix4L0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L0);
assertEquals("6 key fix 4 L0 columns", 4, params.mNumColumns);
@@ -1177,6 +1253,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [5] [6]
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout6KeyFix4L1() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L1);
assertEquals("6 key fix 4 L1 columns", 4, params.mNumColumns);
@@ -1195,6 +1272,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [5] [6]
// |___ [1] <2> [3] [4]
+ @Test
public void testLayout6KeyFix4L2() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L2);
assertEquals("6 key fix 4 L2 columns", 4, params.mNumColumns);
@@ -1213,6 +1291,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6]|
// [1] [2] [3] <4>|
+ @Test
public void testLayout6KeyFix4R0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R0);
assertEquals("6 key fix 4 R0 columns", 4, params.mNumColumns);
@@ -1231,6 +1310,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] ___|
// [1] [2] [3] <4> ___|
+ @Test
public void testLayout6KeyFix4R1() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R1);
assertEquals("6 key fix 4 R1 columns", 4, params.mNumColumns);
@@ -1249,6 +1329,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] ___|
// [1] [2] <3> [4] ___|
+ @Test
public void testLayout6KeyFix4R2() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R2);
assertEquals("6 key fix 4 R2 columns", 4, params.mNumColumns);
@@ -1267,6 +1348,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] [7]
// [1] <2> [3] [4]
+ @Test
public void testLayout7KeyFix4M0() {
MoreKeysKeyboardParams params = createParams(7, 4, XPOS_M0);
assertEquals("7 key fix 4 M0 columns", 4, params.mNumColumns);
@@ -1286,6 +1368,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[5] [6] [7]
// |<1> [2] [3] [4]
+ @Test
public void testLayout7KeyFix4L0() {
MoreKeysKeyboardParams params = createParams(7, 4, XPOS_L0);
assertEquals("7 key fix 4 L0 columns", 4, params.mNumColumns);
@@ -1305,6 +1388,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [5] [6] [7]
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout7KeyFix4L1() {
MoreKeysKeyboardParams params = createParams(7, 4, XPOS_L1);
assertEquals("7 key fix 4 L1 columns", 4, params.mNumColumns);
@@ -1324,6 +1408,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [5] [6] [7]
// |___ [1] <2> [3] [4]
+ @Test
public void testLayout7KeyFix4L2() {
MoreKeysKeyboardParams params = createParams(7, 4, XPOS_L2);
assertEquals("7 key fix 4 L2 columns", 4, params.mNumColumns);
@@ -1343,6 +1428,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] [7]|
// [1] [2] [3] <4>|
+ @Test
public void testLayout7KeyFix4R0() {
MoreKeysKeyboardParams params = createParams(7, 4, XPOS_R0);
assertEquals("7 key fix 4 R0 columns", 4, params.mNumColumns);
@@ -1362,6 +1448,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] [7] ___|
// [1] [2] [3] <4> ___|
+ @Test
public void testLayout7KeyFix4R1() {
MoreKeysKeyboardParams params = createParams(7, 4, XPOS_R1);
assertEquals("7 key fix 4 R1 columns", 4, params.mNumColumns);
@@ -1381,6 +1468,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] [7] ___|
// [1] [2] <3> [4] ___|
+ @Test
public void testLayout7KeyFix4R2() {
MoreKeysKeyboardParams params = createParams(7, 4, XPOS_R2);
assertEquals("7 key fix 4 R2 columns", 4, params.mNumColumns);
@@ -1400,6 +1488,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] [7] [8]
// [1] <2> [3] [4]
+ @Test
public void testLayout8KeyFix4M0() {
MoreKeysKeyboardParams params = createParams(8, 4, XPOS_M0);
assertEquals("8 key fix 4 M0 columns", 4, params.mNumColumns);
@@ -1420,6 +1509,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[5] [6] [7] [8]
// |<1> [2] [3] [4]
+ @Test
public void testLayout8KeyFix4L0() {
MoreKeysKeyboardParams params = createParams(8, 4, XPOS_L0);
assertEquals("8 key fix 4 L0 columns", 4, params.mNumColumns);
@@ -1440,6 +1530,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [5] [6] [7] [8]
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout8KeyFix4L1() {
MoreKeysKeyboardParams params = createParams(8, 4, XPOS_L1);
assertEquals("8 key fix 4 L1 columns", 4, params.mNumColumns);
@@ -1460,6 +1551,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [5] [6] [7] [8]
// |___ [1] <2> [3] [4]
+ @Test
public void testLayout8KeyFix4L2() {
MoreKeysKeyboardParams params = createParams(8, 4, XPOS_L2);
assertEquals("8 key fix 4 L2 columns", 4, params.mNumColumns);
@@ -1480,6 +1572,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] [7] [8]|
// [1] [2] [3] <4>|
+ @Test
public void testLayout8KeyFix4R0() {
MoreKeysKeyboardParams params = createParams(8, 4, XPOS_R0);
assertEquals("8 key fix 4 R0 columns", 4, params.mNumColumns);
@@ -1500,6 +1593,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] [7] [8] ___|
// [1] [2] [3] <4> ___|
+ @Test
public void testLayout8KeyFix4R1() {
MoreKeysKeyboardParams params = createParams(8, 4, XPOS_R1);
assertEquals("8 key fix 4 R1 columns", 4, params.mNumColumns);
@@ -1520,6 +1614,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [5] [6] [7] [8] ___|
// [1] [2] <3> [4] ___|
+ @Test
public void testLayout8KeyFix4R2() {
MoreKeysKeyboardParams params = createParams(8, 4, XPOS_R2);
assertEquals("8 key fix 4 R2 columns", 4, params.mNumColumns);
@@ -1539,6 +1634,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout5KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_M0);
assertEquals("5 key fix 5 columns", 5, params.mNumColumns);
@@ -1555,6 +1651,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout5KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L0);
assertEquals("5 key fix 5 L0 columns", 5, params.mNumColumns);
@@ -1571,6 +1668,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout5KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L1);
assertEquals("5 key fix 5 L1 columns", 5, params.mNumColumns);
@@ -1587,6 +1685,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ [1] <2> [3] [4] [5]
+ @Test
public void testLayout5KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L2);
assertEquals("5 key fix 5 L2 columns", 5, params.mNumColumns);
@@ -1603,6 +1702,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] [4] <5>|
+ @Test
public void testLayout5KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R0);
assertEquals("5 key fix 5 R0 columns", 5, params.mNumColumns);
@@ -1619,6 +1719,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] [4] <5> ___|
+ @Test
public void testLayout5KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R1);
assertEquals("5 key fix 5 R1 columns", 5, params.mNumColumns);
@@ -1635,6 +1736,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] <4> [5] ___|
+ @Test
public void testLayout5KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R2);
assertEquals("5 key fix 5 R2 columns", 5, params.mNumColumns);
@@ -1652,6 +1754,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout6KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_M0);
assertEquals("6 key fix 5 columns", 5, params.mNumColumns);
@@ -1670,6 +1773,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[6]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout6KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L0);
assertEquals("6 key fix 5 L0 columns", 5, params.mNumColumns);
@@ -1688,6 +1792,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout6KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L1);
assertEquals("6 key fix 5 L1 columns", 5, params.mNumColumns);
@@ -1706,6 +1811,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6]
// |___ [1] <2> [3] [4] [5]
+ @Test
public void testLayout6KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L2);
assertEquals("6 key fix 5 L2 columns", 5, params.mNumColumns);
@@ -1724,6 +1830,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6]|
// [1] [2] [3] [4] <5>|
+ @Test
public void testLayout6KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R0);
assertEquals("6 key fix 5 R0 columns", 5, params.mNumColumns);
@@ -1742,6 +1849,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] ___|
// [1] [2] [3] [4] <5> ___|
+ @Test
public void testLayout6KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R1);
assertEquals("6 key fix 5 R1 columns", 5, params.mNumColumns);
@@ -1760,6 +1868,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] ___|
// [1] [2] [3] <4> [5] ___|
+ @Test
public void testLayout6KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R2);
assertEquals("6 key fix 5 R2 columns", 5, params.mNumColumns);
@@ -1778,6 +1887,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout7KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_M0);
assertEquals("7 key fix 5 columns", 5, params.mNumColumns);
@@ -1797,6 +1907,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[6] [7]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout7KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L0);
assertEquals("7 key fix 5 L0 columns", 5, params.mNumColumns);
@@ -1816,6 +1927,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6] [7]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout7KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L1);
assertEquals("7 key fix 5 L1 columns", 5, params.mNumColumns);
@@ -1835,6 +1947,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6] [7]
// |___ [1] <2> [3] [4] [5]
+ @Test
public void testLayout7KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L2);
assertEquals("7 key fix 5 L2 columns", 5, params.mNumColumns);
@@ -1854,6 +1967,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7]|
// [1] [2] [3] [4] <5>|
+ @Test
public void testLayout7KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R0);
assertEquals("7 key fix 5 R0 columns", 5, params.mNumColumns);
@@ -1873,6 +1987,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] ___|
// [1] [2] [3] [4] <5> ___|
+ @Test
public void testLayout7KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R1);
assertEquals("7 key fix 5 R1 columns", 5, params.mNumColumns);
@@ -1892,6 +2007,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] ___|
// [1] [2] [3] <4> [5] ___|
+ @Test
public void testLayout7KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R2);
assertEquals("7 key fix 5 R2 columns",5, params.mNumColumns);
@@ -1911,6 +2027,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout8KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_M0);
assertEquals("8 key fix 5 M0 columns", 5, params.mNumColumns);
@@ -1931,6 +2048,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[6] [7] [8]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout8KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L0);
assertEquals("8 key fix 5 L0 columns", 5, params.mNumColumns);
@@ -1951,6 +2069,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6] [7] [8]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout8KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L1);
assertEquals("8 key fix 5 L1 columns", 5, params.mNumColumns);
@@ -1971,6 +2090,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6] [7] [8]
// |___ [1] <2> [3] [4] [5]
+ @Test
public void testLayout8KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L2);
assertEquals("8 key fix 5 L2 columns", 5, params.mNumColumns);
@@ -1991,6 +2111,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8]|
// [1] [2] [3] [4] <5>|
+ @Test
public void testLayout8KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R0);
assertEquals("8 key fix 5 R0 columns", 5, params.mNumColumns);
@@ -2011,6 +2132,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] ___|
// [1] [2] [3] [4] <5> ___|
+ @Test
public void testLayout8KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R1);
assertEquals("8 key fix 5 R1 columns", 5, params.mNumColumns);
@@ -2031,6 +2153,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] ___|
// [1] [2] [3] <4> [5] ___|
+ @Test
public void testLayout8KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R2);
assertEquals("8 key fix 5 R2 columns", 5, params.mNumColumns);
@@ -2051,6 +2174,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] [9]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout9KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_M0);
assertEquals("9 key fix 5 M0 columns", 5, params.mNumColumns);
@@ -2072,6 +2196,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[6] [7] [8] [9]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout9KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L0);
assertEquals("9 key fix 5 L0 columns", 5, params.mNumColumns);
@@ -2093,6 +2218,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout9KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L1);
assertEquals("9 key fix 5 L1 columns", 5, params.mNumColumns);
@@ -2114,6 +2240,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9]
// |___ [1] <2> [3] [4] [5]
+ @Test
public void testLayout9KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L2);
assertEquals("9 key fix 5 L2 columns", 5, params.mNumColumns);
@@ -2135,6 +2262,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] [9]|
// [1] [2] [3] [4] <5>|
+ @Test
public void testLayout9KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R0);
assertEquals("9 key fix 5 R0 columns", 5, params.mNumColumns);
@@ -2156,6 +2284,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] [9] ___|
// [1] [2] [3] [4] <5> ___|
+ @Test
public void testLayout9KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R1);
assertEquals("9 key fix 5 R1 columns", 5, params.mNumColumns);
@@ -2177,6 +2306,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] [9] ___|
// [1] [2] [3] <4> [5] ___|
+ @Test
public void testLayout9KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R2);
assertEquals("9 key fix 5 R2 columns", 5, params.mNumColumns);
@@ -2198,6 +2328,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] [9] [A]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout10KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_M0);
assertEquals("10 key fix 5 M0 columns", 5, params.mNumColumns);
@@ -2220,6 +2351,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |[6] [7] [8] [9] [A]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout10KeyFix5L0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L0);
assertEquals("10 key fix 5 L0 columns", 5, params.mNumColumns);
@@ -2242,6 +2374,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9] [A]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout10KeyFix5L1() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L1);
assertEquals("10 key fix 5 L1 columns", 5, params.mNumColumns);
@@ -2264,6 +2397,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9] [A]
// |___ [1] <2> [3] [4] [5]
+ @Test
public void testLayout10KeyFix5L2() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L2);
assertEquals("10 key fix 5 L2 columns", 5, params.mNumColumns);
@@ -2286,6 +2420,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] [9] [A]|
// [1] [2] [3] [4] <5>|
+ @Test
public void testLayout10KeyFix5R0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R0);
assertEquals("10 key fix 5 R0 columns", 5, params.mNumColumns);
@@ -2308,6 +2443,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] [9] [A] ___|
// [1] [2] [3] [4] <5> ___|
+ @Test
public void testLayout10KeyFix5R1() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R1);
assertEquals("10 key fix 5 R1 columns", 5, params.mNumColumns);
@@ -2330,6 +2466,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [6] [7] [8] [9] [A] ___|
// [1] [2] [3] <4> [5] ___|
+ @Test
public void testLayout10KeyFix5R2() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R2);
assertEquals("10 key fix 5 R2 columns", 5, params.mNumColumns);
@@ -2353,6 +2490,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [B]
// [6] [7] [8] [9] [A]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout11KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(11, 5, XPOS_M0);
assertEquals("11 key fix 5 M0 columns", 5, params.mNumColumns);
@@ -2377,6 +2515,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [B] [C]
// [6] [7] [8] [9] [A]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout12KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(12, 5, XPOS_M0);
assertEquals("12 key fix 5 M0 columns", 5, params.mNumColumns);
@@ -2402,6 +2541,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [B] [C] [D]
// [6] [7] [8] [9] [A]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout13KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(13, 5, XPOS_M0);
assertEquals("13 key fix 5 M0 columns", 5, params.mNumColumns);
@@ -2428,6 +2568,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
// [B] [C] [D] [E]
// [6] [7] [8] [9] [A]
// [1] [2] <3> [4] [5]
+ @Test
public void testLayout14KeyFix5M0() {
MoreKeysKeyboardParams params = createParams(14, 5, XPOS_M0);
assertEquals("14 key fix 5 M0 columns", 5, params.mNumColumns);
@@ -2453,6 +2594,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4] [5] [6] [7]
+ @Test
public void testLayout7KeyFix7L0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L0);
assertEquals("7 key fix 7 L0 columns", 7, params.mNumColumns);
@@ -2471,6 +2613,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4] [5] [6] [7]
+ @Test
public void testLayout7KeyFix7L1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L1);
assertEquals("7 key fix 7 L1 columns", 7, params.mNumColumns);
@@ -2489,6 +2632,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ [1] <2> [3] [4] [5] [6] [7]
+ @Test
public void testLayout7KeyFix7L2() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L2);
assertEquals("7 key fix 7 L2 columns", 7, params.mNumColumns);
@@ -2507,6 +2651,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ [1] [2] <3> [4] [5] [6] [7]
+ @Test
public void testLayout7KeyFix7L3() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L3);
assertEquals("7 key fix 7 L3 columns", 7, params.mNumColumns);
@@ -2525,6 +2670,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ [1] [2] [3] <4> [5] [6] [7] ___ ___|
+ @Test
public void testLayout7KeyFix7M0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_M0);
assertEquals("7 key fix 7 M0 columns", 7, params.mNumColumns);
@@ -2543,6 +2689,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// |___ ___ [1] [2] [3] <4> [5] [6] [7] ___|
+ @Test
public void testLayout7KeyFix7M1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_M1);
assertEquals("7 key fix 7 M1 columns", 7, params.mNumColumns);
@@ -2561,6 +2708,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] [4] <5> [6] [7] ___|
+ @Test
public void testLayout7KeyFix7R3() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R3);
assertEquals("7 key fix 7 R3 columns", 7, params.mNumColumns);
@@ -2579,6 +2727,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] [4] [5] <6> [7] ___|
+ @Test
public void testLayout7KeyFix7R2() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R2);
assertEquals("7 key fix 7 R2 columns", 7, params.mNumColumns);
@@ -2597,6 +2746,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] [4] [5] [6] <7> ___|
+ @Test
public void testLayout7KeyFix7R1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R1);
assertEquals("7 key fix 7 R1 columns", 7, params.mNumColumns);
@@ -2615,6 +2765,7 @@ public class MoreKeysKeyboardBuilderFixedOrderTests extends AndroidTestCase {
}
// [1] [2] [3] [4] [5] [6] <7>|
+ @Test
public void testLayout7KeyFix7R0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R0);
assertEquals("7 key fix 7 R0 columns", 7, params.mNumColumns);
diff --git a/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderMaxOrderTests.java b/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderMaxOrderTests.java
index 806790eff..0a2076dde 100644
--- a/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderMaxOrderTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/MoreKeysKeyboardBuilderMaxOrderTests.java
@@ -16,13 +16,21 @@
package com.android.inputmethod.keyboard;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import android.support.test.filters.MediumTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.keyboard.MoreKeysKeyboard.MoreKeysKeyboardParams;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@MediumTest
-public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class MoreKeysKeyboardBuilderMaxOrderTests {
private static final int WIDTH = 10;
private static final int HEIGHT = 10;
@@ -38,11 +46,6 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
private static final int XPOS_R1 = WIDTH * 8 + WIDTH / 2;
private static final int XPOS_R0 = WIDTH * 9 + WIDTH / 2;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
private static MoreKeysKeyboardParams createParams(final int numKeys, final int maxColumns,
final int coordXInParent) {
final MoreKeysKeyboardParams params = new MoreKeysKeyboardParams();
@@ -52,6 +55,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
return params;
}
+ @Test
public void testLayoutError() {
MoreKeysKeyboardParams params = null;
try {
@@ -69,6 +73,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// "<1>" is the default key.
// <1>
+ @Test
public void testLayout1KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_M0);
assertEquals("1 key max 5 M0 columns", 1, params.mNumColumns);
@@ -81,6 +86,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |<1>
+ @Test
public void testLayout1KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L0);
assertEquals("1 key max 5 L0 columns", 1, params.mNumColumns);
@@ -93,6 +99,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ <1>
+ @Test
public void testLayout1KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L1);
assertEquals("1 key max 5 L1 columns", 1, params.mNumColumns);
@@ -105,6 +112,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ ___ <1>
+ @Test
public void testLayout1KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_L2);
assertEquals("1 key max 5 L2 columns", 1, params.mNumColumns);
@@ -117,6 +125,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// <1>|
+ @Test
public void testLayout1KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R0);
assertEquals("1 key max 5 R0 columns", 1, params.mNumColumns);
@@ -129,6 +138,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// <1> ___|
+ @Test
public void testLayout1KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R1);
assertEquals("1 key max 5 R1 columns", 1, params.mNumColumns);
@@ -141,6 +151,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// <1> ___ ___|
+ @Test
public void testLayout1KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(1, 5, XPOS_R2);
assertEquals("1 key max 5 R2 columns", 1, params.mNumColumns);
@@ -153,6 +164,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// <1> [2]
+ @Test
public void testLayout2KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_M0);
assertEquals("2 key max 5 M0 columns", 2, params.mNumColumns);
@@ -166,6 +178,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |<1> [2]
+ @Test
public void testLayout2KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L0);
assertEquals("2 key max 5 L0 columns", 2, params.mNumColumns);
@@ -179,6 +192,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ <1> [2]
+ @Test
public void testLayout2KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L1);
assertEquals("2 key max 5 L1 columns", 2, params.mNumColumns);
@@ -192,6 +206,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ ___ <1> [2]
+ @Test
public void testLayout2KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_L2);
assertEquals("2 key max 5 L2 columns", 2, params.mNumColumns);
@@ -205,6 +220,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [2] <1>|
+ @Test
public void testLayout2KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R0);
assertEquals("2 key max 5 R0 columns", 2, params.mNumColumns);
@@ -218,6 +234,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [2] <1> ___|
+ @Test
public void testLayout2KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R1);
assertEquals("2 key max 5 R1 columns", 2, params.mNumColumns);
@@ -231,6 +248,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// <1> [2] ___|
+ @Test
public void testLayout2KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(2, 5, XPOS_R2);
assertEquals("2 key max 5 R2 columns", 2, params.mNumColumns);
@@ -244,6 +262,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [3] <1> [2]
+ @Test
public void testLayout3KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_M0);
assertEquals("3 key max 5 M0 columns", 3, params.mNumColumns);
@@ -258,6 +277,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |<1> [2] [3]
+ @Test
public void testLayout3KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L0);
assertEquals("3 key max 5 L0 columns", 3, params.mNumColumns);
@@ -272,6 +292,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3]
+ @Test
public void testLayout3KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L1);
assertEquals("3 key max 5 L1 columns", 3, params.mNumColumns);
@@ -286,6 +307,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2]
+ @Test
public void testLayout3KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_L2);
assertEquals("3 key max 5 L2 columns", 3, params.mNumColumns);
@@ -300,6 +322,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [3] [2] <1>|
+ @Test
public void testLayout3KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R0);
assertEquals("3 key max 5 R0 columns", 3, params.mNumColumns);
@@ -314,6 +337,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [3] [2] <1> ___|
+ @Test
public void testLayout3KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R1);
assertEquals("3 key max 5 R1 columns", 3, params.mNumColumns);
@@ -328,6 +352,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [3] <1> [2] ___|
+ @Test
public void testLayout3KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(3, 5, XPOS_R2);
assertEquals("3 key max 5 R2 columns", 3, params.mNumColumns);
@@ -343,6 +368,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [3]
// <1> [2]
+ @Test
public void testLayout3KeyMax2M0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_M0);
assertEquals("3 key max 2 M0 columns", 2, params.mNumColumns);
@@ -358,6 +384,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[3]
// |<1> [2]
+ @Test
public void testLayout3KeyMax2L0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L0);
assertEquals("3 key max 2 L0 columns", 2, params.mNumColumns);
@@ -373,6 +400,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [3]
// |___ <1> [2]
+ @Test
public void testLayout3KeyMax2L1() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L1);
assertEquals("3 key max 2 L1 columns", 2, params.mNumColumns);
@@ -388,6 +416,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// | [3]
// |___ ___ <1> [2]
+ @Test
public void testLayout3KeyMax2L2() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_L2);
assertEquals("3 key max 2 L2 columns", 2, params.mNumColumns);
@@ -403,6 +432,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [3]|
// [2] <1>|
+ @Test
public void testLayout3KeyMax2R0() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R0);
assertEquals("3 key max 2 R0 columns", 2, params.mNumColumns);
@@ -418,6 +448,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [3] |
// [2] <1> ___|
+ @Test
public void testLayout3KeyMax2R1() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R1);
assertEquals("3 key max 2 R1 columns", 2, params.mNumColumns);
@@ -433,6 +464,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [3] |
// <1> [2] ___|
+ @Test
public void testLayout3KeyMax2R2() {
MoreKeysKeyboardParams params = createParams(3, 2, XPOS_R2);
assertEquals("3 key max 2 R2 columns", 2, params.mNumColumns);
@@ -448,6 +480,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [3] [4]
// <1> [2]
+ @Test
public void testLayout4KeyMax3M0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_M0);
assertEquals("4 key max 3 M0 columns", 2, params.mNumColumns);
@@ -464,6 +497,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[3] [4]
// |<1> [2]
+ @Test
public void testLayout4KeyMax3L0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L0);
assertEquals("4 key max 3 L0 columns", 2, params.mNumColumns);
@@ -480,6 +514,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [3] [4]
// |___ <1> [2]
+ @Test
public void testLayout4KeyMax3L1() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L1);
assertEquals("4 key max 3 L1 columns", 2, params.mNumColumns);
@@ -496,6 +531,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ ___ [3] [4]
// |___ ___ <1> [2]
+ @Test
public void testLayout4KeyMax3L2() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_L2);
assertEquals("4 key max 3 L2 columns", 2, params.mNumColumns);
@@ -512,6 +548,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [4] [3]|
// [2] <1>|
+ @Test
public void testLayout4KeyMax3R0() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R0);
assertEquals("4 key max 3 R0 columns", 2, params.mNumColumns);
@@ -528,6 +565,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [4] [3] ___|
// [2] <1> ___|
+ @Test
public void testLayout4KeyMax3R1() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R1);
assertEquals("4 key max 3 R1 columns", 2, params.mNumColumns);
@@ -544,6 +582,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [3] [4] ___|
// <1> [2] ___|
+ @Test
public void testLayout4KeyMax3R2() {
MoreKeysKeyboardParams params = createParams(4, 3, XPOS_R2);
assertEquals("4 key max 3 R2 columns", 2, params.mNumColumns);
@@ -559,6 +598,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [3] <1> [2] [4]
+ @Test
public void testLayout4KeyMax4M0() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_M0);
assertEquals("4 key max 4 M0 columns", 4, params.mNumColumns);
@@ -574,6 +614,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4]
+ @Test
public void testLayout4KeyMax4L0() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_L0);
assertEquals("4 key max 4 L0 columns", 4, params.mNumColumns);
@@ -589,6 +630,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout4KeyMax4L1() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_L1);
assertEquals("4 key max 4 L1 columns", 4, params.mNumColumns);
@@ -604,6 +646,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2] [4]
+ @Test
public void testLayout4KeyMax4L2() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_L2);
assertEquals("4 key max 4 L2 columns", 4, params.mNumColumns);
@@ -619,6 +662,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [4] [3] [2] <1>|
+ @Test
public void testLayout4KeyMax4R0() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_R0);
assertEquals("4 key max 4 R0 columns", 4, params.mNumColumns);
@@ -634,6 +678,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [4] [3] [2] <1> ___|
+ @Test
public void testLayout4KeyMax4R1() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_R1);
assertEquals("4 key max 4 R1 columns", 4, params.mNumColumns);
@@ -649,6 +694,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [4] [3] <1> [2] ___|
+ @Test
public void testLayout4KeyMax4R2() {
MoreKeysKeyboardParams params = createParams(4, 4, XPOS_R2);
assertEquals("4 key max 4 R2 columns", 4, params.mNumColumns);
@@ -664,6 +710,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [3] <1> [2] [4]
+ @Test
public void testLayout4KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_M0);
assertEquals("4 key max 5 M0 columns", 4, params.mNumColumns);
@@ -679,6 +726,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4]
+ @Test
public void testLayout4KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L0);
assertEquals("4 key max 5 L0 columns", 4, params.mNumColumns);
@@ -694,6 +742,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout4KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L1);
assertEquals("4 key max 5 L1 columns", 4, params.mNumColumns);
@@ -709,6 +758,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2] [4]
+ @Test
public void testLayout4KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_L2);
assertEquals("4 key max 5 L2 columns", 4, params.mNumColumns);
@@ -724,6 +774,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [4] [3] [2] <1>|
+ @Test
public void testLayout4KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R0);
assertEquals("4 key max 5 R0 columns", 4, params.mNumColumns);
@@ -739,6 +790,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [4] [3] [2] <1> ___|
+ @Test
public void testLayout4KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R1);
assertEquals("4 key max 5 R1 columns", 4, params.mNumColumns);
@@ -754,6 +806,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [4] [3] <1> [2] ___|
+ @Test
public void testLayout4KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(4, 5, XPOS_R2);
assertEquals("4 key max 5 R2 columns", 4, params.mNumColumns);
@@ -770,6 +823,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [4] [5]
// [3] <1> [2]
+ @Test
public void testLayout5KeyMax3M0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_M0);
assertEquals("5 key max 3 M0 columns", 3, params.mNumColumns);
@@ -787,6 +841,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[4] [5]
// |<1> [2] [3]
+ @Test
public void testLayout5KeyMax3L0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L0);
assertEquals("5 key max 3 L0 columns", 3, params.mNumColumns);
@@ -804,6 +859,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [4] [5]
// |___ <1> [2] [3]
+ @Test
public void testLayout5KeyMax3L1() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L1);
assertEquals("5 key max 3 L1 columns", 3, params.mNumColumns);
@@ -821,6 +877,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [4] [5]
// |___ [3] <1> [2]
+ @Test
public void testLayout5KeyMax3L2() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_L2);
assertEquals("5 key max 3 L2 columns", 3, params.mNumColumns);
@@ -838,6 +895,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [5] [4]|
// [3] [2] <1>|
+ @Test
public void testLayout5KeyMax3R0() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R0);
assertEquals("5 key max 3 R0 columns", 3, params.mNumColumns);
@@ -855,6 +913,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [5] [4] ___|
// [3] [2] <1> ___|
+ @Test
public void testLayout5KeyMax3R1() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R1);
assertEquals("5 key max 3 R1 columns", 3, params.mNumColumns);
@@ -872,6 +931,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [4] [5] ___|
// [3] <1> [2] ___|
+ @Test
public void testLayout5KeyMax3R2() {
MoreKeysKeyboardParams params = createParams(5, 3, XPOS_R2);
assertEquals("5 key max 3 R2 columns", 3, params.mNumColumns);
@@ -889,6 +949,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [4] [5]
// [3] <1> [2]
+ @Test
public void testLayout5KeyMax4M0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_M0);
assertEquals("5 key max 4 M0 columns", 3, params.mNumColumns);
@@ -906,6 +967,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[4] [5]
// |<1> [2] [3]
+ @Test
public void testLayout5KeyMax4L0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L0);
assertEquals("5 key max 4 L0 columns", 3, params.mNumColumns);
@@ -923,6 +985,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [4] [5]
// |___ <1> [2] [3]
+ @Test
public void testLayout5KeyMax4L1() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L1);
assertEquals("5 key max 4 L1 columns", 3, params.mNumColumns);
@@ -940,6 +1003,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [4] [5]
// |___ [3] <1> [2]
+ @Test
public void testLayout5KeyMax4L2() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_L2);
assertEquals("5 key max 4 L2 columns", 3, params.mNumColumns);
@@ -957,6 +1021,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [5] [4]|
// [3] [2] <1>|
+ @Test
public void testLayout5KeyMax4R0() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R0);
assertEquals("5 key max 4 R0 columns", 3, params.mNumColumns);
@@ -974,6 +1039,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [5] [4] ___|
// [3] [2] <1> ___|
+ @Test
public void testLayout5KeyMax4R1() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R1);
assertEquals("5 key max 4 R1 columns", 3, params.mNumColumns);
@@ -991,6 +1057,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [4] [5] ___|
// [3] <1> [2] ___|
+ @Test
public void testLayout5KeyMax4R2() {
MoreKeysKeyboardParams params = createParams(5, 4, XPOS_R2);
assertEquals("5 key max 4 R2 columns", 3, params.mNumColumns);
@@ -1007,6 +1074,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout5KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_M0);
assertEquals("5 key max 5 M0 columns", 5, params.mNumColumns);
@@ -1023,6 +1091,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout5KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L0);
assertEquals("5 key max 5 L0 columns", 5, params.mNumColumns);
@@ -1039,6 +1108,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout5KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L1);
assertEquals("5 key max 5 L1 columns", 5, params.mNumColumns);
@@ -1055,6 +1125,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout5KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_L2);
assertEquals("5 key max 5 L2 columns", 5, params.mNumColumns);
@@ -1071,6 +1142,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout5KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R0);
assertEquals("5 key max 5 R0 columns", 5, params.mNumColumns);
@@ -1087,6 +1159,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout5KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R1);
assertEquals("5 key max 5 R1 columns", 5, params.mNumColumns);
@@ -1103,6 +1176,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout5KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(5, 5, XPOS_R2);
assertEquals("5 key max 5 R2 columns", 5, params.mNumColumns);
@@ -1120,6 +1194,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [6] [4] [5]
// [3] <1> [2]
+ @Test
public void testLayout6KeyMax4M0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_M0);
assertEquals("6 key max 4 M0 columns", 3, params.mNumColumns);
@@ -1138,6 +1213,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[4] [5] [6]
// |<1> [2] [3]
+ @Test
public void testLayout6KeyMax4L0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L0);
assertEquals("6 key max 4 L0 columns", 3, params.mNumColumns);
@@ -1156,6 +1232,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [4] [5] [6]
// |___ <1> [2] [3]
+ @Test
public void testLayout6KeyMax4L1() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L1);
assertEquals("6 key max 4 L1 columns", 3, params.mNumColumns);
@@ -1174,6 +1251,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [6] [4] [5]
// |___ [3] <1> [2]
+ @Test
public void testLayout6KeyMax4L2() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_L2);
assertEquals("6 key max 4 L2 columns", 3, params.mNumColumns);
@@ -1192,6 +1270,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [6] [5] [4]|
// [3] [2] <1>|
+ @Test
public void testLayout6KeyMax4R0() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R0);
assertEquals("6 key max 4 R0 columns", 3, params.mNumColumns);
@@ -1210,6 +1289,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [6] [5] [4] ___|
// [3] [2] <1> ___|
+ @Test
public void testLayout6KeyMax4R1() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R1);
assertEquals("6 key max 4 R1 columns", 3, params.mNumColumns);
@@ -1228,6 +1308,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [6] [4] [5] ___|
// [3] <1> [2] ___|
+ @Test
public void testLayout6KeyMax4R2() {
MoreKeysKeyboardParams params = createParams(6, 4, XPOS_R2);
assertEquals("6 key max 4 R2 columns", 3, params.mNumColumns);
@@ -1246,6 +1327,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [6] [4] [5]
// [3] <1> [2]
+ @Test
public void testLayout6KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_M0);
assertEquals("6 key max 5 M0 columns", 3, params.mNumColumns);
@@ -1264,6 +1346,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[4] [5] [6]
// |<1> [2] [3]
+ @Test
public void testLayout6KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L0);
assertEquals("6 key max 5 L0 columns", 3, params.mNumColumns);
@@ -1282,6 +1365,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [4] [5] [6]
// |___ <1> [2] [3]
+ @Test
public void testLayout6KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L1);
assertEquals("6 key max 5 L1 columns", 3, params.mNumColumns);
@@ -1300,6 +1384,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [6] [4] [5]
// |___ [3] <1> [2]
+ @Test
public void testLayout6KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_L2);
assertEquals("6 key max 5 L2 columns", 3, params.mNumColumns);
@@ -1318,6 +1403,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [6] [5] [4]|
// [3] [2] <1>|
+ @Test
public void testLayout6KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R0);
assertEquals("6 key max 5 R0 columns", 3, params.mNumColumns);
@@ -1336,6 +1422,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [6] [5] [4] ___|
// [3] [2] <1> ___|
+ @Test
public void testLayout6KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R1);
assertEquals("6 key max 5 R1 columns", 3, params.mNumColumns);
@@ -1354,6 +1441,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [6] [4] [5] ___|
// [3] <1> [2] ___|
+ @Test
public void testLayout6KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(6, 5, XPOS_R2);
assertEquals("6 key max 5 R2 columns", 3, params.mNumColumns);
@@ -1371,6 +1459,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |<1> [2] [3] [4] [5] [6] [7] ___ ___ ___|
+ @Test
public void testLayout7KeyMax7L0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L0);
assertEquals("7 key max 7 L0 columns", 7, params.mNumColumns);
@@ -1389,6 +1478,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ <1> [2] [3] [4] [5] [6] [7] ___ ___|
+ @Test
public void testLayout7KeyMax7L1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L1);
assertEquals("7 key max 7 L1 columns", 7, params.mNumColumns);
@@ -1407,6 +1497,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ [3] <1> [2] [4] [5] [6] [7] ___ ___|
+ @Test
public void testLayout7KeyMax7L2() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L2);
assertEquals("7 key max 7 L2 columns", 7, params.mNumColumns);
@@ -1425,6 +1516,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ [5] [3] <1> [2] [4] [6] [7] ___ ___|
+ @Test
public void testLayout7KeyMax7L3() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_L3);
assertEquals("7 key max 7 L3 columns", 7, params.mNumColumns);
@@ -1443,6 +1535,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ [7] [5] [3] <1> [2] [4] [6] ___ ___|
+ @Test
public void testLayout7KeyMax7M0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_M0);
assertEquals("7 key max 7 M0 columns", 7, params.mNumColumns);
@@ -1461,6 +1554,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [5] [3] <1> [2] [4] [6] ___|
+ @Test
public void testLayout7KeyMax7M1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_M1);
assertEquals("7 key max 7 M1 columns", 7, params.mNumColumns);
@@ -1479,6 +1573,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [6] [5] [3] <1> [2] [4] ___|
+ @Test
public void testLayout7KeyMax7R3() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R3);
assertEquals("7 key max 7 R3 columns", 7, params.mNumColumns);
@@ -1497,6 +1592,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [6] [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout7KeyMax7R2() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R2);
assertEquals("7 key max 7 R2 columns", 7, params.mNumColumns);
@@ -1515,6 +1611,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [6] [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout7KeyMax7R1() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R1);
assertEquals("7 key max 7 R1 columns", 7, params.mNumColumns);
@@ -1533,6 +1630,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
}
// |___ ___ [7] [6] [5] [4] [3] [2] <1>|
+ @Test
public void testLayout7KeyMax7R0() {
MoreKeysKeyboardParams params = createParams(7, 7, XPOS_R0);
assertEquals("7 key max 7 R0 columns", 7, params.mNumColumns);
@@ -1552,6 +1650,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [5] [6] [7]
// [3] <1> [2] [4]
+ @Test
public void testLayout7KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_M0);
assertEquals("7 key max 5 M0 columns", 4, params.mNumColumns);
@@ -1571,6 +1670,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[5] [6] [7]
// |<1> [2] [3] [4]
+ @Test
public void testLayout7KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L0);
assertEquals("7 key max 5 L0 columns", 4, params.mNumColumns);
@@ -1590,6 +1690,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [5] [6] [7]
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout7KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L1);
assertEquals("7 key max 5 L1 columns", 4, params.mNumColumns);
@@ -1609,6 +1710,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [5] [6] [7]
// |___ [3] <1> [2] [4]
+ @Test
public void testLayout7KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_L2);
assertEquals("7 key max 5 L2 columns", 4, params.mNumColumns);
@@ -1628,6 +1730,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [7] [6] [5]|
// [4] [3] [2] <1>|
+ @Test
public void testLayout7KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R0);
assertEquals("7 key max 5 R0 columns", 4, params.mNumColumns);
@@ -1647,6 +1750,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [7] [6] [5] ___|
// [4] [3] [2] <1> ___|
+ @Test
public void testLayout7KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R1);
assertEquals("7 key max 5 R1 columns", 4, params.mNumColumns);
@@ -1666,6 +1770,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [7] [5] [6] ___|
// [4] [3] <1> [2] ___|
+ @Test
public void testLayout7KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(7, 5, XPOS_R2);
assertEquals("7 key max 5 R2 columns", 4, params.mNumColumns);
@@ -1686,6 +1791,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [7]
// [6] [4] [5]
// [3] <1> [2]
+ @Test
public void testLayout7KeyMax3M0() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_M0);
assertEquals("7 key max 3 M0 columns", 3, params.mNumColumns);
@@ -1706,6 +1812,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[7]
// |[4] [5] [6]
// |<1> [2] [3]
+ @Test
public void testLayout7KeyMax3L0() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_L0);
assertEquals("7 key max 3 L0 columns", 3, params.mNumColumns);
@@ -1726,6 +1833,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [7]
// |___ [4] [5] [6]
// |___ <1> [2] [3]
+ @Test
public void testLayout7KeyMax3L1() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_L1);
assertEquals("7 key max 3 L1 columns", 3, params.mNumColumns);
@@ -1746,6 +1854,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [7]
// |___ [6] [4] [5]
// |___ [3] <1> [2]
+ @Test
public void testLayout7KeyMax3L2() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_L2);
assertEquals("7 key max 3 L2 columns", 3, params.mNumColumns);
@@ -1766,6 +1875,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [7]|
// [6] [5] [4]|
// [3] [2] <1>|
+ @Test
public void testLayout7KeyMax3R0() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_R0);
assertEquals("7 key max 3 R0 columns", 3, params.mNumColumns);
@@ -1786,6 +1896,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [7] ___|
// [6] [5] [4] ___|
// [3] [2] <1> ___|
+ @Test
public void testLayout7KeyMax3R1() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_R1);
assertEquals("7 key max 3 R1 columns", 3, params.mNumColumns);
@@ -1806,6 +1917,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [7] ___|
// [6] [4] [5] ___|
// [3] <1> [2] ___|
+ @Test
public void testLayout7KeyMax3R2() {
MoreKeysKeyboardParams params = createParams(7, 3, XPOS_R2);
assertEquals("7 key max 3 R2 columns", 3, params.mNumColumns);
@@ -1825,6 +1937,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [7] [5] [6] [8]
// [3] <1> [2] [4]
+ @Test
public void testLayout8KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_M0);
assertEquals("8 key max 5 M0 columns", 4, params.mNumColumns);
@@ -1845,6 +1958,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[5] [6] [7] [8]
// |<1> [2] [3] [4]
+ @Test
public void testLayout8KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L0);
assertEquals("8 key max 5 L0 columns", 4, params.mNumColumns);
@@ -1865,6 +1979,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [5] [6] [7] [8]
// |___ <1> [2] [3] [4]
+ @Test
public void testLayout8KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L1);
assertEquals("8 key max 5 L1 columns", 4, params.mNumColumns);
@@ -1885,6 +2000,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [7] [5] [6] [8]
// |___ [3] <1> [2] [4]
+ @Test
public void testLayout8KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_L2);
assertEquals("8 key max 5 L2 columns", 4, params.mNumColumns);
@@ -1905,6 +2021,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [8] [7] [6] [5]|
// [4] [3] [2] <1>|
+ @Test
public void testLayout8KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R0);
assertEquals("8 key max 5 R0 columns", 4, params.mNumColumns);
@@ -1925,6 +2042,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [8] [7] [6] [5] ___|
// [4] [3] [2] <1> ___|
+ @Test
public void testLayout8KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R1);
assertEquals("8 key max 5 R1 columns", 4, params.mNumColumns);
@@ -1945,6 +2063,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [8] [7] [5] [6] ___|
// [4] [3] <1> [2] ___|
+ @Test
public void testLayout8KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(8, 5, XPOS_R2);
assertEquals("8 key max 5 R2 columns", 4, params.mNumColumns);
@@ -1965,6 +2084,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout9KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_M0);
assertEquals("9 key max 5 M0 columns", 5, params.mNumColumns);
@@ -1986,6 +2106,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[6] [7] [8] [9]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout9KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L0);
assertEquals("9 key max 5 L0 columns", 5, params.mNumColumns);
@@ -2007,6 +2128,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout9KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L1);
assertEquals("9 key max 5 L1 columns", 5, params.mNumColumns);
@@ -2028,6 +2150,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9]
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout9KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_L2);
assertEquals("9 key max 5 L2 columns", 5, params.mNumColumns);
@@ -2049,6 +2172,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [9] [8] [7] [6]|
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout9KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R0);
assertEquals("9 key max 5 R0 columns", 5, params.mNumColumns);
@@ -2070,6 +2194,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [9] [8] [7] [6] ___|
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout9KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R1);
assertEquals("9 key max 5 R1 columns", 5, params.mNumColumns);
@@ -2091,6 +2216,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [9] [8] [6] [7] ___|
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout9KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(9, 5, XPOS_R2);
assertEquals("9 key max 5 R2 columns", 5, params.mNumColumns);
@@ -2112,6 +2238,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [A] [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout10KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_M0);
assertEquals("10 key max 5 M0 columns", 5, params.mNumColumns);
@@ -2134,6 +2261,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |[6] [7] [8] [9] [A]
// |<1> [2] [3] [4] [5]
+ @Test
public void testLayout10KeyMax5L0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L0);
assertEquals("10 key max 5 L0 columns", 5, params.mNumColumns);
@@ -2156,6 +2284,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [6] [7] [8] [9] [A]
// |___ <1> [2] [3] [4] [5]
+ @Test
public void testLayout10KeyMax5L1() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L1);
assertEquals("10 key max 5 L1 columns", 5, params.mNumColumns);
@@ -2178,6 +2307,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// |___ [8] [6] [7] [9] [A]
// |___ [3] <1> [2] [4] [5]
+ @Test
public void testLayout10KeyMax5L2() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_L2);
assertEquals("10 key max 5 L2 columns", 5, params.mNumColumns);
@@ -2200,6 +2330,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [A] [9] [8] [7] [6]|
// [5] [4] [3] [2] <1>|
+ @Test
public void testLayout10KeyMax5R0() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R0);
assertEquals("10 key max 5 R0 columns", 5, params.mNumColumns);
@@ -2222,6 +2353,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [A] [9] [8] [7] [6] ___|
// [5] [4] [3] [2] <1> ___|
+ @Test
public void testLayout10KeyMax5R1() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R1);
assertEquals("10 key max 5 R1 columns", 5, params.mNumColumns);
@@ -2244,6 +2376,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [A] [9] [8] [6] [7] ___|
// [5] [4] [3] <1> [2] ___|
+ @Test
public void testLayout10KeyMax5R2() {
MoreKeysKeyboardParams params = createParams(10, 5, XPOS_R2);
assertEquals("10 key max 5 R2 columns", 5, params.mNumColumns);
@@ -2267,6 +2400,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [9] [A] [B]
// [7] [5] [6] [8]
// [3] <1> [2] [4]
+ @Test
public void testLayout11KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(11, 5, XPOS_M0);
assertEquals("11 key max 5 M0 columns", 4, params.mNumColumns);
@@ -2291,6 +2425,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [B] [9] [A] [C]
// [7] [5] [6] [8]
// [3] <1> [2] [4]
+ @Test
public void testLayout12KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(12, 5, XPOS_M0);
assertEquals("12 key max 5 M0 columns", 4, params.mNumColumns);
@@ -2316,6 +2451,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [D] [B] [C]
// [A] [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout13KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(13, 5, XPOS_M0);
assertEquals("13 key max 5 M0 columns", 5, params.mNumColumns);
@@ -2342,6 +2478,7 @@ public class MoreKeysKeyboardBuilderMaxOrderTests extends AndroidTestCase {
// [D] [B] [C] [E]
// [A] [8] [6] [7] [9]
// [5] [3] <1> [2] [4]
+ @Test
public void testLayout14KeyMax5M0() {
MoreKeysKeyboardParams params = createParams(14, 5, XPOS_M0);
assertEquals("13 key max 5 M0 columns", 5, params.mNumColumns);
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/HermiteInterpolatorTests.java b/tests/src/com/android/inputmethod/keyboard/internal/HermiteInterpolatorTests.java
index 3ff5aa485..814ecd485 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/HermiteInterpolatorTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/HermiteInterpolatorTests.java
@@ -16,25 +16,20 @@
package com.android.inputmethod.keyboard.internal;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
-@SmallTest
-public class HermiteInterpolatorTests extends AndroidTestCase {
- private final HermiteInterpolator mInterpolator = new HermiteInterpolator();
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
+import org.junit.Test;
+import org.junit.runner.RunWith;
- private static final float EPSLION = 0.0000005f;
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class HermiteInterpolatorTests {
+ private final HermiteInterpolator mInterpolator = new HermiteInterpolator();
- private static void assertFloatEquals(final String message, float expected, float actual) {
- if (Math.abs(expected - actual) >= EPSLION) {
- fail(String.format("%s expected:<%s> but was:<%s>", message, expected, actual));
- }
- }
+ private static final float EPSILON = 0.0000005f;
// t=0 p0=(0,1)
// t=1 p1=(1,0)
@@ -57,6 +52,7 @@ public class HermiteInterpolatorTests extends AndroidTestCase {
private static final int p2 = 2;
private static final int p3 = 3;
+ @Test
public void testP0P1() {
// [(p0 p1) p2 p3]
mInterpolator.reset(mXCoords, mYCoords, p0, p3 + 1);
@@ -66,33 +62,34 @@ public class HermiteInterpolatorTests extends AndroidTestCase {
assertEquals("p1x", mXCoords[p1], mInterpolator.mP2X);
assertEquals("p1y", mYCoords[p1], mInterpolator.mP2Y);
// XY-slope at p0=3.0 (-0.75/-0.25)
- assertFloatEquals("slope x p0", -0.25f, mInterpolator.mSlope1X);
- assertFloatEquals("slope y p0", -0.75f, mInterpolator.mSlope1Y);
+ assertEquals("slope x p0", -0.25f, mInterpolator.mSlope1X, EPSILON);
+ assertEquals("slope y p0", -0.75f, mInterpolator.mSlope1Y, EPSILON);
// XY-slope at p1=1/3.0 (0.50/1.50)
- assertFloatEquals("slope x p1", 1.50f, mInterpolator.mSlope2X);
- assertFloatEquals("slope y p1", 0.50f, mInterpolator.mSlope2Y);
+ assertEquals("slope x p1", 1.50f, mInterpolator.mSlope2X, EPSILON);
+ assertEquals("slope y p1", 0.50f, mInterpolator.mSlope2Y, EPSILON);
// t=0.0 (p0)
mInterpolator.interpolate(0.0f);
- assertFloatEquals("t=0.0 x", 0.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.0 y", 1.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.0 x", 0.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.0 y", 1.0f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.2
mInterpolator.interpolate(0.2f);
- assertFloatEquals("t=0.2 x", 0.02400f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.2 y", 0.78400f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.2 x", 0.02400f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.2 y", 0.78400f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.5
mInterpolator.interpolate(0.5f);
- assertFloatEquals("t=0.5 x", 0.28125f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.5 y", 0.34375f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.5 x", 0.28125f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.5 y", 0.34375f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.8
mInterpolator.interpolate(0.8f);
- assertFloatEquals("t=0.8 x", 0.69600f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.8 y", 0.01600f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.8 x", 0.69600f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.8 y", 0.01600f, mInterpolator.mInterpolatedY, EPSILON);
// t=1.0 (p1)
mInterpolator.interpolate(1.0f);
- assertFloatEquals("t=1.0 x", 1.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=1.0 y", 0.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=1.0 x", 1.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=1.0 y", 0.0f, mInterpolator.mInterpolatedY, EPSILON);
}
+ @Test
public void testP1P2() {
// [p0 (p1 p2) p3]
mInterpolator.reset(mXCoords, mYCoords, p0, p3 + 1);
@@ -102,33 +99,34 @@ public class HermiteInterpolatorTests extends AndroidTestCase {
assertEquals("p2x", mXCoords[p2], mInterpolator.mP2X);
assertEquals("p2y", mYCoords[p2], mInterpolator.mP2Y);
// XY-slope at p1=1/3.0 (0.50/1.50)
- assertFloatEquals("slope x p1", 1.50f, mInterpolator.mSlope1X);
- assertFloatEquals("slope y p1", 0.50f, mInterpolator.mSlope1Y);
+ assertEquals("slope x p1", 1.50f, mInterpolator.mSlope1X, EPSILON);
+ assertEquals("slope y p1", 0.50f, mInterpolator.mSlope1Y, EPSILON);
// XY-slope at p2=3.0 (1.50/0.50)
- assertFloatEquals("slope x p2", 0.50f, mInterpolator.mSlope2X);
- assertFloatEquals("slope y p2", 1.50f, mInterpolator.mSlope2Y);
+ assertEquals("slope x p2", 0.50f, mInterpolator.mSlope2X, EPSILON);
+ assertEquals("slope y p2", 1.50f, mInterpolator.mSlope2Y, EPSILON);
// t=0.0 (p1)
mInterpolator.interpolate(0.0f);
- assertFloatEquals("t=0.0 x", 1.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.0 y", 0.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.0 x", 1.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.0 y", 0.0f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.2
mInterpolator.interpolate(0.2f);
- assertFloatEquals("t=0.2 x", 1.384f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.2 y", 0.224f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.2 x", 1.384f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.2 y", 0.224f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.5
mInterpolator.interpolate(0.5f);
- assertFloatEquals("t=0.5 x", 2.125f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.5 y", 0.875f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.5 x", 2.125f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.5 y", 0.875f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.8
mInterpolator.interpolate(0.8f);
- assertFloatEquals("t=0.8 x", 2.776f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.8 y", 1.616f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.8 x", 2.776f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.8 y", 1.616f, mInterpolator.mInterpolatedY, EPSILON);
// t=1.0 (p2)
mInterpolator.interpolate(1.0f);
- assertFloatEquals("t=1.0 x", 3.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=1.0 y", 2.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=1.0 x", 3.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=1.0 y", 2.0f, mInterpolator.mInterpolatedY, EPSILON);
}
+ @Test
public void testP2P3() {
// [p0 p1 (p2 p3)]
mInterpolator.reset(mXCoords, mYCoords, p0, p3 + 1);
@@ -138,33 +136,34 @@ public class HermiteInterpolatorTests extends AndroidTestCase {
assertEquals("p3x", mXCoords[p3], mInterpolator.mP2X);
assertEquals("p3y", mYCoords[p3], mInterpolator.mP2Y);
// XY-slope at p2=3.0 (1.50/0.50)
- assertFloatEquals("slope x p2", 0.50f, mInterpolator.mSlope1X);
- assertFloatEquals("slope y p2", 1.50f, mInterpolator.mSlope1Y);
+ assertEquals("slope x p2", 0.50f, mInterpolator.mSlope1X, EPSILON);
+ assertEquals("slope y p2", 1.50f, mInterpolator.mSlope1Y, EPSILON);
// XY-slope at p3=1/3.0 (-0.25/-0.75)
- assertFloatEquals("slope x p3", -0.75f, mInterpolator.mSlope2X);
- assertFloatEquals("slope y p3", -0.25f, mInterpolator.mSlope2Y);
+ assertEquals("slope x p3", -0.75f, mInterpolator.mSlope2X, EPSILON);
+ assertEquals("slope y p3", -0.25f, mInterpolator.mSlope2Y, EPSILON);
// t=0.0 (p2)
mInterpolator.interpolate(0.0f);
- assertFloatEquals("t=0.0 x", 3.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.0 y", 2.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.0 x", 3.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.0 y", 2.0f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.2
mInterpolator.interpolate(0.2f);
- assertFloatEquals("t=0.2 x", 2.98400f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.2 y", 2.30400f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.2 x", 2.98400f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.2 y", 2.30400f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.5
mInterpolator.interpolate(0.5f);
- assertFloatEquals("t=0.5 x", 2.65625f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.5 y", 2.71875f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.5 x", 2.65625f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.5 y", 2.71875f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.8
mInterpolator.interpolate(0.8f);
- assertFloatEquals("t=0.8 x", 2.21600f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.8 y", 2.97600f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.8 x", 2.21600f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.8 y", 2.97600f, mInterpolator.mInterpolatedY, EPSILON);
// t=1.0 (p3)
mInterpolator.interpolate(1.0f);
- assertFloatEquals("t=1.0 x", 2.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=1.0 y", 3.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=1.0 x", 2.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=1.0 y", 3.0f, mInterpolator.mInterpolatedY, EPSILON);
}
+ @Test
public void testJustP1P2() {
// [(p1 p2)]
mInterpolator.reset(mXCoords, mYCoords, p1, p2 + 1);
@@ -174,30 +173,30 @@ public class HermiteInterpolatorTests extends AndroidTestCase {
assertEquals("p2x", mXCoords[p2], mInterpolator.mP2X);
assertEquals("p2y", mYCoords[p2], mInterpolator.mP2Y);
// XY-slope at p1=1.0 (2.0/2.0)
- assertFloatEquals("slope x p1", 2.00f, mInterpolator.mSlope1X);
- assertFloatEquals("slope y p1", 2.00f, mInterpolator.mSlope1Y);
+ assertEquals("slope x p1", 2.00f, mInterpolator.mSlope1X, EPSILON);
+ assertEquals("slope y p1", 2.00f, mInterpolator.mSlope1Y, EPSILON);
// XY-slope at p2=1.0 (2.0/2.0)
- assertFloatEquals("slope x p2", 2.00f, mInterpolator.mSlope2X);
- assertFloatEquals("slope y p2", 2.00f, mInterpolator.mSlope2Y);
+ assertEquals("slope x p2", 2.00f, mInterpolator.mSlope2X, EPSILON);
+ assertEquals("slope y p2", 2.00f, mInterpolator.mSlope2Y, EPSILON);
// t=0.0 (p1)
mInterpolator.interpolate(0.0f);
- assertFloatEquals("t=0.0 x", 1.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.0 y", 0.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.0 x", 1.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.0 y", 0.0f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.2
mInterpolator.interpolate(0.2f);
- assertFloatEquals("t=0.2 x", 1.4f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.2 y", 0.4f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.2 x", 1.4f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.2 y", 0.4f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.5
mInterpolator.interpolate(0.5f);
- assertFloatEquals("t=0.5 x", 2.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.5 y", 1.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.5 x", 2.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.5 y", 1.0f, mInterpolator.mInterpolatedY, EPSILON);
// t=0.8
mInterpolator.interpolate(0.8f);
- assertFloatEquals("t=0.8 x", 2.6f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=0.8 y", 1.6f, mInterpolator.mInterpolatedY);
+ assertEquals("t=0.8 x", 2.6f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=0.8 y", 1.6f, mInterpolator.mInterpolatedY, EPSILON);
// t=1.0 (p2)
mInterpolator.interpolate(1.0f);
- assertFloatEquals("t=1.0 x", 3.0f, mInterpolator.mInterpolatedX);
- assertFloatEquals("t=1.0 y", 2.0f, mInterpolator.mInterpolatedY);
+ assertEquals("t=1.0 x", 3.0f, mInterpolator.mInterpolatedX, EPSILON);
+ assertEquals("t=1.0 y", 2.0f, mInterpolator.mInterpolatedY, EPSILON);
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSetTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSetTests.java
index 72211015f..99211922e 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSetTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSetTests.java
@@ -16,9 +16,13 @@
package com.android.inputmethod.keyboard.internal;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
import android.content.Context;
-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 android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
@@ -30,14 +34,22 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public final class KeyboardTextsSetTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public final class KeyboardTextsSetTests {
// All input method subtypes of LatinIME.
private List<InputMethodSubtype> mAllSubtypesList;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ private Context getContext() {
+ return InstrumentationRegistry.getTargetContext();
+ }
+
+ @Before
+ public void setUp() throws Exception {
RichInputMethodManager.init(getContext());
final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
@@ -54,6 +66,7 @@ public final class KeyboardTextsSetTests extends AndroidTestCase {
// Test that the text {@link KeyboardTextsSet#SWITCH_TO_ALPHA_KEY_LABEL} exists for all
// subtypes. The text is needed to implement Emoji Keyboard, see
// {@link KeyboardSwitcher#setEmojiKeyboard()}.
+ @Test
public void testSwitchToAlphaKeyLabel() {
final Context context = getContext();
final KeyboardTextsSet textsSet = new KeyboardTextsSet();
@@ -80,6 +93,7 @@ public final class KeyboardTextsSetTests extends AndroidTestCase {
};
// Test that the text from resources are correctly loaded for all subtypes.
+ @Test
public void testTextFromResources() {
final Context context = getContext();
final KeyboardTextsSet textsSet = new KeyboardTextsSet();
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/MatrixUtilsTests.java b/tests/src/com/android/inputmethod/keyboard/internal/MatrixUtilsTests.java
index e2a11ab99..ba45a1b5a 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/MatrixUtilsTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/MatrixUtilsTests.java
@@ -16,25 +16,26 @@
package com.android.inputmethod.keyboard.internal;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import com.android.inputmethod.keyboard.internal.MatrixUtils.MatrixOperationFailedException;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class MatrixUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class MatrixUtilsTests {
// "run tests" -c com.android.inputmethod.keyboard.internal.MatrixUtilsTests
private static final boolean DEBUG = false;
private static final float EPSILON = 0.00001f;
- private static void assertEqualsFloat(float f0, float f1) {
- assertEqualsFloat(f0, f1, EPSILON);
- }
-
- /* package */ static void assertEqualsFloat(float f0, float f1, float error) {
- assertTrue(Math.abs(f0 - f1) < error);
- }
-
+ @Test
public void testMulti() {
final float[][] matrixA = {{1, 2}, {3, 4}};
final float[][] matrixB = {{5, 6}, {7, 8}};
@@ -47,12 +48,13 @@ public class MatrixUtilsTests extends AndroidTestCase {
if (DEBUG) {
MatrixUtils.dump("multi", retval);
}
- assertEqualsFloat(retval[0][0], 19);
- assertEqualsFloat(retval[0][1], 22);
- assertEqualsFloat(retval[1][0], 43);
- assertEqualsFloat(retval[1][1], 50);
+ assertEquals(retval[0][0], 19, EPSILON);
+ assertEquals(retval[0][1], 22, EPSILON);
+ assertEquals(retval[1][0], 43, EPSILON);
+ assertEquals(retval[1][1], 50, EPSILON);
}
+ @Test
public void testInverse() {
final int N = 4;
final float[][] matrix =
@@ -77,7 +79,7 @@ public class MatrixUtilsTests extends AndroidTestCase {
}
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
- assertEqualsFloat(((i == j) ? 1.0f : 0.0f), retval[i][j]);
+ assertEquals(((i == j) ? 1.0f : 0.0f), retval[i][j], EPSILON);
}
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecSplitTests.java b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecSplitTests.java
index 8f4648c52..4cab29a1c 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecSplitTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecSplitTests.java
@@ -16,26 +16,33 @@
package com.android.inputmethod.keyboard.internal;
+import static org.junit.Assert.assertEquals;
+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.R;
import java.util.Arrays;
import java.util.Locale;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class MoreKeySpecSplitTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class MoreKeySpecSplitTests {
private static final Locale TEST_LOCALE = Locale.ENGLISH;
private final KeyboardTextsSet mTextsSet = new KeyboardTextsSet();
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- final Context targetContext = getContext();
+ @Before
+ public void setUp() throws Exception {
+ final Context targetContext = InstrumentationRegistry.getTargetContext();
final Resources targetRes = targetContext.getResources();
final String targetPackageName = targetRes.getResourcePackageName(
R.string.english_ime_name);
@@ -90,6 +97,7 @@ public class MoreKeySpecSplitTests extends AndroidTestCase {
private static final String SURROGATE1 = PAIR1 + PAIR2;
private static final String SURROGATE2 = PAIR1 + PAIR2 + PAIR3;
+ @Test
public void testSplitZero() {
assertTextArray("Empty string", "");
assertTextArray("Empty entry", ",");
@@ -99,6 +107,7 @@ public class MoreKeySpecSplitTests extends AndroidTestCase {
assertTextArray("Empty entries with escape", ",a,b\\,c,,d,", "a", "b\\,c", "d");
}
+ @Test
public void testSplitSingle() {
assertTextArray("Single char", "a", "a");
assertTextArray("Surrogate pair", PAIR1, PAIR1);
@@ -128,6 +137,7 @@ public class MoreKeySpecSplitTests extends AndroidTestCase {
assertTextArray("Incomplete resource reference 4", "!" + SURROGATE2, "!" + SURROGATE2);
}
+ @Test
public void testSplitSingleEscaped() {
assertTextArray("Escaped char", "\\a", "\\a");
assertTextArray("Escaped surrogate pair", "\\" + PAIR1, "\\" + PAIR1);
@@ -163,6 +173,7 @@ public class MoreKeySpecSplitTests extends AndroidTestCase {
assertTextArray("Escaped !TEXT/NAME", "\\!TEXT/EMPTY_STRING", "\\!TEXT/EMPTY_STRING");
}
+ @Test
public void testSplitMulti() {
assertTextArray("Multiple chars", "a,b,c", "a", "b", "c");
assertTextArray("Multiple chars", "a,b,\\c", "a", "b", "\\c");
@@ -178,6 +189,7 @@ public class MoreKeySpecSplitTests extends AndroidTestCase {
" abc ", " def ", " ghi ");
}
+ @Test
public void testSplitMultiEscaped() {
assertTextArray("Multiple chars with comma", "a,\\,,c", "a", "\\,", "c");
assertTextArray("Multiple chars with comma surrounded by spaces", " a , \\, , c ",
@@ -197,16 +209,19 @@ public class MoreKeySpecSplitTests extends AndroidTestCase {
"\\!", "\\!TEXT/EMPTY_STRING");
}
+ @Test
public void testSplitTextReferenceError() {
assertError("Incomplete text name", "!text/", "!text/");
assertError("Non existing text", "!text/non_existing");
}
+ @Test
public void testSplitEmptyTextReference() {
// Note that morekeys_q of English locale is empty.
assertTextArray("Empty string", "!text/morekeys_q");
}
+ @Test
public void testLabelReferece() {
assertTextArray("Label time am", "!text/keylabel_time_am", "AM");
@@ -217,6 +232,7 @@ public class MoreKeySpecSplitTests extends AndroidTestCase {
"!icon/settings_key|!code/key_settings");
}
+ @Test
public void testUselessUpperCaseSpecifier() {
assertTextArray("EMPTY STRING",
"!TEXT/EMPTY_STRING", "!TEXT/EMPTY_STRING");
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecStringReferenceTests.java b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecStringReferenceTests.java
index e06ecaedf..0ffc96a34 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecStringReferenceTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecStringReferenceTests.java
@@ -16,26 +16,33 @@
package com.android.inputmethod.keyboard.internal;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import android.app.Instrumentation;
import android.content.Context;
import android.content.res.Resources;
-import android.test.InstrumentationTestCase;
-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.tests.R;
import java.util.Locale;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
+@RunWith(AndroidJUnit4.class)
+public class MoreKeySpecStringReferenceTests {
private static final Locale TEST_LOCALE = Locale.ENGLISH;
private final KeyboardTextsSet mTextsSet = new KeyboardTextsSet();
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- final Instrumentation instrumentation = getInstrumentation();
+ @Before
+ public void setUp() throws Exception {
+ final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
final Context testContext = instrumentation.getContext();
final Resources testRes = testContext.getResources();
final String testPackageName = testRes.getResourcePackageName(R.string.empty_string);
@@ -59,16 +66,19 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
}
}
+ @Test
public void testResolveNullText() {
assertEquals("resolve null",
mTextsSet.resolveTextReference(null), null);
}
+ @Test
public void testResolveEmptyText() {
assertEquals("resolve empty text",
mTextsSet.resolveTextReference("!string/empty_string"), null);
}
+ @Test
public void testSplitSingleEscaped() {
assertTextArray("Escaped !string", "\\!string",
"\\!string");
@@ -82,6 +92,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"\\!STRING/EMPTY_STRING");
}
+ @Test
public void testSplitMultiEscaped() {
assertTextArray("Multiple escaped !string", "\\!,\\!string/empty_string",
"\\!", "\\!string/empty_string");
@@ -89,15 +100,18 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"\\!", "\\!STRING/EMPTY_STRING");
}
+ @Test
public void testSplitStringReferenceError() {
assertError("Incomplete resource name", "!string/", "!string/");
assertError("Non existing resource", "!string/non_existing");
}
+ @Test
public void testSplitEmptyStringReference() {
assertTextArray("Empty string", "!string/empty_string");
}
+ @Test
public void testSplitResourceSingle() {
assertTextArray("Single char", "!string/single_char",
"a");
@@ -119,6 +133,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"\\\\a");
}
+ @Test
public void testSplitResourceSingleEscaped() {
assertTextArray("Escaped char",
"!string/escaped_char", "\\a");
@@ -146,6 +161,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"!string/escaped_label_with_escape", "a\\\\c");
}
+ @Test
public void testSplitResourceMulti() {
assertTextArray("Multiple chars",
"!string/multiple_chars", "a", "b", "c");
@@ -158,6 +174,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"!string/multiple_labels_surrounded_by_spaces", " abc ", " def ", " ghi ");
}
+ @Test
public void testSplitResourcetMultiEscaped() {
assertTextArray("Multiple chars with comma",
"!string/multiple_chars_with_comma",
@@ -179,6 +196,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
" ab\\\\ ", " d\\\\\\, ", " g\\,i ");
}
+ @Test
public void testSplitMultipleResources() {
assertTextArray("Literals and resources",
"1,!string/multiple_chars,z",
@@ -203,6 +221,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"abcabc", "def", "ghi");
}
+ @Test
public void testSplitIndirectReference() {
assertTextArray("Indirect",
"!string/indirect_string", "a", "b", "c");
@@ -212,11 +231,13 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"!string/indirect2_string", "a", "b", "c");
}
+ @Test
public void testSplitInfiniteIndirectReference() {
assertError("Infinite indirection",
"1,!string/infinite_indirection,2", "1", "infinite", "<infinite>", "loop", "2");
}
+ @Test
public void testLabelReferece() {
assertTextArray("Indirect naviagte actions as more key",
"!string/keyspec_indirect_navigate_actions",
@@ -225,6 +246,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"!hasLabels!", "ActionNext|!code/key_action_next");
}
+ @Test
public void testUselessUpperCaseSpecifier() {
assertTextArray("EMPTY STRING",
"!STRING/EMPTY_STRING", "!STRING/EMPTY_STRING");
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueueTests.java b/tests/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueueTests.java
index 7908b260e..f4885fff2 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueueTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/PointerTrackerQueueTests.java
@@ -16,11 +16,19 @@
package com.android.inputmethod.keyboard.internal;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
@SmallTest
-public class PointerTrackerQueueTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class PointerTrackerQueueTests {
public static class Element implements PointerTrackerQueue.Element {
public static int sPhantomUpCount;
public static final long NOT_HAPPENED = -1;
@@ -65,11 +73,13 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
private final Element mElement4 = new Element(4);
private final PointerTrackerQueue mQueue = new PointerTrackerQueue();
+ @Test
public void testEmpty() {
assertEquals(0, mQueue.size());
assertEquals("[]", mQueue.toString());
}
+ @Test
public void testAdd() {
mQueue.add(mElement1);
assertEquals(1, mQueue.size());
@@ -85,6 +95,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals("[1 2 3 4]", mQueue.toString());
}
+ @Test
public void testRemove() {
Element.sPhantomUpCount = 0;
@@ -119,6 +130,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
+ @Test
public void testAddAndRemove() {
Element.sPhantomUpCount = 0;
@@ -158,6 +170,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
+ @Test
public void testReleaseAllPointers() {
mElement2.mIsModifier = true;
mQueue.add(mElement1);
@@ -177,6 +190,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(eventTime + 4, mElement4.mPhantomUpEventTime);
}
+ @Test
public void testReleaseAllPointersOlderThanFirst() {
mElement2.mIsModifier = true;
mQueue.add(mElement1);
@@ -194,6 +208,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(Element.NOT_HAPPENED, mElement3.mPhantomUpEventTime);
}
+ @Test
public void testReleaseAllPointersOlderThanLast() {
mElement2.mIsModifier = true;
mQueue.add(mElement1);
@@ -213,6 +228,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
+ @Test
public void testReleaseAllPointersOlderThanWithoutModifierMiddle() {
mQueue.add(mElement1);
mQueue.add(mElement2);
@@ -231,6 +247,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
+ @Test
public void testReleaseAllPointersOlderThanWithoutModifierLast() {
mQueue.add(mElement1);
mQueue.add(mElement2);
@@ -249,6 +266,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
+ @Test
public void testReleaseAllPointersExcept() {
mElement2.mIsModifier = true;
mQueue.add(mElement1);
@@ -268,6 +286,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(eventTime + 3, mElement4.mPhantomUpEventTime);
}
+ @Test
public void testHasModifierKeyOlderThan() {
Element.sPhantomUpCount = 0;
assertFalse("hasModifierKeyOlderThan empty", mQueue.hasModifierKeyOlderThan(mElement1));
@@ -297,6 +316,7 @@ public class PointerTrackerQueueTests extends AndroidTestCase {
assertEquals(Element.NOT_HAPPENED, mElement4.mPhantomUpEventTime);
}
+ @Test
public void testIsAnyInDraggingFinger() {
Element.sPhantomUpCount = 0;
assertFalse(mQueue.isAnyInDraggingFinger());
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/SmoothingUtilsTests.java b/tests/src/com/android/inputmethod/keyboard/internal/SmoothingUtilsTests.java
index 293741af2..6bf98d490 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/SmoothingUtilsTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/SmoothingUtilsTests.java
@@ -16,16 +16,24 @@
package com.android.inputmethod.keyboard.internal;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import com.android.inputmethod.keyboard.internal.MatrixUtils.MatrixOperationFailedException;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
@SmallTest
-public class SmoothingUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class SmoothingUtilsTests {
// "run tests" -c com.android.inputmethod.keyboard.internal.SmoothingUtilsTests
private static final boolean DEBUG = false;
+ @Test
public void testGet3DParamaters() {
final float[] xs = new float[] {0, 1, 2, 3, 4};
final float[] ys = new float[] {1, 4, 15, 40, 85}; // y = x^3 + x^2 + x + 1
@@ -36,7 +44,7 @@ public class SmoothingUtilsTests extends AndroidTestCase {
MatrixUtils.dump("3d", retval);
}
for (int i = 0; i < 4; ++i) {
- MatrixUtilsTests.assertEqualsFloat(retval[i][0], 1.0f, 0.001f);
+ assertEquals(retval[i][0], 1.0f, 0.001f);
}
} catch (MatrixOperationFailedException e) {
assertTrue(false);
diff --git a/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java
index e96c934cb..29542730c 100644
--- a/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java
+++ b/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java
@@ -16,8 +16,14 @@
package com.android.inputmethod.latin;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+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.support.test.InstrumentationRegistry;
+import android.support.test.filters.LargeTest;
+import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.util.Pair;
@@ -38,27 +44,31 @@ import java.util.HashSet;
import java.util.Locale;
import java.util.Random;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@LargeTest
-public class BinaryDictionaryTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class BinaryDictionaryTests {
private static final String TEST_DICT_FILE_EXTENSION = ".testDict";
private static final String TEST_LOCALE = "test";
private static final String DICTIONARY_ID = "TestBinaryDictionary";
private HashSet<File> mDictFilesToBeDeleted = new HashSet<>();
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
mDictFilesToBeDeleted.clear();
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
for (final File dictFile : mDictFilesToBeDeleted) {
dictFile.delete();
}
mDictFilesToBeDeleted.clear();
- super.tearDown();
}
private File createEmptyDictionaryAndGetFile(final int formatVersion) {
@@ -82,7 +92,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
private File createEmptyVer4DictionaryAndGetFile(final int formatVersion,
final HashMap<String, String> attributeMap) throws IOException {
final File file = File.createTempFile(DICTIONARY_ID, TEST_DICT_FILE_EXTENSION,
- getContext().getCacheDir());
+ InstrumentationRegistry.getTargetContext().getCacheDir());
file.delete();
file.mkdir();
if (BinaryDictionaryUtils.createEmptyDictFile(file.getAbsolutePath(), formatVersion,
@@ -106,6 +116,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */);
}
+ @Test
public void testIsValidDictionary() {
final File dictFile = createEmptyDictionaryAndGetFile(FormatSpec.VERSION403);
BinaryDictionary binaryDictionary = getBinaryDictionary(dictFile);
@@ -121,6 +132,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
binaryDictionary.close();
}
+ @Test
public void testConstructingDictionaryOnMemory() {
final File dictFile = createEmptyDictionaryAndGetFile(FormatSpec.VERSION403);
FileUtils.deleteRecursively(dictFile);
@@ -142,6 +154,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
binaryDictionary.close();
}
+ @Test
public void testAddTooLongWord() {
final BinaryDictionary binaryDictionary = getEmptyBinaryDictionary(FormatSpec.VERSION403);
final StringBuffer stringBuilder = new StringBuffer();
@@ -209,6 +222,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
new NgramContext(new WordInfo(word1), new WordInfo(word0)), word2);
}
+ @Test
public void testAddUnigramWord() {
final BinaryDictionary binaryDictionary = getEmptyBinaryDictionary(FormatSpec.VERSION403);
final int probability = 100;
@@ -236,6 +250,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
assertEquals(updatedProbability, binaryDictionary.getFrequency("aaa"));
}
+ @Test
public void testRandomlyAddUnigramWord() {
final int wordCount = 1000;
final int codePointSetSize = 50;
@@ -258,6 +273,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testAddBigramWords() {
final BinaryDictionary binaryDictionary = getEmptyBinaryDictionary(FormatSpec.VERSION403);
@@ -311,6 +327,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
getBigramProbability(binaryDictionary, "abcde", "fghij"));
}
+ @Test
public void testRandomlyAddBigramWords() {
final int wordCount = 100;
final int bigramCount = 1000;
@@ -357,6 +374,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testAddTrigramWords() {
final BinaryDictionary binaryDictionary = getEmptyBinaryDictionary(FormatSpec.VERSION403);
final int unigramProbability = 100;
@@ -383,6 +401,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
getTrigramProbability(binaryDictionary, "bcc", "abb", "aaa"));
}
+ @Test
public void testFlushDictionary() {
final File dictFile = createEmptyDictionaryAndGetFile(FormatSpec.VERSION403);
BinaryDictionary binaryDictionary = getBinaryDictionary(dictFile);
@@ -417,6 +436,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
binaryDictionary.close();
}
+ @Test
public void testFlushWithGCDictionary() {
final File dictFile = createEmptyDictionaryAndGetFile(FormatSpec.VERSION403);
BinaryDictionary binaryDictionary = getBinaryDictionary(dictFile);
@@ -447,6 +467,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
binaryDictionary.close();
}
+ @Test
public void testAddBigramWordsAndFlashWithGC() {
final int wordCount = 100;
final int bigramCount = 1000;
@@ -499,6 +520,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testRandomOperationsAndFlashWithGC() {
final int maxUnigramCount = 5000;
final int maxBigramCount = 10000;
@@ -593,6 +615,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testAddManyUnigramsAndFlushWithGC() {
final int flashWithGCIterationCount = 3;
final int codePointSetSize = 50;
@@ -628,6 +651,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testUnigramAndBigramCount() {
final int maxUnigramCount = 5000;
final int maxBigramCount = 10000;
@@ -684,6 +708,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testGetWordProperties() {
final long seed = System.currentTimeMillis();
final Random random = new Random(seed);
@@ -769,6 +794,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testIterateAllWords() {
final long seed = System.currentTimeMillis();
final Random random = new Random(seed);
@@ -852,6 +878,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
assertTrue(bigramSet.isEmpty());
}
+ @Test
public void testPossiblyOffensiveAttributeMaintained() {
final BinaryDictionary binaryDictionary =
getEmptyBinaryDictionary(FormatSpec.VERSION403);
@@ -860,6 +887,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
assertEquals(true, wordProperty.mIsPossiblyOffensive);
}
+ @Test
public void testBeginningOfSentence() {
final BinaryDictionary binaryDictionary = getEmptyBinaryDictionary(FormatSpec.VERSION403);
final int dummyProbability = 0;
diff --git a/tests/src/com/android/inputmethod/latin/ContactsContentObserverTest.java b/tests/src/com/android/inputmethod/latin/ContactsContentObserverTest.java
index f90a18bf1..be039c481 100644
--- a/tests/src/com/android/inputmethod/latin/ContactsContentObserverTest.java
+++ b/tests/src/com/android/inputmethod/latin/ContactsContentObserverTest.java
@@ -24,11 +24,13 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.provider.ContactsContract.Contacts;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -38,6 +40,7 @@ import java.util.ArrayList;
* Tests for {@link ContactsContentObserver}.
*/
@SmallTest
+@RunWith(AndroidJUnit4.class)
public class ContactsContentObserverTest {
private static final int UPDATED_CONTACT_COUNT = 10;
private static final int STALE_CONTACT_COUNT = 8;
diff --git a/tests/src/com/android/inputmethod/latin/ContactsDictionaryUtilsTest.java b/tests/src/com/android/inputmethod/latin/ContactsDictionaryUtilsTest.java
index 9b49f1abb..57d5def15 100644
--- a/tests/src/com/android/inputmethod/latin/ContactsDictionaryUtilsTest.java
+++ b/tests/src/com/android/inputmethod/latin/ContactsDictionaryUtilsTest.java
@@ -20,9 +20,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Locale;
@@ -30,6 +32,7 @@ import java.util.Locale;
* Tests for {@link ContactsDictionaryUtils}
*/
@SmallTest
+@RunWith(AndroidJUnit4.class)
public class ContactsDictionaryUtilsTest {
@Test
diff --git a/tests/src/com/android/inputmethod/latin/ContactsManagerTest.java b/tests/src/com/android/inputmethod/latin/ContactsManagerTest.java
index f987e0c05..1cc289a27 100644
--- a/tests/src/com/android/inputmethod/latin/ContactsManagerTest.java
+++ b/tests/src/com/android/inputmethod/latin/ContactsManagerTest.java
@@ -16,6 +16,10 @@
package com.android.inputmethod.latin;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
@@ -23,34 +27,38 @@ import android.database.MatrixCursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
-import android.test.AndroidTestCase;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import android.test.RenamingDelegatingContext;
import android.test.mock.MockContentProvider;
import android.test.mock.MockContentResolver;
-import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.latin.ContactsDictionaryConstants;
import com.android.inputmethod.latin.ContactsManager;
-import org.junit.Before;
-import org.junit.Test;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests for {@link ContactsManager}
*/
@SmallTest
-public class ContactsManagerTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class ContactsManagerTest {
private ContactsManager mManager;
private FakeContactsContentProvider mFakeContactsContentProvider;
private MatrixCursor mMatrixCursor;
+ private final static float EPSILON = 0.00001f;
+
@Before
- @Override
public void setUp() throws Exception {
// Fake content provider
mFakeContactsContentProvider = new FakeContactsContentProvider();
@@ -59,7 +67,8 @@ public class ContactsManagerTest extends AndroidTestCase {
final MockContentResolver contentResolver = new MockContentResolver();
contentResolver.addProvider(ContactsContract.AUTHORITY, mFakeContactsContentProvider);
// Add the fake content resolver to a fake context.
- final ContextWithMockContentResolver context = new ContextWithMockContentResolver(mContext);
+ final ContextWithMockContentResolver context =
+ new ContextWithMockContentResolver(InstrumentationRegistry.getTargetContext());
context.setContentResolver(contentResolver);
mManager = new ContactsManager(context);
@@ -113,9 +122,10 @@ public class ContactsManagerTest extends AndroidTestCase {
cursor.moveToFirst();
ContactsManager.RankedContact contact = new ContactsManager.RankedContact(cursor);
contact.computeAffinity(1, month_ago);
- assertEquals(contact.getAffinity(), 1.0f);
+ assertEquals(contact.getAffinity(), 1.0f, EPSILON);
contact.computeAffinity(2, now);
- assertEquals(contact.getAffinity(), (2.0f/3.0f + (float)Math.pow(0.5, 3) + 1.0f) / 3);
+ assertEquals(contact.getAffinity(), (2.0f/3.0f + (float)Math.pow(0.5, 3) + 1.0f) / 3,
+ EPSILON);
}
@Test
diff --git a/tests/src/com/android/inputmethod/latin/DictionaryFacilitatorLruCacheTests.java b/tests/src/com/android/inputmethod/latin/DictionaryFacilitatorLruCacheTests.java
index 6b0bbc279..cdb5b8e72 100644
--- a/tests/src/com/android/inputmethod/latin/DictionaryFacilitatorLruCacheTests.java
+++ b/tests/src/com/android/inputmethod/latin/DictionaryFacilitatorLruCacheTests.java
@@ -16,16 +16,26 @@
package com.android.inputmethod.latin;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.Locale;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.LargeTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
@LargeTest
-public class DictionaryFacilitatorLruCacheTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class DictionaryFacilitatorLruCacheTests {
+
+ @Test
public void testGetFacilitator() {
final DictionaryFacilitatorLruCache cache =
- new DictionaryFacilitatorLruCache(getContext(), "");
+ new DictionaryFacilitatorLruCache(InstrumentationRegistry.getTargetContext(), "");
final DictionaryFacilitator dictionaryFacilitatorEnUs = cache.get(Locale.US);
assertNotNull(dictionaryFacilitatorEnUs);
diff --git a/tests/src/com/android/inputmethod/latin/NgramContextTests.java b/tests/src/com/android/inputmethod/latin/NgramContextTests.java
index 0a662db82..6fa8a5a47 100644
--- a/tests/src/com/android/inputmethod/latin/NgramContextTests.java
+++ b/tests/src/com/android/inputmethod/latin/NgramContextTests.java
@@ -16,15 +16,26 @@
package com.android.inputmethod.latin;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import com.android.inputmethod.latin.NgramContext.WordInfo;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
import com.android.inputmethod.latin.utils.NgramContextUtils;
-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 org.junit.Test;
+import org.junit.runner.RunWith;
@SmallTest
-public class NgramContextTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class NgramContextTests {
+
+ @Test
public void testConstruct() {
assertEquals(new NgramContext(new WordInfo("a")), new NgramContext(new WordInfo("a")));
assertEquals(new NgramContext(WordInfo.BEGINNING_OF_SENTENCE_WORD_INFO),
@@ -35,6 +46,7 @@ public class NgramContextTests extends AndroidTestCase {
new NgramContext(WordInfo.EMPTY_WORD_INFO));
}
+ @Test
public void testIsBeginningOfSentenceContext() {
assertFalse(new NgramContext().isBeginningOfSentenceContext());
assertTrue(new NgramContext(WordInfo.BEGINNING_OF_SENTENCE_WORD_INFO)
@@ -52,6 +64,7 @@ public class NgramContextTests extends AndroidTestCase {
.isBeginningOfSentenceContext());
}
+ @Test
public void testGetNextNgramContext() {
final NgramContext ngramContext_a = new NgramContext(new WordInfo("a"));
final NgramContext ngramContext_b_a =
@@ -67,6 +80,7 @@ public class NgramContextTests extends AndroidTestCase {
assertEquals("c", ngramContext_c_bos.getNthPrevWord(1));
}
+ @Test
public void testExtractPrevWordsContextTest() {
final NgramContext ngramContext_bos =
new NgramContext(WordInfo.BEGINNING_OF_SENTENCE_WORD_INFO);
@@ -92,6 +106,7 @@ public class NgramContextTests extends AndroidTestCase {
assertEquals("a", ngramContext_a_empty.extractPrevWordsContext());
}
+ @Test
public void testExtractPrevWordsContextArray() {
final NgramContext ngramContext_bos =
new NgramContext(WordInfo.BEGINNING_OF_SENTENCE_WORD_INFO);
@@ -123,9 +138,10 @@ public class NgramContextTests extends AndroidTestCase {
assertEquals("a", ngramContext_a_empty.extractPrevWordsContextArray()[0]);
}
+ @Test
public void testGetNgramContextFromNthPreviousWord() {
SpacingAndPunctuations spacingAndPunctuations = new SpacingAndPunctuations(
- mContext.getResources());
+ InstrumentationRegistry.getTargetContext().getResources());
assertEquals("<S>", NgramContextUtils.getNgramContextFromNthPreviousWord("",
spacingAndPunctuations, 1).extractPrevWordsContext());
assertEquals("<S> b", NgramContextUtils.getNgramContextFromNthPreviousWord("a. b ",
diff --git a/tests/src/com/android/inputmethod/latin/PersonalDictionaryLookupTest.java b/tests/src/com/android/inputmethod/latin/PersonalDictionaryLookupTest.java
deleted file mode 100644
index c06adedfd..000000000
--- a/tests/src/com/android/inputmethod/latin/PersonalDictionaryLookupTest.java
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.inputmethod.latin;
-
-import static com.android.inputmethod.latin.PersonalDictionaryLookup.ANY_LOCALE;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-
-import android.annotation.SuppressLint;
-import android.content.ContentResolver;
-import android.database.Cursor;
-import android.net.Uri;
-import android.provider.UserDictionary;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.util.Log;
-
-import com.android.inputmethod.latin.PersonalDictionaryLookup.PersonalDictionaryListener;
-import com.android.inputmethod.latin.utils.ExecutorUtils;
-
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Set;
-
-/**
- * Unit tests for {@link PersonalDictionaryLookup}.
- *
- * Note, this test doesn't mock out the ContentResolver, in order to make sure
- * {@link PersonalDictionaryLookup} works in a real setting.
- */
-@SmallTest
-public class PersonalDictionaryLookupTest extends AndroidTestCase {
- private static final String TAG = PersonalDictionaryLookupTest.class.getSimpleName();
-
- private ContentResolver mContentResolver;
- private HashSet<Uri> mAddedBackup;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mContentResolver = mContext.getContentResolver();
- mAddedBackup = new HashSet<Uri>();
- }
-
- @Override
- protected void tearDown() throws Exception {
- // Remove all entries added during this test.
- for (Uri row : mAddedBackup) {
- mContentResolver.delete(row, null, null);
- }
- mAddedBackup.clear();
-
- super.tearDown();
- }
-
- /**
- * Adds the given word to the personal dictionary.
- *
- * @param word the word to add
- * @param locale the locale of the word to add
- * @param frequency the frequency of the word to add
- * @return the Uri for the given word
- */
- @SuppressLint("NewApi")
- private Uri addWord(final String word, final Locale locale, int frequency, String shortcut) {
- // Add the given word for the given locale.
- UserDictionary.Words.addWord(mContext, word, frequency, shortcut, locale);
- // Obtain an Uri for the given word.
- Cursor cursor = mContentResolver.query(UserDictionary.Words.CONTENT_URI, null,
- UserDictionary.Words.WORD + "='" + word + "'", null, null);
- assertTrue(cursor.moveToFirst());
- Uri uri = Uri.withAppendedPath(UserDictionary.Words.CONTENT_URI,
- cursor.getString(cursor.getColumnIndex(UserDictionary.Words._ID)));
- // Add the row to the backup for later clearing.
- mAddedBackup.add(uri);
- return uri;
- }
-
- /**
- * Deletes the entry for the given word from UserDictionary.
- *
- * @param uri the Uri for the word as returned by addWord
- */
- private void deleteWord(Uri uri) {
- // Remove the word from the backup so that it's not cleared again later.
- mAddedBackup.remove(uri);
- // Remove the word from the personal dictionary.
- mContentResolver.delete(uri, null, null);
- }
-
- private PersonalDictionaryLookup setUpWord(final Locale locale) {
- // Insert "foo" in the personal dictionary for the given locale.
- addWord("foo", locale, 17, null);
-
- // Create the PersonalDictionaryLookup and wait until it's loaded.
- PersonalDictionaryLookup lookup =
- new PersonalDictionaryLookup(mContext, ExecutorUtils.SPELLING);
- lookup.open();
- return lookup;
- }
-
- private PersonalDictionaryLookup setUpShortcut(final Locale locale) {
- // Insert "shortcut" => "Expansion" in the personal dictionary for the given locale.
- addWord("Expansion", locale, 17, "shortcut");
-
- // Create the PersonalDictionaryLookup and wait until it's loaded.
- PersonalDictionaryLookup lookup =
- new PersonalDictionaryLookup(mContext, ExecutorUtils.SPELLING);
- lookup.open();
- return lookup;
- }
-
- private void verifyWordExists(final Set<String> set, final String word) {
- assertTrue(set.contains(word));
- }
-
- private void verifyWordDoesNotExist(final Set<String> set, final String word) {
- assertFalse(set.contains(word));
- }
-
- public void testShortcutKeyMatching() {
- Log.d(TAG, "testShortcutKeyMatching");
- PersonalDictionaryLookup lookup = setUpShortcut(Locale.US);
-
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.US));
- assertNull(lookup.expandShortcut("Shortcut", Locale.US));
- assertNull(lookup.expandShortcut("SHORTCUT", Locale.US));
- assertNull(lookup.expandShortcut("shortcu", Locale.US));
- assertNull(lookup.expandShortcut("shortcutt", Locale.US));
-
- lookup.close();
- }
-
- public void testShortcutMatchesInputCountry() {
- Log.d(TAG, "testShortcutMatchesInputCountry");
- PersonalDictionaryLookup lookup = setUpShortcut(Locale.US);
-
- verifyWordExists(lookup.getShortcutsForLocale(Locale.US), "shortcut");
- assertTrue(lookup.getShortcutsForLocale(Locale.UK).isEmpty());
- assertTrue(lookup.getShortcutsForLocale(Locale.ENGLISH).isEmpty());
- assertTrue(lookup.getShortcutsForLocale(Locale.FRENCH).isEmpty());
- assertTrue(lookup.getShortcutsForLocale(ANY_LOCALE).isEmpty());
-
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.US));
- assertNull(lookup.expandShortcut("shortcut", Locale.UK));
- assertNull(lookup.expandShortcut("shortcut", Locale.ENGLISH));
- assertNull(lookup.expandShortcut("shortcut", Locale.FRENCH));
- assertNull(lookup.expandShortcut("shortcut", ANY_LOCALE));
-
- lookup.close();
- }
-
- public void testShortcutMatchesInputLanguage() {
- Log.d(TAG, "testShortcutMatchesInputLanguage");
- PersonalDictionaryLookup lookup = setUpShortcut(Locale.ENGLISH);
-
- verifyWordExists(lookup.getShortcutsForLocale(Locale.US), "shortcut");
- verifyWordExists(lookup.getShortcutsForLocale(Locale.UK), "shortcut");
- verifyWordExists(lookup.getShortcutsForLocale(Locale.ENGLISH), "shortcut");
- assertTrue(lookup.getShortcutsForLocale(Locale.FRENCH).isEmpty());
- assertTrue(lookup.getShortcutsForLocale(ANY_LOCALE).isEmpty());
-
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.US));
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.UK));
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.ENGLISH));
- assertNull(lookup.expandShortcut("shortcut", Locale.FRENCH));
- assertNull(lookup.expandShortcut("shortcut", ANY_LOCALE));
-
- lookup.close();
- }
-
- public void testShortcutMatchesAnyLocale() {
- PersonalDictionaryLookup lookup = setUpShortcut(PersonalDictionaryLookup.ANY_LOCALE);
-
- verifyWordExists(lookup.getShortcutsForLocale(Locale.US), "shortcut");
- verifyWordExists(lookup.getShortcutsForLocale(Locale.UK), "shortcut");
- verifyWordExists(lookup.getShortcutsForLocale(Locale.ENGLISH), "shortcut");
- verifyWordExists(lookup.getShortcutsForLocale(Locale.FRENCH), "shortcut");
- verifyWordExists(lookup.getShortcutsForLocale(ANY_LOCALE), "shortcut");
-
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.US));
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.UK));
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.ENGLISH));
- assertEquals("Expansion", lookup.expandShortcut("shortcut", Locale.FRENCH));
- assertEquals("Expansion", lookup.expandShortcut("shortcut", ANY_LOCALE));
-
- lookup.close();
- }
-
- public void testExactLocaleMatch() {
- Log.d(TAG, "testExactLocaleMatch");
- PersonalDictionaryLookup lookup = setUpWord(Locale.US);
-
- verifyWordExists(lookup.getWordsForLocale(Locale.US), "foo");
- verifyWordDoesNotExist(lookup.getWordsForLocale(Locale.UK), "foo");
- verifyWordDoesNotExist(lookup.getWordsForLocale(Locale.ENGLISH), "foo");
- verifyWordDoesNotExist(lookup.getWordsForLocale(Locale.FRENCH), "foo");
- verifyWordDoesNotExist(lookup.getWordsForLocale(ANY_LOCALE), "foo");
-
- // Any capitalization variation should match.
- assertTrue(lookup.isValidWord("foo", Locale.US));
- assertTrue(lookup.isValidWord("Foo", Locale.US));
- assertTrue(lookup.isValidWord("FOO", Locale.US));
- // But similar looking words don't match.
- assertFalse(lookup.isValidWord("fo", Locale.US));
- assertFalse(lookup.isValidWord("fop", Locale.US));
- assertFalse(lookup.isValidWord("fooo", Locale.US));
- // Other locales, including more general locales won't match.
- assertFalse(lookup.isValidWord("foo", Locale.ENGLISH));
- assertFalse(lookup.isValidWord("foo", Locale.UK));
- assertFalse(lookup.isValidWord("foo", Locale.FRENCH));
- assertFalse(lookup.isValidWord("foo", ANY_LOCALE));
-
- lookup.close();
- }
-
- public void testSubLocaleMatch() {
- Log.d(TAG, "testSubLocaleMatch");
- PersonalDictionaryLookup lookup = setUpWord(Locale.ENGLISH);
-
- verifyWordExists(lookup.getWordsForLocale(Locale.US), "foo");
- verifyWordExists(lookup.getWordsForLocale(Locale.UK), "foo");
- verifyWordExists(lookup.getWordsForLocale(Locale.ENGLISH), "foo");
- verifyWordDoesNotExist(lookup.getWordsForLocale(Locale.FRENCH), "foo");
- verifyWordDoesNotExist(lookup.getWordsForLocale(ANY_LOCALE), "foo");
-
- // Any capitalization variation should match for both en and en_US.
- assertTrue(lookup.isValidWord("foo", Locale.ENGLISH));
- assertTrue(lookup.isValidWord("foo", Locale.US));
- assertTrue(lookup.isValidWord("Foo", Locale.US));
- assertTrue(lookup.isValidWord("FOO", Locale.US));
- // But similar looking words don't match.
- assertFalse(lookup.isValidWord("fo", Locale.US));
- assertFalse(lookup.isValidWord("fop", Locale.US));
- assertFalse(lookup.isValidWord("fooo", Locale.US));
-
- lookup.close();
- }
-
- public void testAllLocalesMatch() {
- Log.d(TAG, "testAllLocalesMatch");
- PersonalDictionaryLookup lookup = setUpWord(null);
-
- verifyWordExists(lookup.getWordsForLocale(Locale.US), "foo");
- verifyWordExists(lookup.getWordsForLocale(Locale.UK), "foo");
- verifyWordExists(lookup.getWordsForLocale(Locale.ENGLISH), "foo");
- verifyWordExists(lookup.getWordsForLocale(Locale.FRENCH), "foo");
- verifyWordExists(lookup.getWordsForLocale(ANY_LOCALE), "foo");
-
- // Any capitalization variation should match for fr, en and en_US.
- assertTrue(lookup.isValidWord("foo", ANY_LOCALE));
- assertTrue(lookup.isValidWord("foo", Locale.FRENCH));
- assertTrue(lookup.isValidWord("foo", Locale.ENGLISH));
- assertTrue(lookup.isValidWord("foo", Locale.US));
- assertTrue(lookup.isValidWord("Foo", Locale.US));
- assertTrue(lookup.isValidWord("FOO", Locale.US));
- // But similar looking words don't match.
- assertFalse(lookup.isValidWord("fo", Locale.US));
- assertFalse(lookup.isValidWord("fop", Locale.US));
- assertFalse(lookup.isValidWord("fooo", Locale.US));
-
- lookup.close();
- }
-
- public void testMultipleLocalesMatch() {
- Log.d(TAG, "testMultipleLocalesMatch");
-
- // Insert "Foo" as capitalized in the personal dictionary under the en_US and en_CA and fr
- // locales.
- addWord("Foo", Locale.US, 17, null);
- addWord("foO", Locale.CANADA, 17, null);
- addWord("fOo", Locale.FRENCH, 17, null);
-
- // Create the PersonalDictionaryLookup and wait until it's loaded.
- PersonalDictionaryLookup lookup = new PersonalDictionaryLookup(mContext,
- ExecutorUtils.SPELLING);
- lookup.open();
-
- // Both en_CA and en_US match.
- assertTrue(lookup.isValidWord("foo", Locale.CANADA));
- assertTrue(lookup.isValidWord("foo", Locale.US));
- assertTrue(lookup.isValidWord("foo", Locale.FRENCH));
- // Other locales, including more general locales won't match.
- assertFalse(lookup.isValidWord("foo", Locale.ENGLISH));
- assertFalse(lookup.isValidWord("foo", Locale.UK));
- assertFalse(lookup.isValidWord("foo", ANY_LOCALE));
-
- lookup.close();
- }
-
-
- public void testCaseMatchingForWordsAndShortcuts() {
- Log.d(TAG, "testCaseMatchingForWordsAndShortcuts");
- addWord("Foo", Locale.US, 17, "f");
- addWord("bokabu", Locale.US, 17, "Bu");
-
- // Create the PersonalDictionaryLookup and wait until it's loaded.
- PersonalDictionaryLookup lookup = new PersonalDictionaryLookup(mContext,
- ExecutorUtils.SPELLING);
- lookup.open();
-
- // Valid, inspite of capitalization in US but not in other
- // locales.
- assertTrue(lookup.isValidWord("Foo", Locale.US));
- assertTrue(lookup.isValidWord("foo", Locale.US));
- assertFalse(lookup.isValidWord("Foo", Locale.UK));
- assertFalse(lookup.isValidWord("foo", Locale.UK));
-
- // Valid in all forms in US.
- assertTrue(lookup.isValidWord("bokabu", Locale.US));
- assertTrue(lookup.isValidWord("BOKABU", Locale.US));
- assertTrue(lookup.isValidWord("BokaBU", Locale.US));
-
- // Correct capitalization; sensitive to shortcut casing & locale.
- assertEquals("Foo", lookup.expandShortcut("f", Locale.US));
- assertNull(lookup.expandShortcut("f", Locale.UK));
-
- // Correct capitalization; sensitive to shortcut casing & locale.
- assertEquals("bokabu", lookup.expandShortcut("Bu", Locale.US));
- assertNull(lookup.expandShortcut("Bu", Locale.UK));
- assertNull(lookup.expandShortcut("bu", Locale.US));
-
- // Verify that raw strings are retained for #getWordsForLocale.
- verifyWordExists(lookup.getWordsForLocale(Locale.US), "Foo");
- verifyWordDoesNotExist(lookup.getWordsForLocale(Locale.US), "foo");
- }
-
- public void testManageListeners() {
- Log.d(TAG, "testManageListeners");
-
- PersonalDictionaryLookup lookup =
- new PersonalDictionaryLookup(mContext, ExecutorUtils.SPELLING);
-
- PersonalDictionaryListener listener = mock(PersonalDictionaryListener.class);
- // Add the same listener a bunch of times. It doesn't make a difference.
- lookup.addListener(listener);
- lookup.addListener(listener);
- lookup.addListener(listener);
- lookup.notifyListeners();
-
- verify(listener, times(1)).onUpdate();
-
- // Remove the same listener a bunch of times. It doesn't make a difference.
- lookup.removeListener(listener);
- lookup.removeListener(listener);
- lookup.removeListener(listener);
- lookup.notifyListeners();
-
- verifyNoMoreInteractions(listener);
- }
-
- public void testReload() {
- Log.d(TAG, "testReload");
-
- // Insert "foo".
- Uri uri = addWord("foo", Locale.US, 17, null);
-
- // Create the PersonalDictionaryLookup and wait until it's loaded.
- PersonalDictionaryLookup lookup =
- new PersonalDictionaryLookup(mContext, ExecutorUtils.SPELLING);
- lookup.open();
-
- // "foo" should match.
- assertTrue(lookup.isValidWord("foo", Locale.US));
-
- // "bar" shouldn't match.
- assertFalse(lookup.isValidWord("bar", Locale.US));
-
- // Now delete "foo" and add "bar".
- deleteWord(uri);
- addWord("bar", Locale.US, 18, null);
-
- // Wait a little bit before expecting a change. The time we wait should be greater than
- // PersonalDictionaryLookup.RELOAD_DELAY_MS.
- try {
- Thread.sleep(PersonalDictionaryLookup.RELOAD_DELAY_MS + 1000);
- } catch (InterruptedException e) {
- }
-
- // Perform lookups again. Reload should have occured.
- //
- // "foo" should not match.
- assertFalse(lookup.isValidWord("foo", Locale.US));
-
- // "bar" should match.
- assertTrue(lookup.isValidWord("bar", Locale.US));
-
- lookup.close();
- }
-
- public void testDictionaryStats() {
- Log.d(TAG, "testDictionaryStats");
-
- // Insert "foo" and "bar". Only "foo" has a shortcut.
- Uri uri = addWord("foo", Locale.GERMANY, 17, "f");
- addWord("bar", Locale.GERMANY, 17, null);
-
- // Create the PersonalDictionaryLookup and wait until it's loaded.
- PersonalDictionaryLookup lookup =
- new PersonalDictionaryLookup(mContext, ExecutorUtils.SPELLING);
- lookup.open();
-
- // "foo" should match.
- assertTrue(lookup.isValidWord("foo", Locale.GERMANY));
-
- // "bar" should match.
- assertTrue(lookup.isValidWord("bar", Locale.GERMANY));
-
- // "foo" should have a shortcut.
- assertEquals("foo", lookup.expandShortcut("f", Locale.GERMANY));
-
- // Now delete "foo".
- deleteWord(uri);
-
- // Wait a little bit before expecting a change. The time we wait should be greater than
- // PersonalDictionaryLookup.RELOAD_DELAY_MS.
- try {
- Thread.sleep(PersonalDictionaryLookup.RELOAD_DELAY_MS + 1000);
- } catch (InterruptedException e) {
- }
-
- // Perform lookups again. Reload should have occured.
- //
- // "foo" should not match.
- assertFalse(lookup.isValidWord("foo", Locale.GERMANY));
-
- // "foo" should not have a shortcut.
- assertNull(lookup.expandShortcut("f", Locale.GERMANY));
-
- // "bar" should still match.
- assertTrue(lookup.isValidWord("bar", Locale.GERMANY));
-
- lookup.close();
- }
-
- public void testClose() {
- Log.d(TAG, "testClose");
-
- // Insert "foo".
- Uri uri = addWord("foo", Locale.US, 17, null);
-
- // Create the PersonalDictionaryLookup and wait until it's loaded.
- PersonalDictionaryLookup lookup =
- new PersonalDictionaryLookup(mContext, ExecutorUtils.SPELLING);
- lookup.open();
-
- // "foo" should match.
- assertTrue(lookup.isValidWord("foo", Locale.US));
-
- // "bar" shouldn't match.
- assertFalse(lookup.isValidWord("bar", Locale.US));
-
- // Now close (prevents further reloads).
- lookup.close();
-
- // Now delete "foo" and add "bar".
- deleteWord(uri);
- addWord("bar", Locale.US, 18, null);
-
- // Wait a little bit before expecting a change. The time we wait should be greater than
- // PersonalDictionaryLookup.RELOAD_DELAY_MS.
- try {
- Thread.sleep(PersonalDictionaryLookup.RELOAD_DELAY_MS + 1000);
- } catch (InterruptedException e) {
- }
-
- // Perform lookups again. Reload should not have occurred.
- //
- // "foo" should stil match.
- assertTrue(lookup.isValidWord("foo", Locale.US));
-
- // "bar" should still not match.
- assertFalse(lookup.isValidWord("bar", Locale.US));
- }
-}
diff --git a/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java b/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java
index 128f9f7db..51a217b4d 100644
--- a/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java
+++ b/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java
@@ -16,12 +16,16 @@
package com.android.inputmethod.latin;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import android.content.res.Resources;
import android.inputmethodservice.InputMethodService;
import android.os.Parcel;
-import android.test.AndroidTestCase;
-import android.test.MoreAsserts;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.SuggestionSpan;
@@ -40,23 +44,27 @@ import com.android.inputmethod.latin.utils.TextRange;
import java.util.Locale;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class RichInputConnectionAndTextRangeTests {
// The following is meant to be a reasonable default for
// the "word_separators" resource.
private SpacingAndPunctuations mSpacingAndPunctuations;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
final RunInLocale<SpacingAndPunctuations> job = new RunInLocale<SpacingAndPunctuations>() {
@Override
protected SpacingAndPunctuations job(final Resources res) {
return new SpacingAndPunctuations(res);
}
};
- final Resources res = getContext().getResources();
+ final Resources res = InstrumentationRegistry.getTargetContext().getResources();
mSpacingAndPunctuations = job.runInLocale(res, Locale.ENGLISH);
}
@@ -156,6 +164,7 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
/**
* Test for getting previous word (for bigram suggestions)
*/
+ @Test
public void testGetPreviousWord() {
// If one of the following cases breaks, the bigram suggestions won't work.
assertEquals(NgramContextUtils.getNgramContextFromNthPreviousWord(
@@ -218,6 +227,7 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
"abc 'def", mSpacingAndPunctuations, 2), NgramContext.EMPTY_PREV_WORDS_INFO);
}
+ @Test
public void testGetWordRangeAtCursor() {
/**
* Test logic in getting the word range at the cursor.
@@ -282,6 +292,7 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
/**
* Test logic in getting the word range at the cursor.
*/
+ @Test
public void testGetSuggestionSpansAtWord() {
helpTestGetSuggestionSpansAtWord(10);
helpTestGetSuggestionSpansAtWord(12);
@@ -309,7 +320,7 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
r = ic.getWordRangeAtCursor(SPACE, ScriptUtils.SCRIPT_LATIN);
suggestions = r.getSuggestionSpansAtWord();
assertEquals(suggestions.length, 1);
- MoreAsserts.assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
+ assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
// Test the case with 2 suggestion spans in the same place.
text = new SpannableString("This is a string for test");
@@ -321,8 +332,8 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
r = ic.getWordRangeAtCursor(SPACE, ScriptUtils.SCRIPT_LATIN);
suggestions = r.getSuggestionSpansAtWord();
assertEquals(suggestions.length, 2);
- MoreAsserts.assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
- MoreAsserts.assertEquals(suggestions[1].getSuggestions(), SUGGESTIONS2);
+ assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
+ assertEquals(suggestions[1].getSuggestions(), SUGGESTIONS2);
// Test a case with overlapping spans, 2nd extending past the start of the word
text = new SpannableString("This is a string for test");
@@ -334,7 +345,7 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
r = ic.getWordRangeAtCursor(SPACE, ScriptUtils.SCRIPT_LATIN);
suggestions = r.getSuggestionSpansAtWord();
assertEquals(suggestions.length, 1);
- MoreAsserts.assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
+ assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
// Test a case with overlapping spans, 2nd extending past the end of the word
text = new SpannableString("This is a string for test");
@@ -346,7 +357,7 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
r = ic.getWordRangeAtCursor(SPACE, ScriptUtils.SCRIPT_LATIN);
suggestions = r.getSuggestionSpansAtWord();
assertEquals(suggestions.length, 1);
- MoreAsserts.assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
+ assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
// Test a case with overlapping spans, 2nd extending past both ends of the word
text = new SpannableString("This is a string for test");
@@ -358,7 +369,7 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
r = ic.getWordRangeAtCursor(SPACE, ScriptUtils.SCRIPT_LATIN);
suggestions = r.getSuggestionSpansAtWord();
assertEquals(suggestions.length, 1);
- MoreAsserts.assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
+ assertEquals(suggestions[0].getSuggestions(), SUGGESTIONS1);
// Test a case with overlapping spans, none right on the word
text = new SpannableString("This is a string for test");
@@ -372,6 +383,7 @@ public class RichInputConnectionAndTextRangeTests extends AndroidTestCase {
assertEquals(suggestions.length, 0);
}
+ @Test
public void testCursorTouchingWord() {
final MockInputMethodService ims = new MockInputMethodService();
final RichInputConnection ic = new RichInputConnection(ims);
diff --git a/tests/src/com/android/inputmethod/latin/RichInputMethodSubtypeTests.java b/tests/src/com/android/inputmethod/latin/RichInputMethodSubtypeTests.java
index af94be664..2b787ea32 100644
--- a/tests/src/com/android/inputmethod/latin/RichInputMethodSubtypeTests.java
+++ b/tests/src/com/android/inputmethod/latin/RichInputMethodSubtypeTests.java
@@ -16,12 +16,18 @@
package com.android.inputmethod.latin;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import android.content.Context;
import android.content.res.Resources;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.RichInputMethodManager;
@@ -33,8 +39,14 @@ import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
import java.util.ArrayList;
import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class RichInputMethodSubtypeTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class RichInputMethodSubtypeTests {
// All input method subtypes of LatinIME.
private final ArrayList<RichInputMethodSubtype> mSubtypesList = new ArrayList<>();
@@ -67,10 +79,9 @@ public class RichInputMethodSubtypeTests extends AndroidTestCase {
RichInputMethodSubtype HI_LATN_DVORAK;
RichInputMethodSubtype SR_LATN_QWERTY;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- final Context context = getContext();
+ @Before
+ public void setUp() throws Exception {
+ final Context context = InstrumentationRegistry.getTargetContext();
mRes = context.getResources();
RichInputMethodManager.init(context);
mRichImm = RichInputMethodManager.getInstance();
@@ -152,13 +163,13 @@ public class RichInputMethodSubtypeTests extends AndroidTestCase {
}
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
// Restore additional subtypes.
mRichImm.setAdditionalInputMethodSubtypes(mSavedAddtionalSubtypes);
- super.tearDown();
}
+ @Test
public void testAllFullDisplayNameForSpacebar() {
for (final RichInputMethodSubtype subtype : mSubtypesList) {
final String subtypeName = SubtypeLocaleUtils
@@ -174,7 +185,8 @@ public class RichInputMethodSubtypeTests extends AndroidTestCase {
}
}
- public void testAllMiddleDisplayNameForSpacebar() {
+ @Test
+ public void testAllMiddleDisplayNameForSpacebar() {
for (final RichInputMethodSubtype subtype : mSubtypesList) {
final String subtypeName = SubtypeLocaleUtils
.getSubtypeDisplayNameInSystemLocale(subtype.getRawSubtype());
@@ -293,22 +305,27 @@ public class RichInputMethodSubtypeTests extends AndroidTestCase {
}
};
+ @Test
public void testPredefinedSubtypesForSpacebarInEnglish() {
testsPredefinedSubtypesForSpacebar.runInLocale(mRes, Locale.ENGLISH);
}
+ @Test
public void testAdditionalSubtypeForSpacebarInEnglish() {
testsAdditionalSubtypesForSpacebar.runInLocale(mRes, Locale.ENGLISH);
}
+ @Test
public void testPredefinedSubtypesForSpacebarInFrench() {
testsPredefinedSubtypesForSpacebar.runInLocale(mRes, Locale.FRENCH);
}
+ @Test
public void testAdditionalSubtypeForSpacebarInFrench() {
testsAdditionalSubtypesForSpacebar.runInLocale(mRes, Locale.FRENCH);
}
+ @Test
public void testRichInputMethodSubtypeForNullInputMethodSubtype() {
RichInputMethodSubtype subtype = RichInputMethodSubtype.getRichInputMethodSubtype(null);
assertNotNull(subtype);
diff --git a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
index d465ce674..967b17f09 100644
--- a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
+++ b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
@@ -16,16 +16,24 @@
package com.android.inputmethod.latin;
-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.assertNull;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Locale;
@SmallTest
-public class SuggestedWordsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class SuggestedWordsTests {
/**
* Helper method to create a dummy {@link SuggestedWordInfo} with specifying
@@ -80,30 +88,35 @@ public class SuggestedWordsTests extends AndroidTestCase {
return returnedWordInfo;
}
+ @Test
public void testRemoveDupesNoDupes() {
final ArrayList<SuggestedWordInfo> infos = createCorrectionWordInfos("a", "c");
assertEquals(-1, SuggestedWordInfo.removeDups("b", infos));
assertEquals(2, infos.size());
}
+ @Test
public void testRemoveDupesTypedWordNotDupe() {
final ArrayList<SuggestedWordInfo> infos = createCorrectionWordInfos("a", "a", "c");
assertEquals(-1, SuggestedWordInfo.removeDups("b", infos));
assertEquals(2, infos.size());
}
+ @Test
public void testRemoveDupesTypedWordOnlyDupe() {
final ArrayList<SuggestedWordInfo> infos = createCorrectionWordInfos("a", "b", "c");
assertEquals(1, SuggestedWordInfo.removeDups("b", infos));
assertEquals(2, infos.size());
}
+ @Test
public void testRemoveDupesTypedWordNotOnlyDupe() {
final ArrayList<SuggestedWordInfo> infos = createCorrectionWordInfos("a", "b", "b", "c");
assertEquals(1, SuggestedWordInfo.removeDups("b", infos));
assertEquals(2, infos.size());
}
+ @Test
public void testGetTransformedSuggestedWordInfo() {
SuggestedWordInfo result = transformWordInfo("word", 0);
assertEquals(result.mWord, "word");
@@ -119,6 +132,7 @@ public class SuggestedWordsTests extends AndroidTestCase {
assertEquals(result.mWord, "didn't''");
}
+ @Test
public void testGetTypedWordInfoOrNull() {
final String TYPED_WORD = "typed";
final SuggestedWordInfo TYPED_WORD_INFO = createTypedWordInfo(TYPED_WORD);
diff --git a/tests/src/com/android/inputmethod/latin/WordComposerTests.java b/tests/src/com/android/inputmethod/latin/WordComposerTests.java
index 8ae475f7e..25e57eee6 100644
--- a/tests/src/com/android/inputmethod/latin/WordComposerTests.java
+++ b/tests/src/com/android/inputmethod/latin/WordComposerTests.java
@@ -16,18 +16,29 @@
package com.android.inputmethod.latin;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.common.CoordinateUtils;
import com.android.inputmethod.latin.common.StringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Unit tests for WordComposer.
*/
@SmallTest
-public class WordComposerTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class WordComposerTests {
+
+ @Test
public void testMoveCursor() {
final WordComposer wc = new WordComposer();
// BMP is the Basic Multilingual Plane, as defined by Unicode. This includes
diff --git a/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java b/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java
index 832817967..aa2a5c2cf 100644
--- a/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java
+++ b/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java
@@ -16,40 +16,54 @@
package com.android.inputmethod.latin.accounts;
+import static org.junit.Assert.assertEquals;
+
import android.accounts.AccountManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
-import android.test.AndroidTestCase;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.settings.LocalSettingsConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests for {@link AccountsChangedReceiver}.
*/
-public class AccountsChangedReceiverTests extends AndroidTestCase {
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class AccountsChangedReceiverTests {
private static final String ACCOUNT_1 = "account1@example.com";
private static final String ACCOUNT_2 = "account2@example.com";
private SharedPreferences mPrefs;
private String mLastKnownAccount = null;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ private Context getContext() {
+ return InstrumentationRegistry.getTargetContext();
+ }
+
+ @Before
+ public void setUp() throws Exception {
mPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
// Keep track of the current account so that we restore it when the test finishes.
mLastKnownAccount = mPrefs.getString(LocalSettingsConstants.PREF_ACCOUNT_NAME, null);
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ @After
+ public void tearDown() throws Exception {
// Restore the account that was present before running the test.
updateAccountName(mLastKnownAccount);
}
+ @Test
public void testUnknownIntent() {
updateAccountName(ACCOUNT_1);
AccountsChangedReceiver reciever = new AccountsChangedReceiver();
@@ -58,6 +72,7 @@ public class AccountsChangedReceiverTests extends AndroidTestCase {
assertAccountName(ACCOUNT_1);
}
+ @Test
public void testAccountRemoved() {
updateAccountName(ACCOUNT_1);
AccountsChangedReceiver reciever = new AccountsChangedReceiver() {
@@ -71,6 +86,7 @@ public class AccountsChangedReceiverTests extends AndroidTestCase {
assertAccountName(null);
}
+ @Test
public void testAccountRemoved_noAccounts() {
updateAccountName(ACCOUNT_2);
AccountsChangedReceiver reciever = new AccountsChangedReceiver() {
@@ -84,6 +100,7 @@ public class AccountsChangedReceiverTests extends AndroidTestCase {
assertAccountName(null);
}
+ @Test
public void testAccountNotRemoved() {
updateAccountName(ACCOUNT_2);
AccountsChangedReceiver reciever = new AccountsChangedReceiver() {
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;
diff --git a/tests/src/com/android/inputmethod/latin/common/ResizableIntArrayTests.java b/tests/src/com/android/inputmethod/latin/common/ResizableIntArrayTests.java
index bd1629faf..d9b6bad75 100644
--- a/tests/src/com/android/inputmethod/latin/common/ResizableIntArrayTests.java
+++ b/tests/src/com/android/inputmethod/latin/common/ResizableIntArrayTests.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 java.util.Arrays;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class ResizableIntArrayTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class ResizableIntArrayTests {
private static final int DEFAULT_CAPACITY = 48;
+ @Test
public void testNewInstance() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
final int[] array = src.getPrimitiveArray();
@@ -33,6 +45,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
assertEquals("new instance array length", DEFAULT_CAPACITY, array.length);
}
+ @Test
public void testAdd() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
final int[] array = src.getPrimitiveArray();
@@ -62,6 +75,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
}
}
+ @Test
public void testAddAt() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
final int limit = DEFAULT_CAPACITY * 10, step = DEFAULT_CAPACITY * 2;
@@ -76,6 +90,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
}
}
+ @Test
public void testGet() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
try {
@@ -105,6 +120,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
}
}
+ @Test
public void testReset() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
final int[] array = src.getPrimitiveArray();
@@ -136,6 +152,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
}
}
+ @Test
public void testSetLength() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
final int[] array = src.getPrimitiveArray();
@@ -172,6 +189,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
}
}
+ @Test
public void testSet() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
final int limit = DEFAULT_CAPACITY * 2 + 10;
@@ -186,6 +204,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
assertSame("array after set", dst.getPrimitiveArray(), src.getPrimitiveArray());
}
+ @Test
public void testCopy() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
for (int i = 0; i < DEFAULT_CAPACITY; i++) {
@@ -214,6 +233,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
dst.getPrimitiveArray(), 0, src.getPrimitiveArray(), 0, dst.getLength());
}
+ @Test
public void testAppend() {
final int srcLength = DEFAULT_CAPACITY;
final ResizableIntArray src = new ResizableIntArray(srcLength);
@@ -264,6 +284,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
srcLength);
}
+ @Test
public void testFill() {
final int srcLength = DEFAULT_CAPACITY;
final ResizableIntArray src = new ResizableIntArray(srcLength);
@@ -359,6 +380,7 @@ public class ResizableIntArrayTests extends AndroidTestCase {
}
}
+ @Test
public void testShift() {
final ResizableIntArray src = new ResizableIntArray(DEFAULT_CAPACITY);
final int limit = DEFAULT_CAPACITY * 10;
diff --git a/tests/src/com/android/inputmethod/latin/common/StringUtilsTests.java b/tests/src/com/android/inputmethod/latin/common/StringUtilsTests.java
index ec9d4be92..393efe6eb 100644
--- a/tests/src/com/android/inputmethod/latin/common/StringUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/common/StringUtilsTests.java
@@ -16,13 +16,21 @@
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.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import java.util.Locale;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class StringUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class StringUtilsTests {
private static final Locale US = Locale.US;
private static final Locale GERMAN = Locale.GERMAN;
private static final Locale TURKEY = new Locale("tr", "TR");
@@ -34,6 +42,7 @@ public class StringUtilsTests extends AndroidTestCase {
StringUtils.toTitleCaseOfKeyLabel(lowerCase, locale));
}
+ @Test
public void test_toTitleCaseOfKeyLabel() {
assert_toTitleCaseOfKeyLabel(US, null, null);
assert_toTitleCaseOfKeyLabel(US, "", "");
@@ -116,6 +125,7 @@ public class StringUtilsTests extends AndroidTestCase {
StringUtils.toTitleCaseOfKeyCode(lowerCase, locale));
}
+ @Test
public void test_toTitleCaseOfKeyCode() {
assert_toTitleCaseOfKeyCode(US, Constants.CODE_ENTER, Constants.CODE_ENTER);
assert_toTitleCaseOfKeyCode(US, Constants.CODE_SPACE, Constants.CODE_SPACE);
@@ -148,6 +158,7 @@ public class StringUtilsTests extends AndroidTestCase {
StringUtils.capitalizeFirstCodePoint(text, locale));
}
+ @Test
public void test_capitalizeFirstCodePoint() {
assert_capitalizeFirstCodePoint(US, "", "");
assert_capitalizeFirstCodePoint(US, "a", "A");
@@ -167,6 +178,7 @@ public class StringUtilsTests extends AndroidTestCase {
StringUtils.capitalizeFirstAndDowncaseRest(text, locale));
}
+ @Test
public void test_capitalizeFirstAndDowncaseRest() {
assert_capitalizeFirstAndDowncaseRest(US, "", "");
assert_capitalizeFirstAndDowncaseRest(US, "a", "A");
@@ -185,6 +197,7 @@ public class StringUtilsTests extends AndroidTestCase {
assert_capitalizeFirstAndDowncaseRest(GREECE, "ΆΝΕΣΗ", "Άνεση");
}
+ @Test
public void testContainsInArray() {
assertFalse("empty array", StringUtils.containsInArray("key", new String[0]));
assertFalse("not in 1 element", StringUtils.containsInArray("key", new String[] {
@@ -202,6 +215,7 @@ public class StringUtilsTests extends AndroidTestCase {
}));
}
+ @Test
public void testContainsInCommaSplittableText() {
assertFalse("null", StringUtils.containsInCommaSplittableText("key", null));
assertFalse("empty", StringUtils.containsInCommaSplittableText("key", ""));
@@ -214,6 +228,7 @@ public class StringUtilsTests extends AndroidTestCase {
assertTrue("in 2 elements", StringUtils.containsInCommaSplittableText("key", "key1,key"));
}
+ @Test
public void testRemoveFromCommaSplittableTextIfExists() {
assertEquals("null", "", StringUtils.removeFromCommaSplittableTextIfExists("key", null));
assertEquals("empty", "", StringUtils.removeFromCommaSplittableTextIfExists("key", ""));
@@ -239,7 +254,7 @@ public class StringUtilsTests extends AndroidTestCase {
"key", "key1,key,key3,key,key5"));
}
-
+ @Test
public void testCapitalizeFirstCodePoint() {
assertEquals("SSaa",
StringUtils.capitalizeFirstCodePoint("ßaa", Locale.GERMAN));
@@ -259,6 +274,7 @@ public class StringUtilsTests extends AndroidTestCase {
StringUtils.capitalizeFirstCodePoint("A", Locale.ENGLISH));
}
+ @Test
public void testCapitalizeFirstAndDowncaseRest() {
assertEquals("SSaa",
StringUtils.capitalizeFirstAndDowncaseRest("ßaa", Locale.GERMAN));
@@ -278,6 +294,7 @@ public class StringUtilsTests extends AndroidTestCase {
StringUtils.capitalizeFirstAndDowncaseRest("A", Locale.ENGLISH));
}
+ @Test
public void testGetCapitalizationType() {
assertEquals(StringUtils.CAPITALIZE_NONE,
StringUtils.getCapitalizationType("capitalize"));
@@ -301,6 +318,7 @@ public class StringUtilsTests extends AndroidTestCase {
StringUtils.getCapitalizationType(""));
}
+ @Test
public void testIsIdenticalAfterUpcaseIsIdenticalAfterDowncase() {
assertFalse(StringUtils.isIdenticalAfterUpcase("capitalize"));
assertTrue(StringUtils.isIdenticalAfterDowncase("capitalize"));
@@ -337,6 +355,7 @@ public class StringUtilsTests extends AndroidTestCase {
StringUtils.toSortedCodePointArray(" \n.!?*()&");
private static final int[] WORD_SEPARATORS = StringUtils.toSortedCodePointArray(" \n.!?*,();&");
+ @Test
public void testCapitalizeEachWord() {
checkCapitalize("", "", SPACE, Locale.ENGLISH);
checkCapitalize("test", "Test", SPACE, Locale.ENGLISH);
@@ -367,6 +386,7 @@ public class StringUtilsTests extends AndroidTestCase {
WORD_SEPARATORS, Locale.ENGLISH);
}
+ @Test
public void testLooksLikeURL() {
assertTrue(StringUtils.lastPartLooksLikeURL("http://www.google."));
assertFalse(StringUtils.lastPartLooksLikeURL("word wo"));
@@ -389,6 +409,7 @@ public class StringUtilsTests extends AndroidTestCase {
assertTrue(StringUtils.lastPartLooksLikeURL(".abc/def"));
}
+ @Test
public void testHexStringUtils() {
final byte[] bytes = new byte[] { (byte)0x01, (byte)0x11, (byte)0x22, (byte)0x33,
(byte)0x55, (byte)0x88, (byte)0xEE };
@@ -401,6 +422,7 @@ public class StringUtilsTests extends AndroidTestCase {
assertTrue(bytesStr.equals(bytesStr2));
}
+ @Test
public void testToCodePointArray() {
final String STR_WITH_SUPPLEMENTARY_CHAR = "abcde\uD861\uDED7fgh\u0000\u2002\u2003\u3000xx";
final int[] EXPECTED_RESULT = new int[] { 'a', 'b', 'c', 'd', 'e', 0x286D7, 'f', 'g', 'h',
@@ -414,6 +436,7 @@ public class StringUtilsTests extends AndroidTestCase {
}
}
+ @Test
public void testCopyCodePointsAndReturnCodePointCount() {
final String STR_WITH_SUPPLEMENTARY_CHAR = "AbcDE\uD861\uDED7fGh\u0000\u2002\u3000あx";
final int[] EXPECTED_RESULT = new int[] { 'A', 'b', 'c', 'D', 'E', 0x286D7,
@@ -465,6 +488,7 @@ public class StringUtilsTests extends AndroidTestCase {
exceptionHappened);
}
+ @Test
public void testGetTrailingSingleQuotesCount() {
assertEquals(0, StringUtils.getTrailingSingleQuotesCount(""));
assertEquals(1, StringUtils.getTrailingSingleQuotesCount("'"));
diff --git a/tests/src/com/android/inputmethod/latin/common/UnicodeSurrogateTests.java b/tests/src/com/android/inputmethod/latin/common/UnicodeSurrogateTests.java
index 59bb08292..43fdeec96 100644
--- a/tests/src/com/android/inputmethod/latin/common/UnicodeSurrogateTests.java
+++ b/tests/src/com/android/inputmethod/latin/common/UnicodeSurrogateTests.java
@@ -16,18 +16,28 @@
package com.android.inputmethod.latin.common;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
@SmallTest
-public class UnicodeSurrogateTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class UnicodeSurrogateTests {
+ @Test
public void testIsLowSurrogate() {
assertFalse(UnicodeSurrogate.isLowSurrogate('\uD7FF'));
assertTrue(UnicodeSurrogate.isLowSurrogate('\uD83D'));
assertFalse(UnicodeSurrogate.isLowSurrogate('\uDC00'));
}
+ @Test
public void testIsHighSurrogate() {
assertFalse(UnicodeSurrogate.isHighSurrogate('\uDBFF'));
assertTrue(UnicodeSurrogate.isHighSurrogate('\uDE25'));
diff --git a/tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java b/tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java
index 8f24cdb44..bdbbaf2e6 100644
--- a/tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java
+++ b/tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java
@@ -16,13 +16,16 @@
package com.android.inputmethod.latin.network;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.network.BlockingHttpClient.ResponseProcessor;
@@ -40,19 +43,24 @@ import java.net.HttpURLConnection;
import java.util.Arrays;
import java.util.Random;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests for {@link BlockingHttpClient}.
*/
@SmallTest
-public class BlockingHttpClientTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class BlockingHttpClientTests {
@Mock HttpURLConnection mMockHttpConnection;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
+ @Test
public void testError_badGateway() throws IOException, AuthException {
when(mMockHttpConnection.getResponseCode()).thenReturn(HttpURLConnection.HTTP_BAD_GATEWAY);
final BlockingHttpClient client = new BlockingHttpClient(mMockHttpConnection);
@@ -67,6 +75,7 @@ public class BlockingHttpClientTests extends AndroidTestCase {
}
}
+ @Test
public void testError_clientTimeout() throws Exception {
when(mMockHttpConnection.getResponseCode()).thenReturn(
HttpURLConnection.HTTP_CLIENT_TIMEOUT);
@@ -82,6 +91,7 @@ public class BlockingHttpClientTests extends AndroidTestCase {
}
}
+ @Test
public void testError_forbiddenWithRequest() throws Exception {
final OutputStream mockOutputStream = Mockito.mock(OutputStream.class);
when(mMockHttpConnection.getResponseCode()).thenReturn(HttpURLConnection.HTTP_FORBIDDEN);
@@ -98,6 +108,7 @@ public class BlockingHttpClientTests extends AndroidTestCase {
verify(mockOutputStream).write(any(byte[].class), eq(0), eq(100));
}
+ @Test
public void testSuccess_emptyRequest() throws Exception {
final Random rand = new Random();
byte[] response = new byte[100];
@@ -112,6 +123,7 @@ public class BlockingHttpClientTests extends AndroidTestCase {
assertTrue("ResponseProcessor was not invoked", processor.mInvoked);
}
+ @Test
public void testSuccess() throws Exception {
final OutputStream mockOutputStream = Mockito.mock(OutputStream.class);
final Random rand = new Random();
diff --git a/tests/src/com/android/inputmethod/latin/network/HttpUrlConnectionBuilderTests.java b/tests/src/com/android/inputmethod/latin/network/HttpUrlConnectionBuilderTests.java
index 5b3e78eaf..fce812ea7 100644
--- a/tests/src/com/android/inputmethod/latin/network/HttpUrlConnectionBuilderTests.java
+++ b/tests/src/com/android/inputmethod/latin/network/HttpUrlConnectionBuilderTests.java
@@ -20,25 +20,28 @@ import static com.android.inputmethod.latin.network.HttpUrlConnectionBuilder.MOD
import static com.android.inputmethod.latin.network.HttpUrlConnectionBuilder.MODE_DOWNLOAD_ONLY;
import static com.android.inputmethod.latin.network.HttpUrlConnectionBuilder.MODE_UPLOAD_ONLY;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+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.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Tests for {@link HttpUrlConnectionBuilder}.
*/
@SmallTest
-public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
+@RunWith(AndroidJUnit4.class)
+public class HttpUrlConnectionBuilderTests {
+ @Test
public void testSetUrl_malformed() {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
try {
@@ -49,6 +52,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
}
}
+ @Test
public void testSetConnectTimeout_invalid() {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
try {
@@ -59,6 +63,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
}
}
+ @Test
public void testSetConnectTimeout() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("https://www.example.com");
@@ -67,6 +72,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertEquals(8765, connection.getConnectTimeout());
}
+ @Test
public void testSetReadTimeout_invalid() {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
try {
@@ -77,6 +83,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
}
}
+ @Test
public void testSetReadTimeout() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("https://www.example.com");
@@ -85,6 +92,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertEquals(8765, connection.getReadTimeout());
}
+ @Test
public void testAddHeader() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("http://www.example.com");
@@ -93,6 +101,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertEquals("some-random-value", connection.getRequestProperty("some-random-key"));
}
+ @Test
public void testSetUseCache_notSet() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("http://www.example.com");
@@ -100,6 +109,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertFalse(connection.getUseCaches());
}
+ @Test
public void testSetUseCache_false() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("http://www.example.com");
@@ -108,6 +118,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertFalse(connection.getUseCaches());
}
+ @Test
public void testSetUseCache_true() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("http://www.example.com");
@@ -116,6 +127,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertTrue(connection.getUseCaches());
}
+ @Test
public void testSetMode_uploadOnly() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("http://www.example.com");
@@ -125,6 +137,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertFalse(connection.getDoOutput());
}
+ @Test
public void testSetMode_downloadOnly() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("https://www.example.com");
@@ -134,6 +147,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertTrue(connection.getDoOutput());
}
+ @Test
public void testSetMode_bidirectional() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("https://www.example.com");
@@ -143,6 +157,7 @@ public class HttpUrlConnectionBuilderTests extends AndroidTestCase {
assertTrue(connection.getDoOutput());
}
+ @Test
public void testSetAuthToken() throws IOException {
HttpUrlConnectionBuilder builder = new HttpUrlConnectionBuilder();
builder.setUrl("https://www.example.com");
diff --git a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
index 559f28642..8f786d57b 100644
--- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
+++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
@@ -16,8 +16,12 @@
package com.android.inputmethod.latin.personalization;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+import static org.junit.Assert.assertTrue;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.LargeTest;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import com.android.inputmethod.latin.ExpandableBinaryDictionary;
@@ -27,17 +31,27 @@ import java.io.File;
import java.util.Locale;
import java.util.Random;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Unit tests for UserHistoryDictionary
*/
@LargeTest
-public class UserHistoryDictionaryTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class UserHistoryDictionaryTests {
private static final String TAG = UserHistoryDictionaryTests.class.getSimpleName();
private static final int WAIT_FOR_WRITING_FILE_IN_MILLISECONDS = 3000;
private static final String TEST_ACCOUNT = "account@example.com";
private int mCurrentTime = 0;
+ private Context getContext() {
+ return InstrumentationRegistry.getTargetContext();
+ }
+
private static void printAllFiles(final File dir) {
Log.d(TAG, dir.getAbsolutePath());
for (final File file : dir.listFiles()) {
@@ -62,20 +76,18 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
assertTrue("Following dictionary file doesn't exist: " + dictFile, dictFile.exists());
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
resetCurrentTimeForTestMode();
UserHistoryDictionaryTestsHelper.removeAllTestDictFiles(
- UserHistoryDictionaryTestsHelper.TEST_LOCALE_PREFIX, mContext);
+ UserHistoryDictionaryTestsHelper.TEST_LOCALE_PREFIX, getContext());
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
UserHistoryDictionaryTestsHelper.removeAllTestDictFiles(
- UserHistoryDictionaryTestsHelper.TEST_LOCALE_PREFIX, mContext);
+ UserHistoryDictionaryTestsHelper.TEST_LOCALE_PREFIX, getContext());
stopTestModeInNativeCode();
- super.tearDown();
}
private void resetCurrentTimeForTestMode() {
@@ -111,7 +123,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
null /* dictFile */,
testAccount /* account */);
final File dictFile = ExpandableBinaryDictionary.getDictFile(
- mContext, dictName, null /* dictFile */);
+ getContext(), dictName, null /* dictFile */);
final UserHistoryDictionary dict = PersonalizationHelper.getUserHistoryDictionary(
getContext(), dummyLocale, testAccount);
clearHistory(dict);
@@ -123,18 +135,22 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
assertDictionaryExists(dict, dictFile);
}
+ @Test
public void testRandomWords_NullAccount() {
doTestRandomWords(null /* testAccount */);
}
+ @Test
public void testRandomWords() {
doTestRandomWords(TEST_ACCOUNT);
}
+ @Test
public void testStressTestForSwitchingLanguagesAndAddingWords() {
doTestStressTestForSwitchingLanguagesAndAddingWords(TEST_ACCOUNT);
}
+ @Test
public void testStressTestForSwitchingLanguagesAndAddingWords_NullAccount() {
doTestStressTestForSwitchingLanguagesAndAddingWords(null /* testAccount */);
}
@@ -158,7 +174,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */,
testAccount /* account */);
dictFiles[i] = ExpandableBinaryDictionary.getDictFile(
- mContext, dictName, null /* dictFile */);
+ getContext(), dictName, null /* dictFile */);
dicts[i] = PersonalizationHelper.getUserHistoryDictionary(getContext(),
dummyLocale, testAccount);
clearHistory(dicts[i]);
@@ -186,10 +202,12 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testAddManyWords() {
doTestAddManyWords(TEST_ACCOUNT);
}
+ @Test
public void testAddManyWords_NullAccount() {
doTestAddManyWords(null /* testAccount */);
}
@@ -200,7 +218,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
final String dictName = UserHistoryDictionary.getUserHistoryDictName(
UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */, testAccount);
final File dictFile = ExpandableBinaryDictionary.getDictFile(
- mContext, dictName, null /* dictFile */);
+ getContext(), dictName, null /* dictFile */);
final int numberOfWords = 10000;
final Random random = new Random(123456);
final UserHistoryDictionary dict = PersonalizationHelper.getUserHistoryDictionary(
diff --git a/tests/src/com/android/inputmethod/latin/settings/AccountsSettingsFragmentTests.java b/tests/src/com/android/inputmethod/latin/settings/AccountsSettingsFragmentTests.java
index f2d8973f7..49a9a25da 100644
--- a/tests/src/com/android/inputmethod/latin/settings/AccountsSettingsFragmentTests.java
+++ b/tests/src/com/android/inputmethod/latin/settings/AccountsSettingsFragmentTests.java
@@ -16,6 +16,9 @@
package com.android.inputmethod.latin.settings;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
@@ -23,13 +26,18 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.suitebuilder.annotation.MediumTest;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.MediumTest;
+import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.widget.ListView;
import com.android.inputmethod.latin.utils.ManagedProfileUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -37,36 +45,41 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@MediumTest
-public class AccountsSettingsFragmentTests
- extends ActivityInstrumentationTestCase2<TestFragmentActivity> {
+@RunWith(AndroidJUnit4.class)
+public class AccountsSettingsFragmentTests {
private static final String FRAG_NAME = AccountsSettingsFragment.class.getName();
private static final long TEST_TIMEOUT_MILLIS = 5000;
@Mock private ManagedProfileUtils mManagedProfileUtils;
- public AccountsSettingsFragmentTests() {
- super(TestFragmentActivity.class);
+ private TestFragmentActivity mActivity;
+ private TestFragmentActivity getActivity() {
+ return mActivity;
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
+ @Before
+ public void setUp() throws Exception {
// Initialize the mocks.
MockitoAnnotations.initMocks(this);
ManagedProfileUtils.setTestInstance(mManagedProfileUtils);
- Intent intent = new Intent();
- intent.putExtra(TestFragmentActivity.EXTRA_SHOW_FRAGMENT, FRAG_NAME);
- setActivityIntent(intent);
+ final Intent intent = new Intent()
+ .setAction(Intent.ACTION_MAIN)
+ .setClass(InstrumentationRegistry.getTargetContext(), TestFragmentActivity.class)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ .addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)
+ .putExtra(TestFragmentActivity.EXTRA_SHOW_FRAGMENT, FRAG_NAME);
+ mActivity = (TestFragmentActivity) InstrumentationRegistry.getInstrumentation()
+ .startActivitySync(intent);
}
- @Override
+ @After
public void tearDown() throws Exception {
ManagedProfileUtils.setTestInstance(null);
- super.tearDown();
+ mActivity = null;
}
+ @Test
public void testEmptyAccounts() {
final AccountsSettingsFragment fragment =
(AccountsSettingsFragment) getActivity().mFragment;
@@ -83,6 +96,7 @@ public class AccountsSettingsFragmentTests
DialogHolder() {}
}
+ @Test
public void testMultipleAccounts_noSettingsForManagedProfile() {
when(mManagedProfileUtils.hasWorkProfile(any(Context.class))).thenReturn(true);
@@ -95,6 +109,7 @@ public class AccountsSettingsFragmentTests
assertNull(fragment.findPreference(AccountsSettingsFragment.PREF_ACCCOUNT_SWITCHER));
}
+ @Test
public void testMultipleAccounts_noCurrentAccount() {
when(mManagedProfileUtils.hasWorkProfile(any(Context.class))).thenReturn(false);
@@ -116,6 +131,7 @@ public class AccountsSettingsFragmentTests
dialog.getButton(DialogInterface.BUTTON_POSITIVE).getVisibility());
}
+ @Test
public void testMultipleAccounts_currentAccount() {
when(mManagedProfileUtils.hasWorkProfile(any(Context.class))).thenReturn(false);
@@ -164,7 +180,7 @@ public class AccountsSettingsFragmentTests
} catch (InterruptedException ex) {
fail();
}
- getInstrumentation().waitForIdleSync();
+ InstrumentationRegistry.getInstrumentation().waitForIdleSync();
return dialogHolder;
}
}
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;
diff --git a/tests/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelperTests.java b/tests/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelperTests.java
index f3273a2d1..b44a9290b 100644
--- a/tests/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelperTests.java
+++ b/tests/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelperTests.java
@@ -16,13 +16,22 @@
package com.android.inputmethod.latin.suggestions;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static junit.framework.TestCase.assertEquals;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.SuggestedWords;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class SuggestionStripLayoutHelperTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class SuggestionStripLayoutHelperTests {
private static void confirmShowTypedWord(final String message, final int inputType) {
assertFalse(message, SuggestionStripLayoutHelper.shouldOmitTypedWord(
inputType,
@@ -42,6 +51,7 @@ public class SuggestionStripLayoutHelperTests extends AndroidTestCase {
true /* shouldShowUiToAcceptTypedWord */));
}
+ @Test
public void testShouldShowTypedWord() {
confirmShowTypedWord("no input style",
SuggestedWords.INPUT_STYLE_NONE);
@@ -51,7 +61,8 @@ public class SuggestionStripLayoutHelperTests extends AndroidTestCase {
SuggestedWords.INPUT_STYLE_RECORRECTION);
}
- public void testshouldOmitTypedWordWhileTyping() {
+ @Test
+ public void testShouldOmitTypedWordWhileTyping() {
assertFalse("typing", SuggestionStripLayoutHelper.shouldOmitTypedWord(
SuggestedWords.INPUT_STYLE_TYPING,
false /* gestureFloatingPreviewTextEnabled */,
@@ -70,7 +81,8 @@ public class SuggestionStripLayoutHelperTests extends AndroidTestCase {
true /* shouldShowUiToAcceptTypedWord */));
}
- public void testshouldOmitTypedWordWhileGesturing() {
+ @Test
+ public void testShouldOmitTypedWordWhileGesturing() {
assertFalse("gesturing", SuggestionStripLayoutHelper.shouldOmitTypedWord(
SuggestedWords.INPUT_STYLE_UPDATE_BATCH,
false /* gestureFloatingPreviewTextEnabled */,
@@ -89,7 +101,8 @@ public class SuggestionStripLayoutHelperTests extends AndroidTestCase {
true /* shouldShowUiToAcceptTypedWord */));
}
- public void testshouldOmitTypedWordWhenGestured() {
+ @Test
+ public void testShouldOmitTypedWordWhenGestured() {
assertFalse("gestured", SuggestionStripLayoutHelper.shouldOmitTypedWord(
SuggestedWords.INPUT_STYLE_TAIL_BATCH,
false /* gestureFloatingPreviewTextEnabled */,
@@ -115,6 +128,7 @@ public class SuggestionStripLayoutHelperTests extends AndroidTestCase {
private static final int POSITION_CENTER = 1;
private static final int POSITION_RIGHT = 2;
+ @Test
public void testGetPositionInSuggestionStrip() {
assertEquals("1st word without auto correction", POSITION_CENTER,
SuggestionStripLayoutHelper.getPositionInSuggestionStrip(
diff --git a/tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java b/tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java
index ad6bcc3c4..d508f3667 100644
--- a/tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java
+++ b/tests/src/com/android/inputmethod/latin/touchinputconsumer/NullGestureConsumerTests.java
@@ -16,18 +16,26 @@
package com.android.inputmethod.latin.touchinputconsumer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Tests for GestureConsumer.NULL_GESTURE_CONSUMER.
*/
@SmallTest
-public class NullGestureConsumerTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class NullGestureConsumerTests {
/**
* Tests that GestureConsumer.NULL_GESTURE_CONSUMER indicates that it won't consume gesture data
* and that its methods don't raise exceptions even for invalid data.
*/
+ @Test
public void testNullGestureConsumer() {
assertFalse(GestureConsumer.NULL_GESTURE_CONSUMER.willConsume());
GestureConsumer.NULL_GESTURE_CONSUMER.onInit(null, null);
@@ -40,6 +48,7 @@ public class NullGestureConsumerTests extends AndroidTestCase {
/**
* Tests that newInstance returns NULL_GESTURE_CONSUMER for invalid input.
*/
+ @Test
public void testNewInstanceGivesNullGestureConsumerForInvalidInputs() {
assertSame(GestureConsumer.NULL_GESTURE_CONSUMER,
GestureConsumer.newInstance(null, null, null, null));
diff --git a/tests/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtilsTests.java
index 1db839506..ba3951ffa 100644
--- a/tests/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtilsTests.java
@@ -22,19 +22,28 @@ import static com.android.inputmethod.latin.common.Constants.Subtype.ExtraValue.
import static com.android.inputmethod.latin.common.Constants.Subtype.ExtraValue.IS_ADDITIONAL_SUBTYPE;
import static com.android.inputmethod.latin.common.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET;
import static com.android.inputmethod.latin.common.Constants.Subtype.ExtraValue.UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import android.content.Context;
import android.os.Build;
-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 android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.compat.InputMethodSubtypeCompatUtils;
import java.util.Locale;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class AdditionalSubtypeUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class AdditionalSubtypeUtilsTests {
/**
* Predictable subtype ID for en_US dvorak layout. This is actually a hash code calculated as
@@ -98,10 +107,9 @@ public class AdditionalSubtypeUtilsTests extends AndroidTestCase {
",EmojiCapable" +
",isAdditionalSubtype";
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- final Context context = getContext();
+ @Before
+ public void setUp() throws Exception {
+ final Context context = InstrumentationRegistry.getTargetContext();
SubtypeLocaleUtils.init(context);
}
@@ -149,6 +157,7 @@ public class AdditionalSubtypeUtilsTests extends AndroidTestCase {
assertEquals(SUBTYPE_ID_ZZ_AZERTY, subtype.hashCode());
}
+ @Test
public void testRestorable() {
final InputMethodSubtype EN_US_DVORAK =
AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype(
diff --git a/tests/src/com/android/inputmethod/latin/utils/AsyncResultHolderTests.java b/tests/src/com/android/inputmethod/latin/utils/AsyncResultHolderTests.java
index c214b5fd0..f30f6661b 100644
--- a/tests/src/com/android/inputmethod/latin/utils/AsyncResultHolderTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/AsyncResultHolderTests.java
@@ -16,12 +16,18 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import static org.junit.Assert.assertEquals;
+
+import android.support.test.filters.MediumTest;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@MediumTest
-public class AsyncResultHolderTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class AsyncResultHolderTests {
static final String TAG = AsyncResultHolderTests.class.getSimpleName();
private static final int TIMEOUT_IN_MILLISECONDS = 500;
@@ -44,12 +50,14 @@ public class AsyncResultHolderTests extends AndroidTestCase {
}).start();
}
+ @Test
public void testGetWithoutSet() {
final AsyncResultHolder<Integer> holder = new AsyncResultHolder<>("Test");
final int resultValue = holder.get(DEFAULT_VALUE, TIMEOUT_IN_MILLISECONDS);
assertEquals(DEFAULT_VALUE, resultValue);
}
+ @Test
public void testGetBeforeSet() {
final AsyncResultHolder<Integer> holder = new AsyncResultHolder<>("Test");
setAfterGivenTime(holder, SET_VALUE, TIMEOUT_IN_MILLISECONDS + MARGIN_IN_MILLISECONDS);
@@ -57,6 +65,7 @@ public class AsyncResultHolderTests extends AndroidTestCase {
assertEquals(DEFAULT_VALUE, resultValue);
}
+ @Test
public void testGetAfterSet() {
final AsyncResultHolder<Integer> holder = new AsyncResultHolder<>("Test");
holder.set(SET_VALUE);
@@ -64,6 +73,7 @@ public class AsyncResultHolderTests extends AndroidTestCase {
assertEquals(SET_VALUE, resultValue);
}
+ @Test
public void testGetBeforeTimeout() {
final AsyncResultHolder<Integer> holder = new AsyncResultHolder<>("Test");
setAfterGivenTime(holder, SET_VALUE, TIMEOUT_IN_MILLISECONDS - MARGIN_IN_MILLISECONDS);
diff --git a/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
index 9680d85b3..3a452e4ba 100644
--- a/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
@@ -16,18 +16,26 @@
package com.android.inputmethod.latin.utils;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
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 android.text.TextUtils;
import com.android.inputmethod.latin.common.LocaleUtils;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Locale;
@SmallTest
-public class CapsModeUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class CapsModeUtilsTests {
private static void onePathForCaps(final CharSequence cs, final int expectedResult,
final int mask, final SpacingAndPunctuations sp, final boolean hasSpaceBefore) {
final int oneTimeResult = expectedResult & mask;
@@ -49,6 +57,7 @@ public class CapsModeUtilsTests extends AndroidTestCase {
onePathForCaps(cs, expectedResult, s, sp, hasSpaceBefore);
}
+ @Test
public void testGetCapsMode() {
final int c = TextUtils.CAP_MODE_CHARACTERS;
final int w = TextUtils.CAP_MODE_WORDS;
@@ -59,7 +68,7 @@ public class CapsModeUtilsTests extends AndroidTestCase {
return new SpacingAndPunctuations(res);
}
};
- final Resources res = getContext().getResources();
+ final Resources res = InstrumentationRegistry.getTargetContext().getResources();
SpacingAndPunctuations sp = job.runInLocale(res, Locale.ENGLISH);
allPathsForCaps("", c | w | s, sp, false);
allPathsForCaps("Word", c, sp, false);
diff --git a/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
index 0cbb02c4f..96dfa36c2 100644
--- a/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
@@ -16,11 +16,16 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+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 com.android.inputmethod.latin.common.CollectionUtils;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -28,15 +33,20 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests for {@link CollectionUtils}.
*/
@SmallTest
-public class CollectionUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class CollectionUtilsTests {
/**
* Tests that {@link CollectionUtils#arrayAsList(Object[],int,int)} fails as expected
* with some invalid inputs.
*/
+ @Test
public void testArrayAsListFailure() {
final String[] array = { "0", "1" };
// Negative start
@@ -66,6 +76,7 @@ public class CollectionUtilsTests extends AndroidTestCase {
* Tests that {@link CollectionUtils#arrayAsList(Object[],int,int)} gives the expected
* results for a few valid inputs.
*/
+ @Test
public void testArrayAsList() {
final ArrayList<String> empty = new ArrayList<>();
assertEquals(empty, CollectionUtils.arrayAsList(new String[] {}, 0, 0));
@@ -81,6 +92,7 @@ public class CollectionUtilsTests extends AndroidTestCase {
* Tests that {@link CollectionUtils#isNullOrEmpty(java.util.Collection)} gives the expected
* results for a few cases.
*/
+ @Test
public void testIsNullOrEmpty() {
assertTrue(CollectionUtils.isNullOrEmpty((List<String>) null));
assertTrue(CollectionUtils.isNullOrEmpty((Map<String, String>) null));
diff --git a/tests/src/com/android/inputmethod/latin/utils/DictionaryInfoUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/DictionaryInfoUtilsTests.java
index 812353cc4..e24707aa6 100644
--- a/tests/src/com/android/inputmethod/latin/utils/DictionaryInfoUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/DictionaryInfoUtilsTests.java
@@ -16,17 +16,27 @@
package com.android.inputmethod.latin.utils;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
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.common.LocaleUtils;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
import java.util.Locale;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class DictionaryInfoUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class DictionaryInfoUtilsTests {
+ @Test
public void testLooksValidForDictionaryInsertion() {
final RunInLocale<SpacingAndPunctuations> job = new RunInLocale<SpacingAndPunctuations>() {
@Override
@@ -34,7 +44,7 @@ public class DictionaryInfoUtilsTests extends AndroidTestCase {
return new SpacingAndPunctuations(res);
}
};
- final Resources res = getContext().getResources();
+ final Resources res = InstrumentationRegistry.getTargetContext().getResources();
final SpacingAndPunctuations sp = job.runInLocale(res, Locale.ENGLISH);
assertTrue(DictionaryInfoUtils.looksValidForDictionaryInsertion("aochaueo", sp));
assertFalse(DictionaryInfoUtils.looksValidForDictionaryInsertion("", sp));
@@ -46,6 +56,7 @@ public class DictionaryInfoUtilsTests extends AndroidTestCase {
assertFalse(DictionaryInfoUtils.looksValidForDictionaryInsertion("!!!", sp));
}
+ @Test
public void testGetMainDictId() {
assertEquals("main:en",
DictionaryInfoUtils.getMainDictId(LocaleUtils.constructLocaleFromString("en")));
diff --git a/tests/src/com/android/inputmethod/latin/utils/ExecutorUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/ExecutorUtilsTests.java
index 86923059b..6118ad812 100644
--- a/tests/src/com/android/inputmethod/latin/utils/ExecutorUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/ExecutorUtilsTests.java
@@ -16,24 +16,31 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import static org.junit.Assert.assertEquals;
+
+import android.support.test.filters.MediumTest;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Unit tests for {@link ExecutorUtils}.
*/
@MediumTest
-public class ExecutorUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class ExecutorUtilsTests {
private static final String TAG = ExecutorUtilsTests.class.getSimpleName();
private static final int NUM_OF_TASKS = 10;
private static final int DELAY_FOR_WAITING_TASKS_MILLISECONDS = 500;
+ @Test
public void testExecute() {
final ExecutorService executor =
ExecutorUtils.getBackgroundExecutor(ExecutorUtils.KEYBOARD);
diff --git a/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java
index df0180729..8c004bf8a 100644
--- a/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java
@@ -17,32 +17,39 @@
package com.android.inputmethod.latin.utils;
import static com.android.inputmethod.latin.utils.ImportantNoticeUtils.KEY_TIMESTAMP_OF_CONTACTS_NOTICE;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.SharedPreferences;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.text.TextUtils;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.MediumTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.settings.SettingsValues;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.util.concurrent.TimeUnit;
-
@MediumTest
-public class ImportantNoticeUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class ImportantNoticeUtilsTests {
private ImportantNoticePreferences mImportantNoticePreferences;
@Mock private SettingsValues mMockSettingsValues;
+ private Context getContext() {
+ return InstrumentationRegistry.getTargetContext();
+ }
+
private static class ImportantNoticePreferences {
private final SharedPreferences mPref;
- private Integer mVersion;
private Long mLastTime;
public ImportantNoticePreferences(final Context context) {
@@ -96,21 +103,20 @@ public class ImportantNoticeUtilsTests extends AndroidTestCase {
}
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mImportantNoticePreferences = new ImportantNoticePreferences(getContext());
mImportantNoticePreferences.save();
when(mMockSettingsValues.isPersonalizationEnabled()).thenReturn(true);
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ @After
+ public void tearDown() throws Exception {
mImportantNoticePreferences.restore();
}
+ @Test
public void testPersonalizationSetting() {
mImportantNoticePreferences.clear();
diff --git a/tests/src/com/android/inputmethod/latin/utils/JsonUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/JsonUtilsTests.java
index 194112070..a9e40a7a4 100644
--- a/tests/src/com/android/inputmethod/latin/utils/JsonUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/JsonUtilsTests.java
@@ -16,14 +16,21 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import java.util.Arrays;
import java.util.List;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class JsonUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class JsonUtilsTests {
+ @Test
public void testJsonUtils() {
final Object[] objs = new Object[] { 1, "aaa", "bbb", 3 };
final List<Object> objArray = Arrays.asList(objs);
diff --git a/tests/src/com/android/inputmethod/latin/utils/LanguageOnSpacebarUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/LanguageOnSpacebarUtilsTests.java
index e4b6a668c..972b78345 100644
--- a/tests/src/com/android/inputmethod/latin/utils/LanguageOnSpacebarUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/LanguageOnSpacebarUtilsTests.java
@@ -19,10 +19,12 @@ package com.android.inputmethod.latin.utils;
import static com.android.inputmethod.latin.utils.LanguageOnSpacebarUtils.FORMAT_TYPE_FULL_LOCALE;
import static com.android.inputmethod.latin.utils.LanguageOnSpacebarUtils.FORMAT_TYPE_LANGUAGE_ONLY;
import static com.android.inputmethod.latin.utils.LanguageOnSpacebarUtils.FORMAT_TYPE_NONE;
+import static org.junit.Assert.assertEquals;
import android.content.Context;
-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 android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.latin.RichInputMethodManager;
@@ -36,8 +38,13 @@ import java.util.Locale;
import javax.annotation.Nonnull;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class LanguageOnSpacebarUtilsTests {
private RichInputMethodManager mRichImm;
RichInputMethodSubtype EN_US_QWERTY;
@@ -50,10 +57,9 @@ public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
RichInputMethodSubtype IW_HEBREW;
RichInputMethodSubtype ZZ_QWERTY;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- final Context context = getContext();
+ @Before
+ public void setUp() throws Exception {
+ final Context context = InstrumentationRegistry.getTargetContext();
RichInputMethodManager.init(context);
mRichImm = RichInputMethodManager.getInstance();
@@ -99,6 +105,7 @@ public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
LanguageOnSpacebarUtils.getLanguageOnSpacebarFormatType(subtype));
}
+ @Test
public void testOneSubtypeImplicitlyEnabled() {
enableSubtypes(EN_US_QWERTY);
assertFormatType(EN_US_QWERTY, true, Locale.US, FORMAT_TYPE_NONE);
@@ -113,6 +120,7 @@ public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
assertFormatType(FR_CA_QWERTY, true, Locale.CANADA_FRENCH, FORMAT_TYPE_NONE);
}
+ @Test
public void testOneSubtypeExplicitlyEnabled() {
enableSubtypes(EN_US_QWERTY);
assertFormatType(EN_US_QWERTY, false, Locale.UK, FORMAT_TYPE_LANGUAGE_ONLY);
@@ -131,6 +139,7 @@ public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
assertFormatType(FR_CA_QWERTY, false, Locale.FRANCE, FORMAT_TYPE_LANGUAGE_ONLY);
}
+ @Test
public void testOneSubtypeImplicitlyEnabledWithNoLanguageSubtype() {
final Locale Locale_IW = new Locale("iw");
enableSubtypes(IW_HEBREW, ZZ_QWERTY);
@@ -140,6 +149,7 @@ public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
assertFormatType(ZZ_QWERTY, true, Locale_IW, FORMAT_TYPE_FULL_LOCALE);
}
+ @Test
public void testTwoSubtypesExplicitlyEnabled() {
enableSubtypes(EN_US_QWERTY, FR_AZERTY);
assertFormatType(EN_US_QWERTY, false, Locale.US, FORMAT_TYPE_LANGUAGE_ONLY);
@@ -157,6 +167,7 @@ public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
}
+ @Test
public void testMultiSubtypeWithSameLanuageAndSameLayout() {
// Explicitly enable en_US, en_GB, fr_FR, and no language keyboards.
enableSubtypes(EN_US_QWERTY, EN_GB_QWERTY, FR_CA_QWERTY, ZZ_QWERTY);
@@ -172,6 +183,7 @@ public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
assertFormatType(ZZ_QWERTY, false, Locale.JAPAN, FORMAT_TYPE_FULL_LOCALE);
}
+ @Test
public void testMultiSubtypesWithSameLanguageButHaveDifferentLayout() {
enableSubtypes(FR_AZERTY, FR_CA_QWERTY, FR_CH_SWISS, FR_CH_QWERTZ);
@@ -191,6 +203,7 @@ public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
assertFormatType(FR_CH_QWERTZ, false, Locale.JAPAN, FORMAT_TYPE_LANGUAGE_ONLY);
}
+ @Test
public void testMultiSubtypesWithSameLanguageAndMayHaveSameLayout() {
enableSubtypes(FR_AZERTY, FR_CA_QWERTY, FR_CH_SWISS, FR_CH_QWERTY, FR_CH_QWERTZ);
diff --git a/tests/src/com/android/inputmethod/latin/utils/RecapitalizeStatusTests.java b/tests/src/com/android/inputmethod/latin/utils/RecapitalizeStatusTests.java
index 9b826839f..8224272a6 100644
--- a/tests/src/com/android/inputmethod/latin/utils/RecapitalizeStatusTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/RecapitalizeStatusTests.java
@@ -16,17 +16,24 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.common.Constants;
import java.util.Locale;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class RecapitalizeStatusTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class RecapitalizeStatusTests {
private static final int[] SPACE = { Constants.CODE_SPACE };
+ @Test
public void testTrim() {
final RecapitalizeStatus status = new RecapitalizeStatus();
status.start(30, 40, "abcdefghij", Locale.ENGLISH, SPACE);
@@ -54,6 +61,7 @@ public class RecapitalizeStatusTests extends AndroidTestCase {
assertEquals(43, status.getNewCursorEnd());
}
+ @Test
public void testRotate() {
final RecapitalizeStatus status = new RecapitalizeStatus();
status.start(29, 40, "abcd efghij", Locale.ENGLISH, SPACE);
diff --git a/tests/src/com/android/inputmethod/latin/utils/ResourceUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/ResourceUtilsTests.java
index 8e764e40f..ac05d3c31 100644
--- a/tests/src/com/android/inputmethod/latin/utils/ResourceUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/ResourceUtilsTests.java
@@ -16,13 +16,22 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import java.util.HashMap;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class ResourceUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class ResourceUtilsTests {
+ @Test
public void testFindConstantForKeyValuePairsSimple() {
final HashMap<String,String> anyKeyValue = new HashMap<>();
anyKeyValue.put("anyKey", "anyValue");
@@ -69,6 +78,7 @@ public class ResourceUtilsTests extends AndroidTestCase {
assertNull(ResourceUtils.findConstantForKeyValuePairs(emptyKeyValue, array));
}
+ @Test
public void testFindConstantForKeyValuePairsCombined() {
final String HARDWARE_KEY = "HARDWARE";
final String MODEL_KEY = "MODEL";
@@ -113,6 +123,7 @@ public class ResourceUtilsTests extends AndroidTestCase {
assertEquals("0.2", ResourceUtils.findConstantForKeyValuePairs(keyValues, failArray));
}
+ @Test
public void testFindConstantForKeyValuePairsRegexp() {
final String HARDWARE_KEY = "HARDWARE";
final String MODEL_KEY = "MODEL";
diff --git a/tests/src/com/android/inputmethod/latin/utils/SpannableStringUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/SpannableStringUtilsTests.java
index 665d81ccd..9a6b8629c 100644
--- a/tests/src/com/android/inputmethod/latin/utils/SpannableStringUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/SpannableStringUtilsTests.java
@@ -16,8 +16,13 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import android.text.style.SuggestionSpan;
import android.text.style.URLSpan;
import android.text.SpannableString;
@@ -25,8 +30,18 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.SpannedString;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class SpannableStringUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class SpannableStringUtilsTests {
+
+ private Context getContext() {
+ return InstrumentationRegistry.getTargetContext();
+ }
+
+ @Test
public void testConcatWithSuggestionSpansOnly() {
SpannableStringBuilder s = new SpannableStringBuilder("test string\ntest string\n"
+ "test string\ntest string\ntest string\ntest string\ntest string\ntest string\n"
@@ -87,6 +102,7 @@ public class SpannableStringUtilsTests extends AndroidTestCase {
assertTrue(false);
}
+ @Test
public void testSplitCharSequenceWithSpan() {
// text: " a bcd efg hij "
// span1: ^^^^^^^
@@ -182,6 +198,7 @@ public class SpannableStringUtilsTests extends AndroidTestCase {
assertSpanCount(0, charSequencesFromSpanned[6]);
}
+ @Test
public void testSplitCharSequencePreserveTrailingEmptySegmengs() {
assertEquals(1, SpannableStringUtils.split("", " ",
false /* preserveTrailingEmptySegmengs */).length);
diff --git a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java
index 2297cacf8..8e47f3ae4 100644
--- a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java
@@ -16,10 +16,16 @@
package com.android.inputmethod.latin.utils;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
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 android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
@@ -30,8 +36,14 @@ import com.android.inputmethod.latin.RichInputMethodSubtype;
import java.util.ArrayList;
import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
-public class SubtypeLocaleUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class SubtypeLocaleUtilsTests {
// All input method subtypes of LatinIME.
private final ArrayList<RichInputMethodSubtype> mSubtypesList = new ArrayList<>();
@@ -64,10 +76,9 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
InputMethodSubtype HI_LATN_DVORAK; // Hinglis Dvorak
InputMethodSubtype SR_LATN_QWERTY; // Serbian Latin Qwerty
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- final Context context = getContext();
+ @Before
+ public void setUp() throws Exception {
+ final Context context = InstrumentationRegistry.getTargetContext();
mRes = context.getResources();
RichInputMethodManager.init(context);
mRichImm = RichInputMethodManager.getInstance();
@@ -136,13 +147,13 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
}
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
// Restore additional subtypes.
mRichImm.setAdditionalInputMethodSubtypes(mSavedAddtionalSubtypes);
- super.tearDown();
}
+ @Test
public void testAllFullDisplayName() {
for (final RichInputMethodSubtype subtype : mSubtypesList) {
final String subtypeName = SubtypeLocaleUtils
@@ -159,6 +170,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
}
}
+ @Test
public void testKeyboardLayoutSetName() {
assertEquals("en_US", "qwerty", SubtypeLocaleUtils.getKeyboardLayoutSetName(EN_US));
assertEquals("en_GB", "qwerty", SubtypeLocaleUtils.getKeyboardLayoutSetName(EN_GB));
@@ -223,6 +235,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
// sr_ZZ qwerty T Serbian (QWERTY) exception
// zz pc T Alphabet (PC)
+ @Test
public void testPredefinedSubtypesInEnglishSystemLocale() {
final RunInLocale<Void> tests = new RunInLocale<Void>() {
@Override
@@ -264,6 +277,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
tests.runInLocale(mRes, Locale.ENGLISH);
}
+ @Test
public void testAdditionalSubtypesInEnglishSystemLocale() {
final RunInLocale<Void> tests = new RunInLocale<Void>() {
@Override
@@ -323,6 +337,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
// sr_ZZ qwerty T Serbe (QWERTY) exception
// zz pc T Alphabet latin (PC)
+ @Test
public void testPredefinedSubtypesInFrenchSystemLocale() {
final RunInLocale<Void> tests = new RunInLocale<Void>() {
@Override
@@ -364,6 +379,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
tests.runInLocale(mRes, Locale.FRENCH);
}
+ @Test
public void testAdditionalSubtypesInFrenchSystemLocale() {
final RunInLocale<Void> tests = new RunInLocale<Void>() {
@Override
@@ -405,6 +421,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
// hi_ZZ qwerty F हिंग्लिश
// hi_ZZ dvorak T हिंग्लिश (Dvorak)
+ @Test
public void testHinglishSubtypesInHindiSystemLocale() {
final RunInLocale<Void> tests = new RunInLocale<Void>() {
@Override
@@ -432,6 +449,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
// sr_ZZ serbian_qwertz F Српски (латиница)
// sr_ZZ qwerty T Српски (QWERTY)
+ @Test
public void testSerbianLatinSubtypesInSerbianSystemLocale() {
final RunInLocale<Void> tests = new RunInLocale<Void>() {
@Override
@@ -451,6 +469,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase {
tests.runInLocale(mRes, new Locale("sr"));
}
+ @Test
public void testIsRtlLanguage() {
// Known Right-to-Left language subtypes.
final InputMethodSubtype ARABIC = mRichImm