aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java17
-rw-r--r--tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java24
-rw-r--r--tests/src/com/android/inputmethod/compat/TextInfoCompatUtilsTests.java14
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardLayoutTest.java10
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java42
-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.java27
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/MatrixUtilsTests.java33
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecSplitTests.java33
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecStringReferenceTests.java39
-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.java49
-rw-r--r--tests/src/com/android/inputmethod/latin/ContactsContentObserverTest.java6
-rw-r--r--tests/src/com/android/inputmethod/latin/ContactsDictionaryUtilsTest.java5
-rw-r--r--tests/src/com/android/inputmethod/latin/ContactsManagerTest.java25
-rw-r--r--tests/src/com/android/inputmethod/latin/DictionaryFacilitatorLruCacheTests.java20
-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.java41
-rw-r--r--tests/src/com/android/inputmethod/latin/RichInputMethodSubtypeTests.java40
-rw-r--r--tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java20
-rw-r--r--tests/src/com/android/inputmethod/latin/WordComposerTests.java16
-rw-r--r--tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java34
-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.java15
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java677
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictUtils.java80
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java279
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java133
-rw-r--r--tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java23
-rw-r--r--tests/src/com/android/inputmethod/latin/network/HttpUrlConnectionBuilderTests.java35
-rw-r--r--tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java47
-rw-r--r--tests/src/com/android/inputmethod/latin/settings/AccountsSettingsFragmentTests.java49
-rw-r--r--tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java41
-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.java27
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/AsyncResultHolderTests.java17
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java18
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java18
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/DictionaryInfoUtilsTests.java20
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/ExecutorUtilsTests.java14
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java34
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/JsonUtilsTests.java13
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/LanguageOnSpacebarUtilsTests.java29
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/RecapitalizeStatusTests.java14
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/ResourceUtilsTests.java16
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/SpannableStringUtilsTests.java28
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java40
55 files changed, 2601 insertions, 863 deletions
diff --git a/tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java b/tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java
index 67e76464b..6203238b8 100644
--- a/tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java
+++ b/tests/src/com/android/inputmethod/compat/LocaleSpanCompatUtilsTests.java
@@ -16,18 +16,28 @@
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.text.SpannableString;
import android.text.Spanned;
import android.text.style.StyleSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Locale;
@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 +71,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..a0544d62a 100644
--- a/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
+++ b/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
@@ -16,17 +16,26 @@
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.text.Spanned;
import android.text.TextUtils;
import android.text.style.SuggestionSpan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
@@ -34,7 +43,12 @@ import java.util.Locale;
import javax.annotation.Nullable;
@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 +105,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 +122,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 +137,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 +235,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..d4dbfd4c6 100644
--- a/tests/src/com/android/inputmethod/compat/TextInfoCompatUtilsTests.java
+++ b/tests/src/com/android/inputmethod/compat/TextInfoCompatUtilsTests.java
@@ -16,10 +16,10 @@
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.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
@@ -27,10 +27,17 @@ import android.text.style.StyleSpan;
import android.text.style.URLSpan;
import android.view.textservice.TextInfo;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Arrays;
@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..ddace1a38 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 java.util.ArrayList;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
@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..2f8140e23 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
@@ -21,17 +21,30 @@ 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 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.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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Arrays;
@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 +52,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 +126,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 +147,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
assertKeyboardThemePreference(sdkVersion, THEME_ID_ILLEGAL, defaultThemeId);
}
+ @Test
public void testKeyboardThemePreferenceOnLxx() {
assertKeyboardThemePreferenceOnLxx(Build.VERSION_CODES.LOLLIPOP);
}
@@ -165,6 +183,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 +202,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 +251,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 +271,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
// Upgrading keyboard on L.
+ @Test
public void testUpgradeKeyboardToLxxOnLxx() {
assertUpgradeKeyboardToLxxOnLxx(Build.VERSION_CODES.LOLLIPOP);
}
@@ -293,6 +315,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 +341,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 +352,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 +389,12 @@ public class KeyboardThemeTests extends AndroidTestCase {
}
}
+ @Test
public void testSortedKeyboardTheme() {
assertSortedKeyboardThemeArray(KeyboardTheme.KEYBOARD_THEMES);
}
+ @Test
public void testSortedAvailableKeyboardTheme() {
assertSortedKeyboardThemeArray(KeyboardTheme.getAvailableThemeArray(getContext()));
}
@@ -384,6 +411,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 +427,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 +443,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..90963d4ca 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 androidx.test.filters.MediumTest;
+import androidx.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..3c5c298f6 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 androidx.test.filters.MediumTest;
+import androidx.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..1d28c2295 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 androidx.test.filters.MediumTest;
+import androidx.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..a1ee199c0 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 androidx.test.filters.SmallTest;
+import androidx.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..f312cadae 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSetTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSetTests.java
@@ -16,28 +16,41 @@
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.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.latin.RichInputMethodManager;
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
@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 +67,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 +94,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..10c552f29 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/MatrixUtilsTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/MatrixUtilsTests.java
@@ -16,25 +16,25 @@
package com.android.inputmethod.keyboard.internal;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.keyboard.internal.MatrixUtils.MatrixOperationFailedException;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+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 +47,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 +78,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..cbedd0426 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecSplitTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecSplitTests.java
@@ -16,26 +16,34 @@
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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.R;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Arrays;
import java.util.Locale;
@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 +98,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 +108,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 +138,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 +174,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 +190,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 +210,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 +233,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..3655abbd5 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecStringReferenceTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecStringReferenceTests.java
@@ -16,26 +16,34 @@
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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.tests.R;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Locale;
@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 +67,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 +93,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 +101,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 +134,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"\\\\a");
}
+ @Test
public void testSplitResourceSingleEscaped() {
assertTextArray("Escaped char",
"!string/escaped_char", "\\a");
@@ -146,6 +162,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 +175,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 +197,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 +222,7 @@ public class MoreKeySpecStringReferenceTests extends InstrumentationTestCase {
"abcabc", "def", "ghi");
}
+ @Test
public void testSplitIndirectReference() {
assertTextArray("Indirect",
"!string/indirect_string", "a", "b", "c");
@@ -212,11 +232,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 +247,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..6ab1549c0 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 androidx.test.filters.SmallTest;
+import androidx.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..39da3ec71 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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.keyboard.internal.MatrixUtils.MatrixOperationFailedException;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+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..db8b80949 100644
--- a/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java
+++ b/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java
@@ -16,11 +16,18 @@
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.text.TextUtils;
import android.util.Pair;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.latin.NgramContext.WordInfo;
import com.android.inputmethod.latin.common.CodePointUtils;
import com.android.inputmethod.latin.common.FileUtils;
@@ -30,6 +37,11 @@ import com.android.inputmethod.latin.makedict.WeightedString;
import com.android.inputmethod.latin.makedict.WordProperty;
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -39,26 +51,25 @@ import java.util.Locale;
import java.util.Random;
@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 +93,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 +117,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 +133,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
binaryDictionary.close();
}
+ @Test
public void testConstructingDictionaryOnMemory() {
final File dictFile = createEmptyDictionaryAndGetFile(FormatSpec.VERSION403);
FileUtils.deleteRecursively(dictFile);
@@ -142,6 +155,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 +223,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 +251,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 +274,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testAddBigramWords() {
final BinaryDictionary binaryDictionary = getEmptyBinaryDictionary(FormatSpec.VERSION403);
@@ -311,6 +328,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
getBigramProbability(binaryDictionary, "abcde", "fghij"));
}
+ @Test
public void testRandomlyAddBigramWords() {
final int wordCount = 100;
final int bigramCount = 1000;
@@ -357,6 +375,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testAddTrigramWords() {
final BinaryDictionary binaryDictionary = getEmptyBinaryDictionary(FormatSpec.VERSION403);
final int unigramProbability = 100;
@@ -383,6 +402,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 +437,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
binaryDictionary.close();
}
+ @Test
public void testFlushWithGCDictionary() {
final File dictFile = createEmptyDictionaryAndGetFile(FormatSpec.VERSION403);
BinaryDictionary binaryDictionary = getBinaryDictionary(dictFile);
@@ -447,6 +468,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
binaryDictionary.close();
}
+ @Test
public void testAddBigramWordsAndFlashWithGC() {
final int wordCount = 100;
final int bigramCount = 1000;
@@ -499,6 +521,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testRandomOperationsAndFlashWithGC() {
final int maxUnigramCount = 5000;
final int maxBigramCount = 10000;
@@ -593,6 +616,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testAddManyUnigramsAndFlushWithGC() {
final int flashWithGCIterationCount = 3;
final int codePointSetSize = 50;
@@ -628,6 +652,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testUnigramAndBigramCount() {
final int maxUnigramCount = 5000;
final int maxBigramCount = 10000;
@@ -684,6 +709,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testGetWordProperties() {
final long seed = System.currentTimeMillis();
final Random random = new Random(seed);
@@ -769,6 +795,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testIterateAllWords() {
final long seed = System.currentTimeMillis();
final Random random = new Random(seed);
@@ -852,6 +879,7 @@ public class BinaryDictionaryTests extends AndroidTestCase {
assertTrue(bigramSet.isEmpty());
}
+ @Test
public void testPossiblyOffensiveAttributeMaintained() {
final BinaryDictionary binaryDictionary =
getEmptyBinaryDictionary(FormatSpec.VERSION403);
@@ -860,6 +888,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..029e1b506 100644
--- a/tests/src/com/android/inputmethod/latin/ContactsContentObserverTest.java
+++ b/tests/src/com/android/inputmethod/latin/ContactsContentObserverTest.java
@@ -24,11 +24,14 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.provider.ContactsContract.Contacts;
-import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.filters.SmallTest;
+import androidx.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 +41,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..a00c9dfdd 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 androidx.test.filters.SmallTest;
+import androidx.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..d3d746df5 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,17 +27,20 @@ import android.database.MatrixCursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
-import android.test.AndroidTestCase;
import android.test.RenamingDelegatingContext;
import android.test.mock.MockContentProvider;
import android.test.mock.MockContentResolver;
-import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.ContactsDictionaryConstants;
import com.android.inputmethod.latin.ContactsManager;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.HashMap;
@@ -43,14 +50,16 @@ import java.util.concurrent.TimeUnit;
* 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 +68,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 +123,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..f8130f33c 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 java.util.Locale;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Locale;
@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..505818439 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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
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 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..ac38468f9 100644
--- a/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java
+++ b/tests/src/com/android/inputmethod/latin/RichInputConnectionAndTextRangeTests.java
@@ -16,12 +16,13 @@
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.text.SpannableString;
import android.text.TextUtils;
import android.text.style.SuggestionSpan;
@@ -30,6 +31,10 @@ import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.common.StringUtils;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
@@ -38,25 +43,29 @@ import com.android.inputmethod.latin.utils.RunInLocale;
import com.android.inputmethod.latin.utils.ScriptUtils;
import com.android.inputmethod.latin.utils.TextRange;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Locale;
@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 +165,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 +228,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 +293,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 +321,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 +333,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 +346,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 +358,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 +370,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 +384,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..578e6bea0 100644
--- a/tests/src/com/android/inputmethod/latin/RichInputMethodSubtypeTests.java
+++ b/tests/src/com/android/inputmethod/latin/RichInputMethodSubtypeTests.java
@@ -16,13 +16,20 @@
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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.RichInputMethodManager;
import com.android.inputmethod.latin.RichInputMethodSubtype;
@@ -30,11 +37,17 @@ import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils;
import com.android.inputmethod.latin.utils.RunInLocale;
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Locale;
@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 +80,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 +164,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 +186,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 +306,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..92bff0e2e 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 androidx.test.filters.SmallTest;
+import androidx.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..4ac094b25 100644
--- a/tests/src/com/android/inputmethod/latin/WordComposerTests.java
+++ b/tests/src/com/android/inputmethod/latin/WordComposerTests.java
@@ -16,18 +16,28 @@
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 androidx.test.filters.SmallTest;
+import androidx.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.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..86f453b08 100644
--- a/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java
+++ b/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java
@@ -16,40 +16,55 @@
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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.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 +73,7 @@ public class AccountsChangedReceiverTests extends AndroidTestCase {
assertAccountName(ACCOUNT_1);
}
+ @Test
public void testAccountRemoved() {
updateAccountName(ACCOUNT_1);
AccountsChangedReceiver reciever = new AccountsChangedReceiver() {
@@ -71,6 +87,7 @@ public class AccountsChangedReceiverTests extends AndroidTestCase {
assertAccountName(null);
}
+ @Test
public void testAccountRemoved_noAccounts() {
updateAccountName(ACCOUNT_2);
AccountsChangedReceiver reciever = new AccountsChangedReceiver() {
@@ -84,6 +101,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..29abec365 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 androidx.test.filters.SmallTest;
+import androidx.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..5151b6b2b 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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Arrays;
@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..36a4b912d 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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Locale;
@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..adfbbf418 100644
--- a/tests/src/com/android/inputmethod/latin/common/UnicodeSurrogateTests.java
+++ b/tests/src/com/android/inputmethod/latin/common/UnicodeSurrogateTests.java
@@ -16,18 +16,27 @@
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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+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/makedict/BinaryDictDecoderEncoderTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
new file mode 100644
index 000000000..39da9fcd6
--- /dev/null
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
@@ -0,0 +1,677 @@
+/*
+ * Copyright (C) 2012 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.makedict;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.util.Log;
+import android.util.Pair;
+import android.util.SparseArray;
+
+import com.android.inputmethod.latin.BinaryDictionary;
+import com.android.inputmethod.latin.common.CodePointUtils;
+import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.CharEncoding;
+import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.DictBuffer;
+import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
+import com.android.inputmethod.latin.makedict.FusionDictionary.PtNode;
+import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray;
+import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
+import com.android.inputmethod.latin.utils.ByteArrayDictBuffer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * Unit tests for BinaryDictDecoderUtils and BinaryDictEncoderUtils.
+ */
+@LargeTest
+public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
+ private static final String TAG = BinaryDictDecoderEncoderTests.class.getSimpleName();
+ private static final int DEFAULT_MAX_UNIGRAMS = 300;
+ private static final int DEFAULT_CODE_POINT_SET_SIZE = 50;
+ private static final int LARGE_CODE_POINT_SET_SIZE = 300;
+ private static final int UNIGRAM_FREQ = 10;
+ private static final int BIGRAM_FREQ = 50;
+ private static final int TOLERANCE_OF_BIGRAM_FREQ = 5;
+
+ private static final ArrayList<String> sWords = new ArrayList<>();
+ private static final ArrayList<String> sWordsWithVariousCodePoints = new ArrayList<>();
+ private static final SparseArray<List<Integer>> sEmptyBigrams = new SparseArray<>();
+ private static final SparseArray<List<Integer>> sStarBigrams = new SparseArray<>();
+ private static final SparseArray<List<Integer>> sChainBigrams = new SparseArray<>();
+
+ final Random mRandom;
+
+ public BinaryDictDecoderEncoderTests() {
+ this(System.currentTimeMillis(), DEFAULT_MAX_UNIGRAMS);
+ }
+
+ public BinaryDictDecoderEncoderTests(final long seed, final int maxUnigrams) {
+ super();
+ BinaryDictionaryUtils.setCurrentTimeForTest(0);
+ Log.e(TAG, "Testing dictionary: seed is " + seed);
+ mRandom = new Random(seed);
+ sWords.clear();
+ sWordsWithVariousCodePoints.clear();
+ generateWords(maxUnigrams, mRandom);
+
+ for (int i = 0; i < sWords.size(); ++i) {
+ sChainBigrams.put(i, new ArrayList<Integer>());
+ if (i > 0) {
+ sChainBigrams.get(i - 1).add(i);
+ }
+ }
+
+ sStarBigrams.put(0, new ArrayList<Integer>());
+ // MAX - 1 because we added one above already
+ final int maxBigrams = Math.min(sWords.size(), FormatSpec.MAX_BIGRAMS_IN_A_PTNODE - 1);
+ for (int i = 1; i < maxBigrams; ++i) {
+ sStarBigrams.get(0).add(i);
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ BinaryDictionaryUtils.setCurrentTimeForTest(0);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ // Quit test mode.
+ BinaryDictionaryUtils.setCurrentTimeForTest(-1);
+ super.tearDown();
+ }
+
+ private static void generateWords(final int number, final Random random) {
+ final int[] codePointSet = CodePointUtils.generateCodePointSet(DEFAULT_CODE_POINT_SET_SIZE,
+ random);
+ final Set<String> wordSet = new HashSet<>();
+ while (wordSet.size() < number) {
+ wordSet.add(CodePointUtils.generateWord(random, codePointSet));
+ }
+ sWords.addAll(wordSet);
+
+ final int[] largeCodePointSet = CodePointUtils.generateCodePointSet(
+ LARGE_CODE_POINT_SET_SIZE, random);
+ wordSet.clear();
+ while (wordSet.size() < number) {
+ wordSet.add(CodePointUtils.generateWord(random, largeCodePointSet));
+ }
+ sWordsWithVariousCodePoints.addAll(wordSet);
+ }
+
+ /**
+ * Adds unigrams to the dictionary.
+ */
+ private static void addUnigrams(final int number, final FusionDictionary dict,
+ final List<String> words) {
+ for (int i = 0; i < number; ++i) {
+ final String word = words.get(i);
+ final ArrayList<WeightedString> shortcuts = new ArrayList<>();
+ dict.add(word, new ProbabilityInfo(UNIGRAM_FREQ), false /* isNotAWord */,
+ false /* isPossiblyOffensive */);
+ }
+ }
+
+ private static void addBigrams(final FusionDictionary dict,
+ final List<String> words,
+ final SparseArray<List<Integer>> bigrams) {
+ for (int i = 0; i < bigrams.size(); ++i) {
+ final int w1 = bigrams.keyAt(i);
+ for (int w2 : bigrams.valueAt(i)) {
+ dict.setBigram(words.get(w1), words.get(w2), new ProbabilityInfo(BIGRAM_FREQ));
+ }
+ }
+ }
+
+// The following is useful to dump the dictionary into a textual file, but it can't compile
+// on-device, so it's commented out.
+// private void dumpToCombinedFileForDebug(final FusionDictionary dict, final String filename)
+// throws IOException {
+// com.android.inputmethod.latin.dicttool.CombinedInputOutput.writeDictionaryCombined(
+// new java.io.FileWriter(new File(filename)), dict);
+// }
+
+ private static long timeWritingDictToFile(final File file, final FusionDictionary dict,
+ final FormatSpec.FormatOptions formatOptions) {
+
+ long now = -1, diff = -1;
+
+ try {
+ final DictEncoder dictEncoder = BinaryDictUtils.getDictEncoder(file, formatOptions);
+
+ now = System.currentTimeMillis();
+ // If you need to dump the dict to a textual file, uncomment the line below and the
+ // function above
+ // dumpToCombinedFileForDebug(file, "/tmp/foo");
+ dictEncoder.writeDictionary(dict, formatOptions);
+ diff = System.currentTimeMillis() - now;
+ } catch (IOException e) {
+ Log.e(TAG, "IO exception while writing file", e);
+ } catch (UnsupportedFormatException e) {
+ Log.e(TAG, "UnsupportedFormatException", e);
+ }
+
+ return diff;
+ }
+
+ private static void checkDictionary(final FusionDictionary dict, final List<String> words,
+ final SparseArray<List<Integer>> bigrams) {
+ assertNotNull(dict);
+
+ // check unigram
+ for (final String word : words) {
+ final PtNode ptNode = FusionDictionary.findWordInTree(dict.mRootNodeArray, word);
+ assertNotNull(ptNode);
+ }
+
+ // check bigram
+ for (int i = 0; i < bigrams.size(); ++i) {
+ final int w1 = bigrams.keyAt(i);
+ for (final int w2 : bigrams.valueAt(i)) {
+ final PtNode ptNode = FusionDictionary.findWordInTree(dict.mRootNodeArray,
+ words.get(w1));
+ assertNotNull(words.get(w1) + "," + words.get(w2), ptNode.getBigram(words.get(w2)));
+ }
+ }
+ }
+
+ private static String outputOptions(final int bufferType,
+ final FormatSpec.FormatOptions formatOptions) {
+ final String result = " : buffer type = "
+ + ((bufferType == BinaryDictUtils.USE_BYTE_BUFFER) ? "byte buffer" : "byte array");
+ return result + " : version = " + formatOptions.mVersion;
+ }
+
+ // Tests for readDictionaryBinary and writeDictionaryBinary
+
+ private static long timeReadingAndCheckDict(final File file, final List<String> words,
+ final SparseArray<List<Integer>> bigrams, final int bufferType) {
+ long now, diff = -1;
+
+ FusionDictionary dict = null;
+ try {
+ final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length(),
+ bufferType);
+ now = System.currentTimeMillis();
+ dict = dictDecoder.readDictionaryBinary(false /* deleteDictIfBroken */);
+ diff = System.currentTimeMillis() - now;
+ } catch (IOException e) {
+ Log.e(TAG, "IOException while reading dictionary", e);
+ } catch (UnsupportedFormatException e) {
+ Log.e(TAG, "Unsupported format", e);
+ }
+
+ checkDictionary(dict, words, bigrams);
+ return diff;
+ }
+
+ // Tests for readDictionaryBinary and writeDictionaryBinary
+ private String runReadAndWrite(final List<String> words,
+ final SparseArray<List<Integer>> bigrams,
+ final int bufferType, final FormatSpec.FormatOptions formatOptions,
+ final String message) {
+
+ final String dictName = "runReadAndWrite";
+ final String dictVersion = Long.toString(System.currentTimeMillis());
+ final File file = BinaryDictUtils.getDictFile(dictName, dictVersion, formatOptions,
+ getContext().getCacheDir());
+
+ final FusionDictionary dict = new FusionDictionary(new PtNodeArray(),
+ BinaryDictUtils.makeDictionaryOptions(dictName, dictVersion, formatOptions));
+ addUnigrams(words.size(), dict, words);
+ addBigrams(dict, words, bigrams);
+ checkDictionary(dict, words, bigrams);
+
+ final long write = timeWritingDictToFile(file, dict, formatOptions);
+ final long read = timeReadingAndCheckDict(file, words, bigrams, bufferType);
+
+ return "PROF: read=" + read + "ms, write=" + write + "ms :" + message
+ + " : " + outputOptions(bufferType, formatOptions);
+ }
+
+ private void runReadAndWriteTests(final List<String> results, final int bufferType,
+ final FormatSpec.FormatOptions formatOptions) {
+ results.add(runReadAndWrite(sWords, sEmptyBigrams, bufferType,
+ formatOptions, "unigram"));
+ results.add(runReadAndWrite(sWords, sChainBigrams, bufferType,
+ formatOptions, "chain"));
+ results.add(runReadAndWrite(sWords, sStarBigrams, bufferType,
+ formatOptions, "star"));
+ results.add(runReadAndWrite(sWords, sEmptyBigrams, bufferType, formatOptions,
+ "unigram with shortcuts"));
+ results.add(runReadAndWrite(sWords, sChainBigrams, bufferType, formatOptions,
+ "chain with shortcuts"));
+ results.add(runReadAndWrite(sWords, sStarBigrams, bufferType, formatOptions,
+ "star with shortcuts"));
+ results.add(runReadAndWrite(sWordsWithVariousCodePoints, sEmptyBigrams,
+ bufferType, formatOptions,
+ "unigram with various code points"));
+ }
+
+ public void testCharacterTableIsPresent() throws IOException, UnsupportedFormatException {
+ final String[] wordSource = {"words", "used", "for", "testing", "a", "code point", "table"};
+ final List<String> words = Arrays.asList(wordSource);
+ final String correctCodePointTable = "toesdrniawuplgfcb ";
+ final String dictName = "codePointTableTest";
+ final String dictVersion = Long.toString(System.currentTimeMillis());
+ final String codePointTableAttribute = DictionaryHeader.CODE_POINT_TABLE_KEY;
+ final File file = BinaryDictUtils.getDictFile(dictName, dictVersion,
+ BinaryDictUtils.STATIC_OPTIONS, getContext().getCacheDir());
+
+ // Write a test dictionary
+ final DictEncoder dictEncoder = new Ver2DictEncoder(file,
+ Ver2DictEncoder.CODE_POINT_TABLE_ON);
+ final FormatSpec.FormatOptions formatOptions =
+ new FormatSpec.FormatOptions(
+ FormatSpec.MINIMUM_SUPPORTED_STATIC_VERSION);
+ final FusionDictionary sourcedict = new FusionDictionary(new PtNodeArray(),
+ BinaryDictUtils.makeDictionaryOptions(dictName, dictVersion, formatOptions));
+ addUnigrams(words.size(), sourcedict, words);
+ dictEncoder.writeDictionary(sourcedict, formatOptions);
+
+ // Read the dictionary
+ final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length(),
+ DictDecoder.USE_BYTEARRAY);
+ final DictionaryHeader fileHeader = dictDecoder.readHeader();
+ // Check if codePointTable is present
+ assertTrue("codePointTable is not present",
+ fileHeader.mDictionaryOptions.mAttributes.containsKey(codePointTableAttribute));
+ final String codePointTable =
+ fileHeader.mDictionaryOptions.mAttributes.get(codePointTableAttribute);
+ // Check if codePointTable is correct
+ assertEquals("codePointTable is incorrect", codePointTable, correctCodePointTable);
+ }
+
+ // Unit test for CharEncoding.readString and CharEncoding.writeString.
+ public void testCharEncoding() {
+ // the max length of a word in sWords is less than 50.
+ // See generateWords.
+ final byte[] buffer = new byte[50 * 3];
+ final DictBuffer dictBuffer = new ByteArrayDictBuffer(buffer);
+ for (final String word : sWords) {
+ Arrays.fill(buffer, (byte) 0);
+ CharEncoding.writeString(buffer, 0, word, null);
+ dictBuffer.position(0);
+ final String str = CharEncoding.readString(dictBuffer);
+ assertEquals(word, str);
+ }
+ }
+
+ public void testReadAndWriteWithByteBuffer() {
+ final List<String> results = new ArrayList<>();
+
+ runReadAndWriteTests(results, BinaryDictUtils.USE_BYTE_BUFFER,
+ BinaryDictUtils.STATIC_OPTIONS);
+ runReadAndWriteTests(results, BinaryDictUtils.USE_BYTE_BUFFER,
+ BinaryDictUtils.DYNAMIC_OPTIONS_WITHOUT_TIMESTAMP);
+ runReadAndWriteTests(results, BinaryDictUtils.USE_BYTE_BUFFER,
+ BinaryDictUtils.DYNAMIC_OPTIONS_WITH_TIMESTAMP);
+ for (final String result : results) {
+ Log.d(TAG, result);
+ }
+ }
+
+ public void testReadAndWriteWithByteArray() {
+ final List<String> results = new ArrayList<>();
+
+ runReadAndWriteTests(results, BinaryDictUtils.USE_BYTE_ARRAY,
+ BinaryDictUtils.STATIC_OPTIONS);
+ runReadAndWriteTests(results, BinaryDictUtils.USE_BYTE_ARRAY,
+ BinaryDictUtils.DYNAMIC_OPTIONS_WITHOUT_TIMESTAMP);
+ runReadAndWriteTests(results, BinaryDictUtils.USE_BYTE_ARRAY,
+ BinaryDictUtils.DYNAMIC_OPTIONS_WITH_TIMESTAMP);
+
+ for (final String result : results) {
+ Log.d(TAG, result);
+ }
+ }
+
+ // Tests for readUnigramsAndBigramsBinary
+
+ private static void checkWordMap(final List<String> expectedWords,
+ final SparseArray<List<Integer>> expectedBigrams,
+ final TreeMap<Integer, String> resultWords,
+ final TreeMap<Integer, Integer> resultFrequencies,
+ final TreeMap<Integer, ArrayList<PendingAttribute>> resultBigrams,
+ final boolean checkProbability) {
+ // check unigrams
+ final Set<String> actualWordsSet = new HashSet<>(resultWords.values());
+ final Set<String> expectedWordsSet = new HashSet<>(expectedWords);
+ assertEquals(actualWordsSet, expectedWordsSet);
+ if (checkProbability) {
+ for (int freq : resultFrequencies.values()) {
+ assertEquals(freq, UNIGRAM_FREQ);
+ }
+ }
+
+ // check bigrams
+ final HashMap<String, Set<String>> expBigrams = new HashMap<>();
+ for (int i = 0; i < expectedBigrams.size(); ++i) {
+ final String word1 = expectedWords.get(expectedBigrams.keyAt(i));
+ for (int w2 : expectedBigrams.valueAt(i)) {
+ if (expBigrams.get(word1) == null) {
+ expBigrams.put(word1, new HashSet<String>());
+ }
+ expBigrams.get(word1).add(expectedWords.get(w2));
+ }
+ }
+
+ final HashMap<String, Set<String>> actBigrams = new HashMap<>();
+ for (Entry<Integer, ArrayList<PendingAttribute>> entry : resultBigrams.entrySet()) {
+ final String word1 = resultWords.get(entry.getKey());
+ final int unigramFreq = resultFrequencies.get(entry.getKey());
+ for (PendingAttribute attr : entry.getValue()) {
+ final String word2 = resultWords.get(attr.mAddress);
+ if (actBigrams.get(word1) == null) {
+ actBigrams.put(word1, new HashSet<String>());
+ }
+ actBigrams.get(word1).add(word2);
+
+ if (checkProbability) {
+ final int bigramFreq = BinaryDictIOUtils.reconstructBigramFrequency(
+ unigramFreq, attr.mFrequency);
+ assertTrue(Math.abs(bigramFreq - BIGRAM_FREQ) < TOLERANCE_OF_BIGRAM_FREQ);
+ }
+ }
+ }
+ assertEquals(actBigrams, expBigrams);
+ }
+
+ private static long timeAndCheckReadUnigramsAndBigramsBinary(final File file,
+ final List<String> words, final SparseArray<List<Integer>> bigrams,
+ final int bufferType, final boolean checkProbability) {
+ final TreeMap<Integer, String> resultWords = new TreeMap<>();
+ final TreeMap<Integer, ArrayList<PendingAttribute>> resultBigrams = new TreeMap<>();
+ final TreeMap<Integer, Integer> resultFreqs = new TreeMap<>();
+
+ long now = -1, diff = -1;
+ try {
+ final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length(),
+ bufferType);
+ now = System.currentTimeMillis();
+ dictDecoder.readUnigramsAndBigramsBinary(resultWords, resultFreqs, resultBigrams);
+ diff = System.currentTimeMillis() - now;
+ } catch (IOException e) {
+ Log.e(TAG, "IOException", e);
+ } catch (UnsupportedFormatException e) {
+ Log.e(TAG, "UnsupportedFormatException", e);
+ }
+
+ checkWordMap(words, bigrams, resultWords, resultFreqs, resultBigrams, checkProbability);
+ return diff;
+ }
+
+ private String runReadUnigramsAndBigramsBinary(final ArrayList<String> words,
+ final SparseArray<List<Integer>> bigrams, final int bufferType,
+ final FormatSpec.FormatOptions formatOptions, final String message) {
+ final String dictName = "runReadUnigrams";
+ final String dictVersion = Long.toString(System.currentTimeMillis());
+ final File file = BinaryDictUtils.getDictFile(dictName, dictVersion, formatOptions,
+ getContext().getCacheDir());
+
+ // making the dictionary from lists of words.
+ final FusionDictionary dict = new FusionDictionary(new PtNodeArray(),
+ BinaryDictUtils.makeDictionaryOptions(dictName, dictVersion, formatOptions));
+ addUnigrams(words.size(), dict, words);
+ addBigrams(dict, words, bigrams);
+
+ timeWritingDictToFile(file, dict, formatOptions);
+
+ // Caveat: Currently, the Java code to read a v4 dictionary doesn't calculate the
+ // probability when there's a timestamp for the entry.
+ // TODO: Abandon the Java code, and implement the v4 dictionary reading code in native.
+ long wordMap = timeAndCheckReadUnigramsAndBigramsBinary(file, words, bigrams, bufferType,
+ !formatOptions.mHasTimestamp /* checkProbability */);
+ long fullReading = timeReadingAndCheckDict(file, words, bigrams,
+ bufferType);
+
+ return "readDictionaryBinary=" + fullReading + ", readUnigramsAndBigramsBinary=" + wordMap
+ + " : " + message + " : " + outputOptions(bufferType, formatOptions);
+ }
+
+ private void runReadUnigramsAndBigramsTests(final ArrayList<String> results,
+ final int bufferType, final FormatSpec.FormatOptions formatOptions) {
+ results.add(runReadUnigramsAndBigramsBinary(sWords, sEmptyBigrams, bufferType,
+ formatOptions, "unigram"));
+ results.add(runReadUnigramsAndBigramsBinary(sWords, sChainBigrams, bufferType,
+ formatOptions, "chain"));
+ results.add(runReadUnigramsAndBigramsBinary(sWords, sStarBigrams, bufferType,
+ formatOptions, "star"));
+ }
+
+ public void testReadUnigramsAndBigramsBinaryWithByteBuffer() {
+ final ArrayList<String> results = new ArrayList<>();
+
+ runReadUnigramsAndBigramsTests(results, BinaryDictUtils.USE_BYTE_BUFFER,
+ BinaryDictUtils.STATIC_OPTIONS);
+
+ for (final String result : results) {
+ Log.d(TAG, result);
+ }
+ }
+
+ public void testReadUnigramsAndBigramsBinaryWithByteArray() {
+ final ArrayList<String> results = new ArrayList<>();
+
+ runReadUnigramsAndBigramsTests(results, BinaryDictUtils.USE_BYTE_ARRAY,
+ BinaryDictUtils.STATIC_OPTIONS);
+
+ for (final String result : results) {
+ Log.d(TAG, result);
+ }
+ }
+
+ // Tests for getTerminalPosition
+ private static String getWordFromBinary(final DictDecoder dictDecoder, final int address) {
+ if (dictDecoder.getPosition() != 0) dictDecoder.setPosition(0);
+
+ DictionaryHeader fileHeader = null;
+ try {
+ fileHeader = dictDecoder.readHeader();
+ } catch (IOException e) {
+ return null;
+ } catch (UnsupportedFormatException e) {
+ return null;
+ }
+ if (fileHeader == null) return null;
+ return BinaryDictDecoderUtils.getWordAtPosition(dictDecoder, fileHeader.mBodyOffset,
+ address).mWord;
+ }
+
+ private static long checkGetTerminalPosition(final DictDecoder dictDecoder, final String word,
+ final boolean contained) {
+ long diff = -1;
+ int position = -1;
+ try {
+ final long now = System.nanoTime();
+ position = dictDecoder.getTerminalPosition(word);
+ diff = System.nanoTime() - now;
+ } catch (IOException e) {
+ Log.e(TAG, "IOException while getTerminalPosition", e);
+ } catch (UnsupportedFormatException e) {
+ Log.e(TAG, "UnsupportedFormatException while getTerminalPosition", e);
+ }
+
+ assertEquals(FormatSpec.NOT_VALID_WORD != position, contained);
+ if (contained) assertEquals(getWordFromBinary(dictDecoder, position), word);
+ return diff;
+ }
+
+ private void runGetTerminalPosition(final ArrayList<String> words,
+ final SparseArray<List<Integer>> bigrams, final int bufferType,
+ final FormatOptions formatOptions, final String message) {
+ final String dictName = "testGetTerminalPosition";
+ final String dictVersion = Long.toString(System.currentTimeMillis());
+ final File file = BinaryDictUtils.getDictFile(dictName, dictVersion, formatOptions,
+ getContext().getCacheDir());
+
+ final FusionDictionary dict = new FusionDictionary(new PtNodeArray(),
+ BinaryDictUtils.makeDictionaryOptions(dictName, dictVersion, formatOptions));
+ addUnigrams(sWords.size(), dict, sWords);
+ addBigrams(dict, words, bigrams);
+ timeWritingDictToFile(file, dict, formatOptions);
+
+ final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length(),
+ DictDecoder.USE_BYTEARRAY);
+ try {
+ dictDecoder.openDictBuffer();
+ } catch (IOException e) {
+ Log.e(TAG, "IOException while opening the buffer", e);
+ } catch (UnsupportedFormatException e) {
+ Log.e(TAG, "IOException while opening the buffer", e);
+ }
+ assertTrue("Can't get the buffer", dictDecoder.isDictBufferOpen());
+
+ try {
+ // too long word
+ final String longWord = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
+ assertEquals(FormatSpec.NOT_VALID_WORD, dictDecoder.getTerminalPosition(longWord));
+
+ // null
+ assertEquals(FormatSpec.NOT_VALID_WORD, dictDecoder.getTerminalPosition(null));
+
+ // empty string
+ assertEquals(FormatSpec.NOT_VALID_WORD, dictDecoder.getTerminalPosition(""));
+ } catch (IOException e) {
+ } catch (UnsupportedFormatException e) {
+ }
+
+ // Test a word that is contained within the dictionary.
+ long sum = 0;
+ for (int i = 0; i < sWords.size(); ++i) {
+ final long time = checkGetTerminalPosition(dictDecoder, sWords.get(i), true);
+ sum += time == -1 ? 0 : time;
+ }
+ Log.d(TAG, "per search : " + (((double)sum) / sWords.size() / 1000000) + " : " + message
+ + " : " + outputOptions(bufferType, formatOptions));
+
+ // Test a word that isn't contained within the dictionary.
+ final int[] codePointSet = CodePointUtils.generateCodePointSet(DEFAULT_CODE_POINT_SET_SIZE,
+ mRandom);
+ for (int i = 0; i < 1000; ++i) {
+ final String word = CodePointUtils.generateWord(mRandom, codePointSet);
+ if (sWords.indexOf(word) != -1) continue;
+ checkGetTerminalPosition(dictDecoder, word, false);
+ }
+ }
+
+ private void runGetTerminalPositionTests(final int bufferType,
+ final FormatOptions formatOptions) {
+ runGetTerminalPosition(sWords, sEmptyBigrams, bufferType, formatOptions, "unigram");
+ }
+
+ public void testGetTerminalPosition() {
+ final ArrayList<String> results = new ArrayList<>();
+
+ runGetTerminalPositionTests(BinaryDictUtils.USE_BYTE_ARRAY,
+ BinaryDictUtils.STATIC_OPTIONS);
+ runGetTerminalPositionTests(BinaryDictUtils.USE_BYTE_BUFFER,
+ BinaryDictUtils.STATIC_OPTIONS);
+
+ for (final String result : results) {
+ Log.d(TAG, result);
+ }
+ }
+
+ public void testVer2DictGetWordProperty() {
+ final FormatOptions formatOptions = BinaryDictUtils.STATIC_OPTIONS;
+ final ArrayList<String> words = sWords;
+ final String dictName = "testGetWordProperty";
+ final String dictVersion = Long.toString(System.currentTimeMillis());
+ final FusionDictionary dict = new FusionDictionary(new PtNodeArray(),
+ BinaryDictUtils.makeDictionaryOptions(dictName, dictVersion, formatOptions));
+ addUnigrams(words.size(), dict, words);
+ addBigrams(dict, words, sEmptyBigrams);
+ final File file = BinaryDictUtils.getDictFile(dictName, dictVersion, formatOptions,
+ getContext().getCacheDir());
+ file.delete();
+ timeWritingDictToFile(file, dict, formatOptions);
+ final BinaryDictionary binaryDictionary = new BinaryDictionary(file.getAbsolutePath(),
+ 0 /* offset */, file.length(), true /* useFullEditDistance */,
+ Locale.ENGLISH, dictName, false /* isUpdatable */);
+ for (final String word : words) {
+ final WordProperty wordProperty = binaryDictionary.getWordProperty(word,
+ false /* isBeginningOfSentence */);
+ assertEquals(word, wordProperty.mWord);
+ assertEquals(UNIGRAM_FREQ, wordProperty.getProbability());
+ }
+ }
+
+ public void testVer2DictIteration() {
+ final FormatOptions formatOptions = BinaryDictUtils.STATIC_OPTIONS;
+ final ArrayList<String> words = sWords;
+ final SparseArray<List<Integer>> bigrams = sEmptyBigrams;
+ final String dictName = "testGetWordProperty";
+ final String dictVersion = Long.toString(System.currentTimeMillis());
+ final FusionDictionary dict = new FusionDictionary(new PtNodeArray(),
+ BinaryDictUtils.makeDictionaryOptions(dictName, dictVersion, formatOptions));
+ addUnigrams(words.size(), dict, words);
+ addBigrams(dict, words, bigrams);
+ final File file = BinaryDictUtils.getDictFile(dictName, dictVersion, formatOptions,
+ getContext().getCacheDir());
+ timeWritingDictToFile(file, dict, formatOptions);
+ Log.d(TAG, file.getAbsolutePath());
+ final BinaryDictionary binaryDictionary = new BinaryDictionary(file.getAbsolutePath(),
+ 0 /* offset */, file.length(), true /* useFullEditDistance */,
+ Locale.ENGLISH, dictName, false /* isUpdatable */);
+
+ final HashSet<String> wordSet = new HashSet<>(words);
+ final HashSet<Pair<String, String>> bigramSet = new HashSet<>();
+
+ for (int i = 0; i < words.size(); i++) {
+ final List<Integer> bigramList = bigrams.get(i);
+ if (bigramList != null) {
+ for (final Integer word1Index : bigramList) {
+ final String word1 = words.get(word1Index);
+ bigramSet.add(new Pair<>(words.get(i), word1));
+ }
+ }
+ }
+ int token = 0;
+ do {
+ final BinaryDictionary.GetNextWordPropertyResult result =
+ binaryDictionary.getNextWordProperty(token);
+ final WordProperty wordProperty = result.mWordProperty;
+ final String word0 = wordProperty.mWord;
+ assertEquals(UNIGRAM_FREQ, wordProperty.mProbabilityInfo.mProbability);
+ wordSet.remove(word0);
+ if (wordProperty.mHasNgrams) {
+ for (final WeightedString bigramTarget : wordProperty.getBigrams()) {
+ final String word1 = bigramTarget.mWord;
+ final Pair<String, String> bigram = new Pair<>(word0, word1);
+ assertTrue(bigramSet.contains(bigram));
+ bigramSet.remove(bigram);
+ }
+ }
+ token = result.mNextToken;
+ } while (token != 0);
+ assertTrue(wordSet.isEmpty());
+ assertTrue(bigramSet.isEmpty());
+ }
+}
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictUtils.java
new file mode 100644
index 000000000..9c1e4cf84
--- /dev/null
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictUtils.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2013 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.makedict;
+
+import com.android.inputmethod.latin.makedict.FormatSpec.DictionaryOptions;
+import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
+
+import java.io.File;
+import java.util.HashMap;
+
+public class BinaryDictUtils {
+ public static final int USE_BYTE_ARRAY = 1;
+ public static final int USE_BYTE_BUFFER = 2;
+
+ public static final String TEST_DICT_FILE_EXTENSION = ".testDict";
+
+ public static final FormatSpec.FormatOptions STATIC_OPTIONS =
+ new FormatSpec.FormatOptions(FormatSpec.VERSION202);
+ public static final FormatSpec.FormatOptions DYNAMIC_OPTIONS_WITHOUT_TIMESTAMP =
+ new FormatSpec.FormatOptions(FormatSpec.VERSION4, false /* hasTimestamp */);
+ public static final FormatSpec.FormatOptions DYNAMIC_OPTIONS_WITH_TIMESTAMP =
+ new FormatSpec.FormatOptions(FormatSpec.VERSION4, true /* hasTimestamp */);
+
+ public static DictionaryOptions makeDictionaryOptions(final String id, final String version,
+ final FormatSpec.FormatOptions formatOptions) {
+ final DictionaryOptions options = new DictionaryOptions(new HashMap<String, String>());
+ options.mAttributes.put(DictionaryHeader.DICTIONARY_LOCALE_KEY, "en_US");
+ options.mAttributes.put(DictionaryHeader.DICTIONARY_ID_KEY, id);
+ options.mAttributes.put(DictionaryHeader.DICTIONARY_VERSION_KEY, version);
+ if (formatOptions.mHasTimestamp) {
+ options.mAttributes.put(DictionaryHeader.HAS_HISTORICAL_INFO_KEY,
+ DictionaryHeader.ATTRIBUTE_VALUE_TRUE);
+ options.mAttributes.put(DictionaryHeader.USES_FORGETTING_CURVE_KEY,
+ DictionaryHeader.ATTRIBUTE_VALUE_TRUE);
+ }
+ return options;
+ }
+
+ public static File getDictFile(final String name, final String version,
+ final FormatOptions formatOptions, final File directory) {
+ if (formatOptions.mVersion == FormatSpec.VERSION2
+ || formatOptions.mVersion == FormatSpec.VERSION201
+ || formatOptions.mVersion == FormatSpec.VERSION202) {
+ return new File(directory, name + "." + version + TEST_DICT_FILE_EXTENSION);
+ } else if (formatOptions.mVersion == FormatSpec.VERSION4) {
+ return new File(directory, name + "." + version);
+ } else {
+ throw new RuntimeException("the format option has a wrong version : "
+ + formatOptions.mVersion);
+ }
+ }
+
+ public static DictEncoder getDictEncoder(final File file, final FormatOptions formatOptions) {
+ if (formatOptions.mVersion == FormatSpec.VERSION4) {
+ if (!file.isDirectory()) {
+ file.mkdir();
+ }
+ return new Ver4DictEncoder(file);
+ } else if (formatOptions.mVersion == FormatSpec.VERSION202) {
+ return new Ver2DictEncoder(file, Ver2DictEncoder.CODE_POINT_TABLE_OFF);
+ } else {
+ throw new RuntimeException("The format option has a wrong version : "
+ + formatOptions.mVersion);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java
new file mode 100644
index 000000000..c63b972eb
--- /dev/null
+++ b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2013 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.makedict;
+
+import com.android.inputmethod.annotations.UsedForTesting;
+import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.CharEncoding;
+import com.android.inputmethod.latin.makedict.BinaryDictEncoderUtils.CodePointTable;
+import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
+import com.android.inputmethod.latin.makedict.FusionDictionary.PtNode;
+import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+/**
+ * An implementation of DictEncoder for version 2 binary dictionary.
+ */
+@UsedForTesting
+public class Ver2DictEncoder implements DictEncoder {
+
+ private final File mDictFile;
+ private OutputStream mOutStream;
+ private byte[] mBuffer;
+ private int mPosition;
+ private final int mCodePointTableMode;
+ public static final int CODE_POINT_TABLE_OFF = 0;
+ public static final int CODE_POINT_TABLE_ON = 1;
+
+ @UsedForTesting
+ public Ver2DictEncoder(final File dictFile, final int codePointTableMode) {
+ mDictFile = dictFile;
+ mOutStream = null;
+ mBuffer = null;
+ mCodePointTableMode = codePointTableMode;
+ }
+
+ // This constructor is used only by BinaryDictOffdeviceUtilsTests.
+ // If you want to use this in the production code, you should consider keeping consistency of
+ // the interface of Ver3DictDecoder by using factory.
+ @UsedForTesting
+ public Ver2DictEncoder(final OutputStream outStream) {
+ mDictFile = null;
+ mOutStream = outStream;
+ mCodePointTableMode = CODE_POINT_TABLE_OFF;
+ }
+
+ private void openStream() throws FileNotFoundException {
+ mOutStream = new FileOutputStream(mDictFile);
+ }
+
+ private void close() throws IOException {
+ if (mOutStream != null) {
+ mOutStream.close();
+ mOutStream = null;
+ }
+ }
+
+ // Package for testing
+ static CodePointTable makeCodePointTable(final FusionDictionary dict) {
+ final HashMap<Integer, Integer> codePointOccurrenceCounts = new HashMap<>();
+ for (final WordProperty word : dict) {
+ // Store per code point occurrence
+ final String wordString = word.mWord;
+ for (int i = 0; i < wordString.length(); ++i) {
+ final int codePoint = Character.codePointAt(wordString, i);
+ if (codePointOccurrenceCounts.containsKey(codePoint)) {
+ codePointOccurrenceCounts.put(codePoint,
+ codePointOccurrenceCounts.get(codePoint) + 1);
+ } else {
+ codePointOccurrenceCounts.put(codePoint, 1);
+ }
+ }
+ }
+ final ArrayList<Entry<Integer, Integer>> codePointOccurrenceArray =
+ new ArrayList<>(codePointOccurrenceCounts.entrySet());
+ // Descending order sort by occurrence (value side)
+ Collections.sort(codePointOccurrenceArray, new Comparator<Entry<Integer, Integer>>() {
+ @Override
+ public int compare(final Entry<Integer, Integer> a, final Entry<Integer, Integer> b) {
+ if (a.getValue() != b.getValue()) {
+ return b.getValue().compareTo(a.getValue());
+ }
+ return b.getKey().compareTo(a.getKey());
+ }
+ });
+ int currentCodePointTableIndex = FormatSpec.MINIMAL_ONE_BYTE_CHARACTER_VALUE;
+ // Temporary map for writing of nodes
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap = new HashMap<>();
+ for (final Entry<Integer, Integer> entry : codePointOccurrenceArray) {
+ // Put a relation from the original code point to the one byte code.
+ codePointToOneByteCodeMap.put(entry.getKey(), currentCodePointTableIndex);
+ if (FormatSpec.MAXIMAL_ONE_BYTE_CHARACTER_VALUE < ++currentCodePointTableIndex) {
+ break;
+ }
+ }
+ // codePointToOneByteCodeMap for writing the trie
+ // codePointOccurrenceArray for writing the header
+ return new CodePointTable(codePointToOneByteCodeMap, codePointOccurrenceArray);
+ }
+
+ @Override
+ public void writeDictionary(final FusionDictionary dict, final FormatOptions formatOptions)
+ throws IOException, UnsupportedFormatException {
+ // We no longer support anything but the latest version of v2.
+ if (formatOptions.mVersion != FormatSpec.VERSION202) {
+ throw new UnsupportedFormatException(
+ "The given format options has wrong version number : "
+ + formatOptions.mVersion);
+ }
+
+ if (mOutStream == null) {
+ openStream();
+ }
+
+ // Make code point conversion table ordered by occurrence of code points
+ // Version 201 or later have codePointTable
+ final CodePointTable codePointTable;
+ if (mCodePointTableMode == CODE_POINT_TABLE_OFF || formatOptions.mVersion
+ < FormatSpec.MINIMUM_SUPPORTED_VERSION_OF_CODE_POINT_TABLE) {
+ codePointTable = new CodePointTable();
+ } else {
+ codePointTable = makeCodePointTable(dict);
+ }
+
+ BinaryDictEncoderUtils.writeDictionaryHeader(mOutStream, dict, formatOptions,
+ codePointTable.mCodePointOccurrenceArray);
+
+ // Addresses are limited to 3 bytes, but since addresses can be relative to each node
+ // array, the structure itself is not limited to 16MB. However, if it is over 16MB deciding
+ // the order of the PtNode arrays becomes a quite complicated problem, because though the
+ // dictionary itself does not have a size limit, each node array must still be within 16MB
+ // of all its children and parents. As long as this is ensured, the dictionary file may
+ // grow to any size.
+
+ // Leave the choice of the optimal node order to the flattenTree function.
+ MakedictLog.i("Flattening the tree...");
+ ArrayList<PtNodeArray> flatNodes = BinaryDictEncoderUtils.flattenTree(dict.mRootNodeArray);
+
+ MakedictLog.i("Computing addresses...");
+ BinaryDictEncoderUtils.computeAddresses(dict, flatNodes,
+ codePointTable.mCodePointToOneByteCodeMap);
+ MakedictLog.i("Checking PtNode array...");
+ if (MakedictLog.DBG) BinaryDictEncoderUtils.checkFlatPtNodeArrayList(flatNodes);
+
+ // Create a buffer that matches the final dictionary size.
+ final PtNodeArray lastNodeArray = flatNodes.get(flatNodes.size() - 1);
+ final int bufferSize = lastNodeArray.mCachedAddressAfterUpdate + lastNodeArray.mCachedSize;
+ mBuffer = new byte[bufferSize];
+
+ MakedictLog.i("Writing file...");
+
+ for (PtNodeArray nodeArray : flatNodes) {
+ BinaryDictEncoderUtils.writePlacedPtNodeArray(dict, this, nodeArray,
+ codePointTable.mCodePointToOneByteCodeMap);
+ }
+ if (MakedictLog.DBG) BinaryDictEncoderUtils.showStatistics(flatNodes);
+ mOutStream.write(mBuffer, 0, mPosition);
+
+ MakedictLog.i("Done");
+ close();
+ }
+
+ @Override
+ public void setPosition(final int position) {
+ if (mBuffer == null || position < 0 || position >= mBuffer.length) return;
+ mPosition = position;
+ }
+
+ @Override
+ public int getPosition() {
+ return mPosition;
+ }
+
+ @Override
+ public void writePtNodeCount(final int ptNodeCount) {
+ final int countSize = BinaryDictIOUtils.getPtNodeCountSize(ptNodeCount);
+ if (countSize != 1 && countSize != 2) {
+ throw new RuntimeException("Strange size from getGroupCountSize : " + countSize);
+ }
+ final int encodedPtNodeCount = (countSize == 2) ?
+ (ptNodeCount | FormatSpec.LARGE_PTNODE_ARRAY_SIZE_FIELD_SIZE_FLAG) : ptNodeCount;
+ mPosition = BinaryDictEncoderUtils.writeUIntToBuffer(mBuffer, mPosition, encodedPtNodeCount,
+ countSize);
+ }
+
+ private void writePtNodeFlags(final PtNode ptNode,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ final int childrenPos = BinaryDictEncoderUtils.getChildrenPosition(ptNode,
+ codePointToOneByteCodeMap);
+ mPosition = BinaryDictEncoderUtils.writeUIntToBuffer(mBuffer, mPosition,
+ BinaryDictEncoderUtils.makePtNodeFlags(ptNode, childrenPos),
+ FormatSpec.PTNODE_FLAGS_SIZE);
+ }
+
+ private void writeCharacters(final int[] codePoints, final boolean hasSeveralChars,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ mPosition = CharEncoding.writeCharArray(codePoints, mBuffer, mPosition,
+ codePointToOneByteCodeMap);
+ if (hasSeveralChars) {
+ mBuffer[mPosition++] = FormatSpec.PTNODE_CHARACTERS_TERMINATOR;
+ }
+ }
+
+ private void writeFrequency(final int frequency) {
+ if (frequency >= 0) {
+ mPosition = BinaryDictEncoderUtils.writeUIntToBuffer(mBuffer, mPosition, frequency,
+ FormatSpec.PTNODE_FREQUENCY_SIZE);
+ }
+ }
+
+ private void writeChildrenPosition(final PtNode ptNode,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ final int childrenPos = BinaryDictEncoderUtils.getChildrenPosition(ptNode,
+ codePointToOneByteCodeMap);
+ mPosition += BinaryDictEncoderUtils.writeChildrenPosition(mBuffer, mPosition,
+ childrenPos);
+ }
+
+ /**
+ * Write a bigram attributes list to mBuffer.
+ *
+ * @param bigrams the bigram attributes list.
+ * @param dict the dictionary the node array is a part of (for relative offsets).
+ */
+ private void writeBigrams(final ArrayList<WeightedString> bigrams,
+ final FusionDictionary dict) {
+ if (bigrams == null) return;
+
+ final Iterator<WeightedString> bigramIterator = bigrams.iterator();
+ while (bigramIterator.hasNext()) {
+ final WeightedString bigram = bigramIterator.next();
+ final PtNode target =
+ FusionDictionary.findWordInTree(dict.mRootNodeArray, bigram.mWord);
+ final int addressOfBigram = target.mCachedAddressAfterUpdate;
+ final int unigramFrequencyForThisWord = target.getProbability();
+ final int offset = addressOfBigram
+ - (mPosition + FormatSpec.PTNODE_ATTRIBUTE_FLAGS_SIZE);
+ final int bigramFlags = BinaryDictEncoderUtils.makeBigramFlags(bigramIterator.hasNext(),
+ offset, bigram.getProbability(), unigramFrequencyForThisWord, bigram.mWord);
+ mPosition = BinaryDictEncoderUtils.writeUIntToBuffer(mBuffer, mPosition, bigramFlags,
+ FormatSpec.PTNODE_ATTRIBUTE_FLAGS_SIZE);
+ mPosition += BinaryDictEncoderUtils.writeChildrenPosition(mBuffer, mPosition,
+ Math.abs(offset));
+ }
+ }
+
+ @Override
+ public void writePtNode(final PtNode ptNode, final FusionDictionary dict,
+ final HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ writePtNodeFlags(ptNode, codePointToOneByteCodeMap);
+ writeCharacters(ptNode.mChars, ptNode.hasSeveralChars(), codePointToOneByteCodeMap);
+ writeFrequency(ptNode.getProbability());
+ writeChildrenPosition(ptNode, codePointToOneByteCodeMap);
+ writeBigrams(ptNode.mBigrams, dict);
+ }
+}
diff --git a/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java
new file mode 100644
index 000000000..6e7b37d54
--- /dev/null
+++ b/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2013 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.makedict;
+
+import com.android.inputmethod.annotations.UsedForTesting;
+import com.android.inputmethod.latin.BinaryDictionary;
+import com.android.inputmethod.latin.Dictionary;
+import com.android.inputmethod.latin.NgramContext;
+import com.android.inputmethod.latin.common.LocaleUtils;
+import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
+import com.android.inputmethod.latin.makedict.FusionDictionary.PtNode;
+import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * An implementation of DictEncoder for version 4 binary dictionary.
+ */
+@UsedForTesting
+public class Ver4DictEncoder implements DictEncoder {
+ private final File mDictPlacedDir;
+
+ @UsedForTesting
+ public Ver4DictEncoder(final File dictPlacedDir) {
+ mDictPlacedDir = dictPlacedDir;
+ }
+
+ // TODO: This builds a FusionDictionary first and iterates it to add words to the binary
+ // dictionary. However, it is possible to just add words directly to the binary dictionary
+ // instead.
+ // In the long run, when we stop supporting version 2, FusionDictionary will become deprecated
+ // and we can remove it. Then we'll be able to just call BinaryDictionary directly.
+ @Override
+ public void writeDictionary(FusionDictionary dict, FormatOptions formatOptions)
+ throws IOException, UnsupportedFormatException {
+ if (formatOptions.mVersion != FormatSpec.VERSION4) {
+ throw new UnsupportedFormatException("File header has a wrong version number : "
+ + formatOptions.mVersion);
+ }
+ if (!mDictPlacedDir.isDirectory()) {
+ throw new UnsupportedFormatException("Given path is not a directory.");
+ }
+ if (!BinaryDictionaryUtils.createEmptyDictFile(mDictPlacedDir.getAbsolutePath(),
+ FormatSpec.VERSION4, LocaleUtils.constructLocaleFromString(
+ dict.mOptions.mAttributes.get(DictionaryHeader.DICTIONARY_LOCALE_KEY)),
+ dict.mOptions.mAttributes)) {
+ throw new IOException("Cannot create dictionary file : "
+ + mDictPlacedDir.getAbsolutePath());
+ }
+ final BinaryDictionary binaryDict = new BinaryDictionary(mDictPlacedDir.getAbsolutePath(),
+ 0l, mDictPlacedDir.length(), true /* useFullEditDistance */,
+ LocaleUtils.constructLocaleFromString(dict.mOptions.mAttributes.get(
+ DictionaryHeader.DICTIONARY_LOCALE_KEY)),
+ Dictionary.TYPE_USER /* Dictionary type. Does not matter for us */,
+ true /* isUpdatable */);
+ if (!binaryDict.isValidDictionary()) {
+ // Somehow createEmptyDictFile returned true, but the file was not created correctly
+ throw new IOException("Cannot create dictionary file");
+ }
+ for (final WordProperty wordProperty : dict) {
+ if (!binaryDict.addUnigramEntry(wordProperty.mWord, wordProperty.getProbability(),
+ wordProperty.mIsBeginningOfSentence, wordProperty.mIsNotAWord,
+ wordProperty.mIsPossiblyOffensive, 0 /* timestamp */)) {
+ MakedictLog.e("Cannot add unigram entry for " + wordProperty.mWord);
+ }
+ if (binaryDict.needsToRunGC(true /* mindsBlockByGC */)) {
+ if (!binaryDict.flushWithGC()) {
+ MakedictLog.e("Cannot flush dict with GC.");
+ return;
+ }
+ }
+ }
+ for (final WordProperty word0Property : dict) {
+ if (!word0Property.mHasNgrams) continue;
+ // TODO: Support ngram.
+ for (final WeightedString word1 : word0Property.getBigrams()) {
+ final NgramContext ngramContext =
+ new NgramContext(new NgramContext.WordInfo(word0Property.mWord));
+ if (!binaryDict.addNgramEntry(ngramContext, word1.mWord,
+ word1.getProbability(), 0 /* timestamp */)) {
+ MakedictLog.e("Cannot add n-gram entry for "
+ + ngramContext + " -> " + word1.mWord);
+ return;
+ }
+ if (binaryDict.needsToRunGC(true /* mindsBlockByGC */)) {
+ if (!binaryDict.flushWithGC()) {
+ MakedictLog.e("Cannot flush dict with GC.");
+ return;
+ }
+ }
+ }
+ }
+ if (!binaryDict.flushWithGC()) {
+ MakedictLog.e("Cannot flush dict with GC.");
+ return;
+ }
+ binaryDict.close();
+ }
+
+ @Override
+ public void setPosition(int position) {
+ }
+
+ @Override
+ public int getPosition() {
+ return 0;
+ }
+
+ @Override
+ public void writePtNodeCount(int ptNodeCount) {
+ }
+
+ @Override
+ public void writePtNode(PtNode ptNode, FusionDictionary dict,
+ HashMap<Integer, Integer> codePointToOneByteCodeMap) {
+ }
+}
diff --git a/tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java b/tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java
index 8f24cdb44..f6f54eb77 100644
--- a/tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java
+++ b/tests/src/com/android/inputmethod/latin/network/BlockingHttpClientTests.java
@@ -16,16 +16,22 @@
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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.network.BlockingHttpClient.ResponseProcessor;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
@@ -44,15 +50,16 @@ import java.util.Random;
* 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 +74,7 @@ public class BlockingHttpClientTests extends AndroidTestCase {
}
}
+ @Test
public void testError_clientTimeout() throws Exception {
when(mMockHttpConnection.getResponseCode()).thenReturn(
HttpURLConnection.HTTP_CLIENT_TIMEOUT);
@@ -82,6 +90,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 +107,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 +122,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..1aa4040b8 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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
-
/**
* 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..68f041589 100644
--- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
+++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
@@ -16,13 +16,23 @@
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.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.latin.ExpandableBinaryDictionary;
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.io.File;
import java.util.Locale;
import java.util.Random;
@@ -31,13 +41,18 @@ import java.util.Random;
* 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 +77,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 +124,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 +136,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 +175,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 +203,12 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
}
}
+ @Test
public void testAddManyWords() {
doTestAddManyWords(TEST_ACCOUNT);
}
+ @Test
public void testAddManyWords_NullAccount() {
doTestAddManyWords(null /* testAccount */);
}
@@ -200,7 +219,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..667ffd1ae 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,19 @@ 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.view.View;
import android.widget.ListView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
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 +46,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 +97,7 @@ public class AccountsSettingsFragmentTests
DialogHolder() {}
}
+ @Test
public void testMultipleAccounts_noSettingsForManagedProfile() {
when(mManagedProfileUtils.hasWorkProfile(any(Context.class))).thenReturn(true);
@@ -95,6 +110,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 +132,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 +181,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..df44fba67 100644
--- a/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java
+++ b/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java
@@ -16,9 +16,17 @@
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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.common.Constants;
@@ -26,15 +34,24 @@ import com.android.inputmethod.latin.utils.RunInLocale;
import junit.framework.AssertionFailedError;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Locale;
@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 +80,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 +155,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
assertFalse("Tilde", sp.isWordSeparator('~'));
}
+ @Test
public void testWordSeparator() {
testingStandardWordSeparator(ENGLISH);
testingStandardWordSeparator(FRENCH);
@@ -192,6 +208,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
}
+ @Test
public void testWordConnector() {
testingStandardWordConnector(ENGLISH);
testingStandardWordConnector(FRENCH);
@@ -245,6 +262,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
assertFalse("Question", sp.isUsuallyPrecededBySpace('?'));
}
+ @Test
public void testIsUsuallyPrecededBySpace() {
testingStandardPrecededBySpace(ENGLISH);
testingCommonPrecededBySpace(FRENCH);
@@ -298,6 +316,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
assertFalse("Tilde", sp.isUsuallyFollowedBySpace('~'));
}
+ @Test
public void testIsUsuallyFollowedBySpace() {
testingStandardFollowedBySpace(ENGLISH);
testingStandardFollowedBySpace(FRENCH);
@@ -345,7 +364,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 +377,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
assertFalse(ARMENIA_ARMENIAN.isSentenceSeparator(ARMENIAN_COMMA));
}
+ @Test
public void testLanguageHasSpace() {
assertTrue(ENGLISH.mCurrentLanguageHasSpaces);
assertTrue(FRENCH.mCurrentLanguageHasSpaces);
@@ -369,6 +390,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
assertTrue(LAO.mCurrentLanguageHasSpaces);
}
+ @Test
public void testUsesAmericanTypography() {
assertTrue(ENGLISH.mUsesAmericanTypography);
assertTrue(UNITED_STATES.mUsesAmericanTypography);
@@ -379,6 +401,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
assertFalse(SWISS_GERMAN.mUsesAmericanTypography);
}
+ @Test
public void testUsesGermanRules() {
assertFalse(ENGLISH.mUsesGermanRules);
assertFalse(FRENCH.mUsesGermanRules);
@@ -436,6 +459,7 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
}
}
+ @Test
public void testPhonePunctuationSuggestions() {
if (!isPhone()) {
return;
@@ -454,6 +478,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..3706574ef 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 androidx.test.filters.SmallTest;
+import androidx.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..986c8e3dd 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 androidx.test.filters.SmallTest;
+import androidx.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..08c404e12 100644
--- a/tests/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtilsTests.java
@@ -16,25 +16,36 @@
package com.android.inputmethod.latin.utils;
-import static com.android.inputmethod.latin.common.Constants.Subtype.KEYBOARD_MODE;
import static com.android.inputmethod.latin.common.Constants.Subtype.ExtraValue.ASCII_CAPABLE;
import static com.android.inputmethod.latin.common.Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
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 com.android.inputmethod.latin.common.Constants.Subtype.KEYBOARD_MODE;
+
+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.view.inputmethod.InputMethodSubtype;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.compat.InputMethodSubtypeCompatUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Locale;
@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 +109,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 +159,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..f53780543 100644
--- a/tests/src/com/android/inputmethod/latin/utils/AsyncResultHolderTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/AsyncResultHolderTests.java
@@ -16,12 +16,19 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import static org.junit.Assert.assertEquals;
+
import android.util.Log;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
+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 +51,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 +66,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 +74,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..4aac7fc41 100644
--- a/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
@@ -16,18 +16,27 @@
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.text.TextUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
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 +58,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 +69,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..da23c9cb8 100644
--- a/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
@@ -16,11 +16,19 @@
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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.common.CollectionUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -32,11 +40,13 @@ import java.util.Map;
* 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..2112f985a 100644
--- a/tests/src/com/android/inputmethod/latin/utils/DictionaryInfoUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/DictionaryInfoUtilsTests.java
@@ -16,17 +16,28 @@
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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
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 DictionaryInfoUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class DictionaryInfoUtilsTests {
+ @Test
public void testLooksValidForDictionaryInsertion() {
final RunInLocale<SpacingAndPunctuations> job = new RunInLocale<SpacingAndPunctuations>() {
@Override
@@ -34,7 +45,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 +57,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..7c9b3e6ca 100644
--- a/tests/src/com/android/inputmethod/latin/utils/ExecutorUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/ExecutorUtilsTests.java
@@ -16,10 +16,16 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
+import static org.junit.Assert.assertEquals;
+
import android.util.Log;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -28,12 +34,14 @@ import java.util.concurrent.atomic.AtomicInteger;
* 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..9d9a541b7 100644
--- a/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java
@@ -17,32 +17,41 @@
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 androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.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 +105,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..fd5e0a4d7 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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Arrays;
import java.util.List;
@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..58e26e8d6 100644
--- a/tests/src/com/android/inputmethod/latin/utils/LanguageOnSpacebarUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/LanguageOnSpacebarUtilsTests.java
@@ -20,24 +20,33 @@ import static com.android.inputmethod.latin.utils.LanguageOnSpacebarUtils.FORMAT
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.view.inputmethod.InputMethodSubtype;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.latin.RichInputMethodManager;
import com.android.inputmethod.latin.RichInputMethodSubtype;
import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils;
import com.android.inputmethod.latin.utils.LanguageOnSpacebarUtils;
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Locale;
import javax.annotation.Nonnull;
@SmallTest
-public class LanguageOnSpacebarUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class LanguageOnSpacebarUtilsTests {
private RichInputMethodManager mRichImm;
RichInputMethodSubtype EN_US_QWERTY;
@@ -50,10 +59,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 +107,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 +122,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 +141,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 +151,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 +169,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 +185,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 +205,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..0908f2b54 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 androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.inputmethod.latin.common.Constants;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Locale;
@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..4aab96a55 100644
--- a/tests/src/com/android/inputmethod/latin/utils/ResourceUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/ResourceUtilsTests.java
@@ -16,13 +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 static org.junit.Assert.assertNull;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.HashMap;
@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 +77,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 +122,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..a5987cf13 100644
--- a/tests/src/com/android/inputmethod/latin/utils/SpannableStringUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/SpannableStringUtilsTests.java
@@ -16,17 +16,33 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.text.style.SuggestionSpan;
-import android.text.style.URLSpan;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.content.Context;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.SpannedString;
+import android.text.style.SuggestionSpan;
+import android.text.style.URLSpan;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+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 +103,7 @@ public class SpannableStringUtilsTests extends AndroidTestCase {
assertTrue(false);
}
+ @Test
public void testSplitCharSequenceWithSpan() {
// text: " a bcd efg hij "
// span1: ^^^^^^^
@@ -182,6 +199,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..6764fd880 100644
--- a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java
@@ -16,22 +16,35 @@
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.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.RichInputMethodManager;
import com.android.inputmethod.latin.RichInputMethodSubtype;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Locale;
@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 +77,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 +148,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 +171,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 +236,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 +278,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 +338,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 +380,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 +422,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 +450,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 +470,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