aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/LanguageOnSpacebarHelperTests.java167
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/NeedsToDisplayLanguageTests.java80
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/DevanagariLetterConstants.java75
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Hindi.java55
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java216
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java38
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java47
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java37
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java75
-rw-r--r--tests/src/com/android/inputmethod/latin/InputTestsBase.java5
12 files changed, 671 insertions, 129 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
index bbffc8dd5..d6d12ea56 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
@@ -25,7 +25,7 @@ import java.util.ArrayList;
@SmallTest
public class KeyboardLayoutSetSubtypesCountTests extends KeyboardLayoutSetTestsBase {
- private static final int NUMBER_OF_SUBTYPES = 66;
+ private static final int NUMBER_OF_SUBTYPES = 67;
private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 42;
private static final int NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES = 2;
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/LanguageOnSpacebarHelperTests.java b/tests/src/com/android/inputmethod/keyboard/internal/LanguageOnSpacebarHelperTests.java
new file mode 100644
index 000000000..0be1e374c
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/internal/LanguageOnSpacebarHelperTests.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2014 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.keyboard.internal;
+
+import static com.android.inputmethod.keyboard.internal.LanguageOnSpacebarHelper.FORMAT_TYPE_FULL_LOCALE;
+import static com.android.inputmethod.keyboard.internal.LanguageOnSpacebarHelper.FORMAT_TYPE_LANGUAGE_ONLY;
+import static com.android.inputmethod.keyboard.internal.LanguageOnSpacebarHelper.FORMAT_TYPE_NONE;
+
+import android.content.Context;
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.RichInputMethodManager;
+import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+
+@SmallTest
+public class LanguageOnSpacebarHelperTests extends AndroidTestCase {
+ private final LanguageOnSpacebarHelper mLanguageOnSpacebarHelper =
+ new LanguageOnSpacebarHelper();
+
+ private RichInputMethodManager mRichImm;
+
+ InputMethodSubtype EN_US_QWERTY;
+ InputMethodSubtype EN_GB_QWERTY;
+ InputMethodSubtype FR_AZERTY;
+ InputMethodSubtype FR_CA_QWERTY;
+ InputMethodSubtype FR_CH_SWISS;
+ InputMethodSubtype FR_CH_QWERTY;
+ InputMethodSubtype FR_CH_QWERTZ;
+ InputMethodSubtype ZZ_QWERTY;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ final Context context = getContext();
+ RichInputMethodManager.init(context);
+ mRichImm = RichInputMethodManager.getInstance();
+ SubtypeLocaleUtils.init(context);
+
+ EN_US_QWERTY = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
+ Locale.US.toString(), "qwerty");
+ EN_GB_QWERTY = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
+ Locale.UK.toString(), "qwerty");
+ FR_AZERTY = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
+ Locale.FRENCH.toString(), "azerty");
+ FR_CA_QWERTY = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
+ Locale.CANADA_FRENCH.toString(), "qwerty");
+ FR_CH_SWISS = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
+ "fr_CH", "swiss");
+ FR_CH_QWERTZ = AdditionalSubtypeUtils.createAdditionalSubtype(
+ "fr_CH", "qwertz", null);
+ FR_CH_QWERTY = AdditionalSubtypeUtils.createAdditionalSubtype(
+ "fr_CH", "qwerty", null);
+ ZZ_QWERTY = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
+ SubtypeLocaleUtils.NO_LANGUAGE, "qwerty");
+ }
+
+ private static List<InputMethodSubtype> asList(final InputMethodSubtype ... subtypes) {
+ return Arrays.asList(subtypes);
+ }
+
+ public void testOneSubtype() {
+ mLanguageOnSpacebarHelper.updateEnabledSubtypes(asList(EN_US_QWERTY));
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(true /* isSame */);
+ assertEquals("one same English (US)", FORMAT_TYPE_NONE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(EN_US_QWERTY));
+ assertEquals("one same NoLanguage", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(ZZ_QWERTY));
+
+ mLanguageOnSpacebarHelper.updateEnabledSubtypes(asList(FR_AZERTY));
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(false /* isSame */);
+ assertEquals("one diff English (US)", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(EN_US_QWERTY));
+ assertEquals("one diff NoLanguage", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(ZZ_QWERTY));
+ }
+
+ public void testTwoSubtypes() {
+ mLanguageOnSpacebarHelper.updateEnabledSubtypes(asList(EN_US_QWERTY, FR_AZERTY));
+
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(true /* isSame */);
+ assertEquals("two same English (US)", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(EN_US_QWERTY));
+ assertEquals("two same French)", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_AZERTY));
+ assertEquals("two same NoLanguage", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(ZZ_QWERTY));
+
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(false /* isSame */);
+ assertEquals("two diff English (US)", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(EN_US_QWERTY));
+ assertEquals("two diff French", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_AZERTY));
+ assertEquals("two diff NoLanguage", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(ZZ_QWERTY));
+ }
+
+ public void testSameLanuageSubtypes() {
+ mLanguageOnSpacebarHelper.updateEnabledSubtypes(
+ asList(EN_US_QWERTY, EN_GB_QWERTY, FR_AZERTY, ZZ_QWERTY));
+
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(true /* isSame */);
+ assertEquals("two same English (US)", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(EN_US_QWERTY));
+ assertEquals("two same English (UK)", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(EN_GB_QWERTY));
+ assertEquals("two same NoLanguage", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(ZZ_QWERTY));
+
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(false /* isSame */);
+ assertEquals("two diff English (US)", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(EN_US_QWERTY));
+ assertEquals("two diff English (UK)", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(EN_GB_QWERTY));
+ assertEquals("two diff NoLanguage", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(ZZ_QWERTY));
+ }
+
+ public void testMultiSameLanuageSubtypes() {
+ mLanguageOnSpacebarHelper.updateEnabledSubtypes(
+ asList(FR_AZERTY, FR_CA_QWERTY, FR_CH_SWISS, FR_CH_QWERTY, FR_CH_QWERTZ));
+
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(true /* isSame */);
+ assertEquals("multi same French", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_AZERTY));
+ assertEquals("multi same French (CA)", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_CA_QWERTY));
+ assertEquals("multi same French (CH)", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_CH_SWISS));
+ assertEquals("multi same French (CH) (QWERTY)", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_CH_QWERTY));
+ assertEquals("multi same French (CH) (QWERTZ)", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_CH_QWERTZ));
+
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(false /* isSame */);
+ assertEquals("multi diff French", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_AZERTY));
+ assertEquals("multi diff French (CA)", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_CA_QWERTY));
+ assertEquals("multi diff French (CH)", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_CH_SWISS));
+ assertEquals("multi diff French (CH) (QWERTY)", FORMAT_TYPE_FULL_LOCALE,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_CH_QWERTY));
+ assertEquals("multi diff French (CH) (QWERTZ)", FORMAT_TYPE_LANGUAGE_ONLY,
+ mLanguageOnSpacebarHelper.getLanguageOnSpacebarFormatType(FR_CH_QWERTZ));
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/NeedsToDisplayLanguageTests.java b/tests/src/com/android/inputmethod/keyboard/internal/NeedsToDisplayLanguageTests.java
deleted file mode 100644
index e03bce1e0..000000000
--- a/tests/src/com/android/inputmethod/keyboard/internal/NeedsToDisplayLanguageTests.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2014 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.keyboard.internal;
-
-import android.content.Context;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.view.inputmethod.InputMethodSubtype;
-
-import com.android.inputmethod.latin.RichInputMethodManager;
-import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
-
-import java.util.Locale;
-
-@SmallTest
-public class NeedsToDisplayLanguageTests extends AndroidTestCase {
- private final NeedsToDisplayLanguage mNeedsToDisplayLanguage = new NeedsToDisplayLanguage();
-
- private RichInputMethodManager mRichImm;
-
- InputMethodSubtype EN_US;
- InputMethodSubtype FR;
- InputMethodSubtype ZZ;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- final Context context = getContext();
- RichInputMethodManager.init(context);
- mRichImm = RichInputMethodManager.getInstance();
- SubtypeLocaleUtils.init(context);
-
- EN_US = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
- Locale.US.toString(), "qwerty");
- FR = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
- Locale.FRENCH.toString(), "azerty");
- ZZ = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
- SubtypeLocaleUtils.NO_LANGUAGE, "qwerty");
- }
-
- public void testOneSubtype() {
- mNeedsToDisplayLanguage.updateEnabledSubtypeCount(1);
-
- mNeedsToDisplayLanguage.updateIsSystemLanguageSameAsInputLanguage(true /* isSame */);
- assertFalse("one same English (US)", mNeedsToDisplayLanguage.needsToDisplayLanguage(EN_US));
- assertTrue("one same NoLanguage", mNeedsToDisplayLanguage.needsToDisplayLanguage(ZZ));
-
- mNeedsToDisplayLanguage.updateIsSystemLanguageSameAsInputLanguage(false /* isSame */);
- assertTrue("one diff English (US)", mNeedsToDisplayLanguage.needsToDisplayLanguage(EN_US));
- assertTrue("one diff NoLanguage", mNeedsToDisplayLanguage.needsToDisplayLanguage(ZZ));
- }
-
- public void testTwoSubtype() {
- mNeedsToDisplayLanguage.updateEnabledSubtypeCount(2);
-
- mNeedsToDisplayLanguage.updateIsSystemLanguageSameAsInputLanguage(true /* isSame */);
- assertTrue("two same English (US)", mNeedsToDisplayLanguage.needsToDisplayLanguage(EN_US));
- assertTrue("two same French", mNeedsToDisplayLanguage.needsToDisplayLanguage(FR));
- assertTrue("two same NoLanguage", mNeedsToDisplayLanguage.needsToDisplayLanguage(ZZ));
-
- mNeedsToDisplayLanguage.updateIsSystemLanguageSameAsInputLanguage(false /* isSame */);
- assertTrue("two diff English (US)", mNeedsToDisplayLanguage.needsToDisplayLanguage(EN_US));
- assertTrue("two diff French", mNeedsToDisplayLanguage.needsToDisplayLanguage(ZZ));
- assertTrue("two diff NoLanguage", mNeedsToDisplayLanguage.needsToDisplayLanguage(FR));
- }
-}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/DevanagariLetterConstants.java b/tests/src/com/android/inputmethod/keyboard/layout/DevanagariLetterConstants.java
new file mode 100644
index 000000000..bcf06f085
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/DevanagariLetterConstants.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2014 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.keyboard.layout;
+
+import android.os.Build;
+
+/**
+ * This class offers label strings of Devanagari letters that need the dotted circle to draw
+ * its glyph.
+ */
+class DevanagariLetterConstants {
+ private static final boolean NEEDS_DOTTED_CIRCLE =
+ Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN;
+ // U+25CC: "◌" DOTTED CIRCLE
+ private static final String DOTTED_CIRCLE = NEEDS_DOTTED_CIRCLE ? "\u25CC" : "";
+
+ // U+0901: "ँ" DEVANAGARI SIGN CANDRABINDU
+ static final String SIGN_CANDRABINDU = DOTTED_CIRCLE + "\u0901";
+ // U+0902: "ं" DEVANAGARI SIGN ANUSVARA
+ static final String SIGN_ANUSVARA = DOTTED_CIRCLE + "\u0902";
+ // U+0903: "ः" DEVANAGARI SIGN VISARGA
+ static final String SIGN_VISARGA = DOTTED_CIRCLE + "\u0903";
+ // U+093C: "़" DEVANAGARI SIGN NUKTA
+ static final String SIGN_NUKTA = DOTTED_CIRCLE + "\u093C";
+ // U+093D: "ऽ" DEVANAGARI SIGN AVAGRAHA
+ static final String SIGN_AVAGRAHA = DOTTED_CIRCLE + "\u093D";
+ // U+093E: "ा" DEVANAGARI VOWEL SIGN AA
+ static final String VOWEL_SIGN_AA = DOTTED_CIRCLE + "\u093E";
+ // U+093F: "ि" DEVANAGARI VOWEL SIGN I
+ static final String VOWEL_SIGN_I = DOTTED_CIRCLE + "\u093F";
+ // U+0940: "ी" DEVANAGARI VOWEL SIGN II
+ static final String VOWEL_SIGN_II = DOTTED_CIRCLE + "\u0940";
+ // U+0941: "ु" DEVANAGARI VOWEL SIGN U
+ static final String VOWEL_SIGN_U = DOTTED_CIRCLE + "\u0941";
+ // U+0942: "ू" DEVANAGARI VOWEL SIGN UU
+ static final String VOWEL_SIGN_UU = DOTTED_CIRCLE + "\u0942";
+ // U+0943: "ृ" DEVANAGARI VOWEL SIGN VOCALIC R
+ static final String VOWEL_SIGN_VOCALIC_R = DOTTED_CIRCLE + "\u0943";
+ // U+0944: "ॄ" DEVANAGARI VOWEL SIGN VOCALIC RR
+ static final String VOWEL_SIGN_VOCALIC_RR = DOTTED_CIRCLE + "\u0944";
+ // U+0945: "ॅ" DEVANAGARI VOWEL SIGN CANDRA E
+ static final String VOWEL_SIGN_CANDRA_E = DOTTED_CIRCLE + "\u0945";
+ // U+0947: "े" DEVANAGARI VOWEL SIGN E
+ static final String VOWEL_SIGN_E = DOTTED_CIRCLE + "\u0947";
+ // U+0948: "ै" DEVANAGARI VOWEL SIGN AI
+ static final String VOWEL_SIGN_AI = DOTTED_CIRCLE + "\u0948";
+ // U+0949: "ॉ" DEVANAGARI VOWEL SIGN CANDRA O
+ static final String VOWEL_SIGN_CANDRA_O = DOTTED_CIRCLE + "\u0949";
+ // U+094A: "ॊ" DEVANAGARI VOWEL SIGN SHORT O
+ static final String VOWEL_SIGN_SHORT_O = DOTTED_CIRCLE + "\u094A";
+ // U+094B: "ो" DEVANAGARI VOWEL SIGN O
+ static final String VOWEL_SIGN_O = DOTTED_CIRCLE + "\u094B";
+ // U+094C: "ौ" DEVANAGARI VOWEL SIGN AU
+ static final String VOWEL_SIGN_AU = DOTTED_CIRCLE + "\u094C";
+ // U+094D: "्" DEVANAGARI SIGN VIRAMA
+ static final String SIGN_VIRAMA = DOTTED_CIRCLE + "\u094D";
+ // U+0970: "॰" DEVANAGARI ABBREVIATION SIGN
+ static final String ABBREVIATION_SIGN = DOTTED_CIRCLE + "\u0970";
+ // U+097D: "ॽ" DEVANAGARI LETTER GLOTTAL STOP
+ static final String LETTER_GLOTTAL_STOP = DOTTED_CIRCLE + "\u097D";
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java
index 7ff2dcbbc..c3f45313f 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.keyboard.layout;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.*;
+
import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
@@ -96,25 +98,37 @@ public final class Hindi extends LayoutBase {
// U+094C: "ौ" DEVANAGARI VOWEL SIGN AU
// U+094C/U+0902: "ौं" DEVANAGARI VOWEL SIGN AU/DEVANAGARI SIGN ANUSVARA
// U+0967: "१" DEVANAGARI DIGIT ONE
- key("\u094C", joinMoreKeys("\u094C\u0902", "\u0967", "1")),
+ key(VOWEL_SIGN_AU, "\u094C", joinMoreKeys(
+ moreKey(VOWEL_SIGN_AU + "\u0902", "\u094C\u0902"),
+ "\u0967", "1")),
// U+0948: "ै" DEVANAGARI VOWEL SIGN AI
// U+0948/U+0902: "ैं" DEVANAGARI VOWEL SIGN AI/DEVANAGARI SIGN ANUSVARA
// U+0968: "२" DEVANAGARI DIGIT TWO
- key("\u0948", joinMoreKeys("\u0948\u0902", "\u0968", "2")),
+ key(VOWEL_SIGN_AI, "\u0948", joinMoreKeys(
+ moreKey(VOWEL_SIGN_AI + "\u0902", "\u0948\u0902"),
+ "\u0968", "2")),
// U+093E: "ा" DEVANAGARI VOWEL SIGN AA
// U+093E/U+0902: "ां" DEVANAGARI VOWEL SIGN AA/DEVANAGARI SIGN ANUSVARA
// U+093E/U+0901: "ाँ" DEVANAGARI VOWEL SIGN AA/DEVANAGARI SIGN CANDRABINDU
// U+0969: "३" DEVANAGARI DIGIT THREE
- key("\u093E", joinMoreKeys("\u093E\u0902", "\u093E\u0901", "\u0969", "3")),
+ key(VOWEL_SIGN_AA, "\u093E", joinMoreKeys(
+ moreKey(VOWEL_SIGN_AA + "\u0902", "\u093E\u0902"),
+ moreKey(VOWEL_SIGN_AA + "\u0901", "\u093E\u0901"),
+ "\u0969", "3")),
// U+0940: "ी" DEVANAGARI VOWEL SIGN II
// U+0940/U+0902: "ीं" DEVANAGARI VOWEL SIGN II/DEVANAGARI SIGN ANUSVARA
// U+096A: "४" DEVANAGARI DIGIT FOUR
- key("\u0940", joinMoreKeys("\u0940\u0902", "\u096A", "4")),
+ key(VOWEL_SIGN_II, "\u0940", joinMoreKeys(
+ moreKey(VOWEL_SIGN_II + "\u0902", "\u0940\u0902"),
+ "\u096A", "4")),
// U+0942: "ू" DEVANAGARI VOWEL SIGN UU
// U+0942/U+0902: "ूं" DEVANAGARI VOWEL SIGN UU/DEVANAGARI SIGN ANUSVARA
// U+0942/U+0901: "ूँ" DEVANAGARI VOWEL SIGN UU/DEVANAGARI SIGN CANDRABINDU
// U+096B: "५" DEVANAGARI DIGIT FIVE
- key("\u0942", joinMoreKeys("\u0942\u0902", "\u0942\u0901", "\u096B", "5")),
+ key(VOWEL_SIGN_UU, "\u0942", joinMoreKeys(
+ moreKey(VOWEL_SIGN_UU + "\u0902", "\u0942\u0902"),
+ moreKey(VOWEL_SIGN_UU + "\u0901", "\u0942\u0901"),
+ "\u096B", "5")),
// U+092C: "ब" DEVANAGARI LETTER BA
// U+092C/U+0952: "ब॒" DEVANAGARI LETTER BA/DEVANAGARI STRESS SIGN ANUDATTA
// U+096C: "६" DEVANAGARI DIGIT SIX
@@ -150,19 +164,26 @@ public final class Hindi extends LayoutBase {
// U+094B/U+0902: "қं" DEVANAGARI VOWEL SIGN O/DEVANAGARI SIGN ANUSVARA
// U+0949: "ॉ" DEVANAGARI VOWEL SIGN CANDRA O
// U+094A: "ॊ" DEVANAGARI VOWEL SIGN SHORT O
- key("\u094B", joinMoreKeys("\u094B\u0902", "\u0949", "\u094A")),
+ key(VOWEL_SIGN_O, "\u094B", joinMoreKeys(
+ moreKey(VOWEL_SIGN_O + "\u0902", "\u094B\u0902"),
+ moreKey(VOWEL_SIGN_CANDRA_O, "\u0949"),
+ moreKey(VOWEL_SIGN_SHORT_O, "\u094A"))),
// U+0947: "े" DEVANAGARI VOWEL SIGN E
// U+0947/U+0902: "ें" DEVANAGARI VOWEL SIGN E/DEVANAGARI SIGN ANUSVARA
- key("\u0947", moreKey("\u0947\u0902")),
+ key(VOWEL_SIGN_E, "\u0947",
+ moreKey(VOWEL_SIGN_E + "\u0902", "\u0947\u0902")),
// U+094D: "्" DEVANAGARI SIGN VIRAMA
- "\u094D",
+ key(SIGN_VIRAMA, "\u094D"),
// U+093F: "ि" DEVANAGARI VOWEL SIGN I
// U+093F/U+0902: "िं" DEVANAGARI VOWEL SIGN I/DEVANAGARI SIGN ANUSVARA
- key("\u093F", moreKey("\u093F\u0902")),
+ key(VOWEL_SIGN_I, "\u093F",
+ moreKey("\u093F" + SIGN_ANUSVARA, "\u093F\u0902")),
// U+0941: "ु" DEVANAGARI VOWEL SIGN U
// U+0941/U+0902: "ुं" DEVANAGARI VOWEL SIGN U/DEVANAGARI SIGN ANUSVARA
// U+0941/U+0901: "ुँ" DEVANAGARI VOWEL SIGN U/DEVANAGARI SIGN CANDRABINDU
- key("\u0941", joinMoreKeys("\u0941\u0902", "\u0941\u0901")),
+ key(VOWEL_SIGN_U, "\u0941", joinMoreKeys(
+ moreKey(VOWEL_SIGN_U + "\u0902", "\u0941\u0902"),
+ moreKey(VOWEL_SIGN_U + "\u0901", "\u0941\u0901"))),
// U+092A: "प" DEVANAGARI LETTER PA
"\u092A",
// U+0930: "र" DEVANAGARI LETTER RA
@@ -182,8 +203,9 @@ public final class Hindi extends LayoutBase {
"\u091A","\u091F")
.setKeysOfRow(3,
// U+0949: "ॉ" DEVANAGARI VOWEL SIGN CANDRA O
+ key(VOWEL_SIGN_CANDRA_O, "\u0949"),
// U+0902: "ं" DEVANAGARI SIGN ANUSVARA
- "\u0949", "\u0902",
+ key(SIGN_ANUSVARA, "\u0902"),
// U+092E: "म" DEVANAGARI LETTER MA
// U+0950: "ॐ" DEVANAGARI OM
key("\u092E", moreKey("\u0950")),
@@ -207,7 +229,10 @@ public final class Hindi extends LayoutBase {
// U+097D: "ॽ" DEVANAGARI LETTER GLOTTAL STOP
// U+0970: "॰" DEVANAGARI ABBREVIATION SIGN
// U+093D: "ऽ" DEVANAGARI SIGN AVAGRAHA
- key("\u093C", joinMoreKeys("\u097D", "\u0970", "\u093D")))
+ key(SIGN_NUKTA, "\u093C", joinMoreKeys(
+ moreKey(LETTER_GLOTTAL_STOP, "\u097D"),
+ moreKey(ABBREVIATION_SIGN, "\u0970"),
+ moreKey(SIGN_AVAGRAHA, "\u093D"))))
.build();
private static final ExpectedKey[][] ALPHABET_SHIFTED_COMMON = new ExpectedKeyboardBuilder()
@@ -232,7 +257,7 @@ public final class Hindi extends LayoutBase {
// U+092D: "भ" DEVANAGARI LETTER BHA
// U+0903: "ः" DEVANAGARI SIGN VISARGA
// U+0918: "घ" DEVANAGARI LETTER GHA
- "\u092D", "\u0903", "\u0918",
+ "\u092D", key(SIGN_VISARGA, "\u0903"), "\u0918",
// U+0927: "ध" DEVANAGARI LETTER DHA
// U+0915/U+094D/U+0937:
// "क्ष" DEVANAGARI LETTER KA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER SSA
@@ -285,7 +310,7 @@ public final class Hindi extends LayoutBase {
"\u0911",
// U+0901: "ँ" DEVANAGARI SIGN CANDRABINDU
// U+0945: "ॅ" DEVANAGARI VOWEL SIGN CANDRA E
- key("\u0901", moreKey("\u0945")),
+ key(SIGN_CANDRABINDU, "\u0901", moreKey(VOWEL_SIGN_CANDRA_E, "\u0945")),
// U+0923: "ण" DEVANAGARI LETTER NNA
// U+0929: "ऩ" DEVANAGARI LETTER NNNA
"\u0923", "\u0929",
@@ -297,7 +322,7 @@ public final class Hindi extends LayoutBase {
"\u0936", "\u0937",
// U+0943: "ृ" DEVANAGARI VOWEL SIGN VOCALIC R
// U+0944: "ॄ" DEVANAGARI VOWEL SIGN VOCALIC RR
- key("\u0943", moreKey("\u0944")),
+ key(VOWEL_SIGN_VOCALIC_R, "\u0943", moreKey(VOWEL_SIGN_VOCALIC_RR, "\u0944")),
// U+091E: "ञ" DEVANAGARI LETTER NYA
"\u091E")
.build();
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java b/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java
new file mode 100644
index 000000000..afd26e428
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2014 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.keyboard.layout;
+
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.SIGN_ANUSVARA;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.SIGN_CANDRABINDU;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.SIGN_NUKTA;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.SIGN_VIRAMA;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.SIGN_VISARGA;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_AA;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_AI;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_AU;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_CANDRA_E;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_CANDRA_O;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_E;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_I;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_II;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_O;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_U;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_UU;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.VOWEL_SIGN_VOCALIC_R;
+
+import com.android.inputmethod.keyboard.layout.Hindi.HindiCustomizer;
+import com.android.inputmethod.keyboard.layout.Hindi.HindiSymbols;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+import com.android.inputmethod.latin.Constants;
+
+import java.util.Locale;
+
+/**
+ * The Hindi Compact keyboard.
+ */
+public final class HindiCompact extends LayoutBase {
+ private static final String LAYOUT_NAME = "hindi_compact";
+
+ public HindiCompact(final LayoutCustomizer customizer) {
+ super(customizer, HindiSymbols.class, SymbolsShifted.class);
+ }
+
+ @Override
+ public String getName() { return LAYOUT_NAME; }
+
+ public static class HindiCompactCustomizer extends HindiCustomizer {
+ public HindiCompactCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
+ return EMPTY_KEYS;
+ }
+
+ @Override
+ public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
+ // U+0964: "।" DEVANAGARI DANDA
+ final ExpectedKey periodKey = key("\u0964", getPunctuationMoreKeys(isPhone));
+ return isPhone ? joinKeys(periodKey) : joinKeys(",", periodKey);
+ }
+
+ @Override
+ public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) {
+ return isPhone ? HINDI_PHONE_PUNCTUATION_MORE_KEYS : HINDI_TABLET_PUNCTUATION_MORE_KEYS;
+ }
+
+ // Punctuation more keys for phone form factor.
+ private static final ExpectedKey[] HINDI_PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
+ ",", ".", "?", "!", "#", ")", "(", "/", ";",
+ "'", "@", ":", "-", "\"", "+", "%", "&");
+ // Punctuation more keys for tablet form factor.
+ private static final ExpectedKey[] HINDI_TABLET_PUNCTUATION_MORE_KEYS = joinKeys(
+ ",", ".", "'", "#", ")", "(", "/", ";",
+ "@", ":", "-", "\"", "+", "%", "&");
+ }
+
+ @Override
+ ExpectedKey[][] getCommonAlphabetLayout(boolean isPhone) { return ALPHABET_COMMON; }
+
+ @Override
+ ExpectedKey[][] getCommonAlphabetShiftLayout(boolean isPhone, final int elementId) {
+ return null;
+ }
+
+ private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
+ .setKeysOfRow(1,
+ // U+0914: "औ" DEVANAGARI LETTER AU
+ // U+094C: "ौ" DEVANAGARI VOWEL SIGN AU
+ // U+0967: "१" DEVANAGARI DIGIT ONE
+ key("\u0914", joinMoreKeys(moreKey(VOWEL_SIGN_AU, "\u094C"), "\u0967", "1")),
+ // U+0910: "ऐ" DEVANAGARI LETTER AI
+ // U+0948: "ै" DEVANAGARI VOWEL SIGN AI
+ // U+0968: "२" DEVANAGARI DIGIT TWO
+ key("\u0910", joinMoreKeys(moreKey(VOWEL_SIGN_AI, "\u0948"), "\u0968", "2")),
+ // U+0906: "आ" DEVANAGARI LETTER AA
+ // U+093E: "ा" DEVANAGARI VOWEL SIGN AA
+ // U+0969: "३" DEVANAGARI DIGIT THREE
+ key("\u0906", joinMoreKeys(moreKey(VOWEL_SIGN_AA, "\u093E"), "\u0969", "3")),
+ // U+0908: "ई" DEVANAGARI LETTER II
+ // U+0940: "ी" DEVANAGARI VOWEL SIGN II
+ // U+096A: "४" DEVANAGARI DIGIT FOUR
+ key("\u0908", joinMoreKeys(moreKey(VOWEL_SIGN_II, "\u0940"), "\u096A", "4")),
+ // U+090A: "ऊ" DEVANAGARI LETTER UU
+ // U+0942: "ू" DEVANAGARI VOWEL SIGN UU
+ // U+096B: "५" DEVANAGARI DIGIT FIVE
+ key("\u090A", joinMoreKeys(moreKey(VOWEL_SIGN_UU, "\u0942"), "\u096B", "5")),
+ // U+092C: "ब" DEVANAGARI LETTER BA
+ // U+092D: "भ" DEVANAGARI LETTER BHA
+ // U+096C: "६" DEVANAGARI DIGIT SIX
+ key("\u092C", joinMoreKeys("\u092D", "\u096C", "6")),
+ // U+0939: "ह" DEVANAGARI LETTER HA
+ // U+096D: "७" DEVANAGARI DIGIT SEVEN
+ key("\u0939", joinMoreKeys("\u096D", "7")),
+ // U+0917: "ग" DEVANAGARI LETTER GA
+ // U+0918: "घ" DEVANAGARI LETTER GHA
+ // U+096E: "८" DEVANAGARI DIGIT EIGHT
+ key("\u0917", joinMoreKeys("\u0918", "\u096E", "8")),
+ // U+0926: "द" DEVANAGARI LETTER DA
+ // U+0927: "ध" DEVANAGARI LETTER DHA
+ // U+096F: "९" DEVANAGARI DIGIT NINE
+ key("\u0926", joinMoreKeys("\u0927", "\u096F", "9")),
+ // U+091C: "ज" DEVANAGARI LETTER JA
+ // U+091D: "झ" DEVANAGARI LETTER JHA
+ // U+091C/U+094D/U+091E:
+ // "ज्ञ" DEVANAGARI LETTER JA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER NYA
+ // U+0966: "०" DEVANAGARI DIGIT ZERO
+ key("\u091C", joinMoreKeys("\u091D", "\u091C\u094D\u091E", "\u0966", "0")),
+ // U+0921: "ड" DEVANAGARI LETTER DDA
+ // U+0922: "ढ" DEVANAGARI LETTER DDHA
+ key("\u0921", moreKey("\u0922")))
+ .setKeysOfRow(2,
+ // U+0913: "ओ" DEVANAGARI LETTER O
+ // U+094B: "ो" DEVANAGARI VOWEL SIGN O
+ key("\u0913", moreKey(VOWEL_SIGN_O, "\u094B")),
+ // U+090F: "ए" DEVANAGARI LETTER E
+ // U+0947: "े" DEVANAGARI VOWEL SIGN E
+ key("\u090F", moreKey(VOWEL_SIGN_E, "\u0947")),
+ // U+0905: "अ" DEVANAGARI LETTER A
+ // U+094D: "्" DEVANAGARI SIGN VIRAMA
+ key("\u0905", moreKey(SIGN_VIRAMA, "\u094D")),
+ // U+0907: "इ" DEVANAGARI LETTER I
+ // U+093F: "ि" DEVANAGARI VOWEL SIGN I
+ key("\u0907", moreKey(VOWEL_SIGN_I, "\u093F")),
+ // U+0909: "उ" DEVANAGARI LETTER U
+ // U+0941: "ु" DEVANAGARI VOWEL SIGN U
+ key("\u0909", moreKey(VOWEL_SIGN_U, "\u0941")),
+ // U+092A: "प" DEVANAGARI LETTER PA
+ // U+092B: "फ" DEVANAGARI LETTER PHA
+ key("\u092A", moreKey("\u092B")),
+ // U+0930: "र" DEVANAGARI LETTER RA
+ // U+090B: "ऋ" DEVANAGARI LETTER VOCALIC R
+ // U+0943: "ृ" DEVANAGARI VOWEL SIGN VOCALIC R
+ key("\u0930", joinMoreKeys("\u090B", moreKey(VOWEL_SIGN_VOCALIC_R, "\u0943"))),
+ // U+0915: "क" DEVANAGARI LETTER KA
+ // U+0916: "ख" DEVANAGARI LETTER KHA
+ key("\u0915", moreKey("\u0916")),
+ // U+0924: "त" DEVANAGARI LETTER TA
+ // U+0925: "थ" DEVANAGARI LETTER THA
+ // U+0924/U+094D/U+0930:
+ // "त्र" DEVANAGARI LETTER TA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER RA
+ key("\u0924", joinMoreKeys("\u0925", "\u0924\u094D\u0930")),
+ // U+091A: "च" DEVANAGARI LETTER CA
+ // U+091B: "छ" DEVANAGARI LETTER CHA
+ key("\u091A", moreKey("\u091B")),
+ // U+091F: "ट" DEVANAGARI LETTER TTA
+ // U+0920: "ठ" DEVANAGARI LETTER TTHA
+ key("\u091F", moreKey("\u0920")))
+ .setKeysOfRow(3,
+ // U+0911: "ऑ" DEVANAGARI LETTER CANDRA O
+ // U+0949: "ॉ" DEVANAGARI VOWEL SIGN CANDRA O
+ key("\u0911", moreKey(VOWEL_SIGN_CANDRA_O, "\u0949")),
+ // U+090D: "ऍ" DEVANAGARI LETTER CANDRA E
+ // U+0945: "ॅ" DEVANAGARI VOWEL SIGN CANDRA E
+ key("\u090D", moreKey(VOWEL_SIGN_CANDRA_E, "\u0945")),
+ // U+0902: "ं" DEVANAGARI SIGN ANUSVARA
+ // U+0903: "ः‍" DEVANAGARI SIGN VISARGA
+ // U+0901: "ँ" DEVANAGARI SIGN CANDRABINDU
+ // U+093C: "़" DEVANAGARI SIGN NUKTA
+ key(SIGN_ANUSVARA, "\u0902", joinMoreKeys(
+ moreKey(SIGN_VISARGA, "\u0903"),
+ moreKey(SIGN_CANDRABINDU, "\u0901"),
+ moreKey(SIGN_NUKTA, "\u093C"))),
+ // U+092E: "म" DEVANAGARI LETTER MA
+ // U+0950: "ॐ" DEVANAGARI OM
+ key("\u092E", moreKey("\u0950")),
+ // U+0928: "न" DEVANAGARI LETTER NA
+ // U+0923: "ण" DEVANAGARI LETTER NNA
+ // U+091E: "ञ" DEVANAGARI LETTER NYA
+ // U+0919: "ङ" DEVANAGARI LETTER NGA
+ key("\u0928", joinMoreKeys("\u0923", "\u091E", "\u0919")),
+ // U+0935: "व" DEVANAGARI LETTER VA
+ // U+0932: "ल" DEVANAGARI LETTER LA
+ "\u0935", "\u0932",
+ // U+0938: "स" DEVANAGARI LETTER SA
+ // U+0936: "श" DEVANAGARI LETTER SHA
+ // U+0937: "ष" DEVANAGARI LETTER SSA
+ // U+0936/U+094D/U+0930:
+ // "श्र" DEVANAGARI LETTER SHA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER RA
+ key("\u0938", joinMoreKeys("\u0936", "\u0937", "\u0936\u094D\u0930")),
+ // U+092F: "य" DEVANAGARI LETTER YA
+ // U+0915/U+094D/U+0937:
+ // "क्ष" DEVANAGARI LETTER KA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER SSA
+ "\u092F", "\u0915\u094D\u0937")
+ .build();
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
index 09cc8f9ca..4123a22ef 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
@@ -180,8 +180,7 @@ public abstract class LayoutBase extends AbstractLayoutBase {
* @return the array of {@link ExpectedKey} that are "more keys" of the punctuation key.
*/
public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) {
- return isPhone ? PHONE_PUNCTUATION_MORE_KEYS
- : TABLET_PUNCTUATION_MORE_KEYS;
+ return isPhone ? PHONE_PUNCTUATION_MORE_KEYS : TABLET_PUNCTUATION_MORE_KEYS;
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java b/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java
index 7cfe3444c..7048dbb73 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.keyboard.layout;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.*;
+
import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.layout.Hindi.HindiCustomizer;
import com.android.inputmethod.keyboard.layout.Hindi.HindiSymbols;
@@ -70,13 +72,13 @@ public final class NepaliRomanized extends LayoutBase {
// U+091F: "ट" DEVANAGARI LETTER TTA
// U+0967: "१" DEVANAGARI DIGIT ONE
// U+093C: "़" DEVANAGARI SIGN NUKTA
- key("\u091F", joinMoreKeys("\u0967", "1", "\u093C")),
+ key("\u091F", joinMoreKeys("\u0967", "1", key(SIGN_NUKTA, "\u093C"))),
// U+094C: "ौ" DEVANAGARI VOWEL SIGN AU
// U+0968: "२" DEVANAGARI DIGIT TWO
- key("\u094C", joinMoreKeys("\u0968", "2")),
+ key(VOWEL_SIGN_AU, "\u094C", joinMoreKeys("\u0968", "2")),
// U+0947: "े" DEVANAGARI VOWEL SIGN E
// U+0969: "३" DEVANAGARI DIGIT THREE
- key("\u0947", joinMoreKeys("\u0969", "3")),
+ key(VOWEL_SIGN_E, "\u0947", joinMoreKeys("\u0969", "3")),
// U+0930: "र" DEVANAGARI LETTER RA
// U+096A: "४" DEVANAGARI DIGIT FOUR
key("\u0930", joinMoreKeys("\u096A", "4")),
@@ -88,13 +90,13 @@ public final class NepaliRomanized extends LayoutBase {
key("\u092F", joinMoreKeys("\u096C", "6")),
// U+0941: "ु" DEVANAGARI VOWEL SIGN U
// U+096D: "७" DEVANAGARI DIGIT SEVEN
- key("\u0941", joinMoreKeys("\u096D", "7")),
+ key(VOWEL_SIGN_U, "\u0941", joinMoreKeys("\u096D", "7")),
// U+093F: "ि" DEVANAGARI VOWEL SIGN I
// U+096E: "८" DEVANAGARI DIGIT EIGHT
- key("\u093F", joinMoreKeys("\u096E", "8")),
+ key(VOWEL_SIGN_I, "\u093F", joinMoreKeys("\u096E", "8")),
// U+094B: "ो" DEVANAGARI VOWEL SIGN O
// U+096F: "९" DEVANAGARI DIGIT NINE
- key("\u094B", joinMoreKeys("\u096F", "9")),
+ key(VOWEL_SIGN_O, "\u094B", joinMoreKeys("\u096F", "9")),
// U+092A: "प" DEVANAGARI LETTER PA
// U+0966: "०" DEVANAGARI DIGIT ZERO
key("\u092A", joinMoreKeys("\u0966", "0")),
@@ -102,6 +104,7 @@ public final class NepaliRomanized extends LayoutBase {
"\u0907")
.setKeysOfRow(2,
// U+093E: "ा" DEVANAGARI VOWEL SIGN AA
+ key(VOWEL_SIGN_AA, "\u093E"),
// U+0938: "स" DEVANAGARI LETTER SA
// U+0926: "द" DEVANAGARI LETTER DA
// U+0909: "उ" DEVANAGARI LETTER U
@@ -112,8 +115,8 @@ public final class NepaliRomanized extends LayoutBase {
// U+0932: "ल" DEVANAGARI LETTER LA
// U+090F: "ए" DEVANAGARI LETTER E
// U+0950: "ॐ" DEVANAGARI OM
- "\u093E", "\u0938", "\u0926", "\u0909", "\u0917", "\u0939", "\u091C", "\u0915",
- "\u0932", "\u090F", "\u0950")
+ "\u0938", "\u0926", "\u0909", "\u0917", "\u0939", "\u091C", "\u0915", "\u0932",
+ "\u090F", "\u0950")
.setKeysOfRow(3,
// U+0937: "ष" DEVANAGARI LETTER SSA
// U+0921: "ड" DEVANAGARI LETTER DDA
@@ -127,23 +130,28 @@ public final class NepaliRomanized extends LayoutBase {
// U+093D: "ऽ" DEVANAGARI SIGN AVAGRAHA
key("\u0964", moreKey("\u093D")),
// U+094D: "्" DEVANAGARI SIGN VIRAMA
- "\u094D")
+ key(SIGN_VIRAMA, "\u094D"))
.build();
private static final ExpectedKey[][] ALPHABET_SHIFTED_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+0920: "ठ" DEVANAGARI LETTER TTHA
// U+0914: "औ" DEVANAGARI LETTER AU
+ "\u0920", "\u0914",
// U+0948: "ै" DEVANAGARI VOWEL SIGN AI
+ key(VOWEL_SIGN_AI, "\u0948"),
// U+0943: "ृ" DEVANAGARI VOWEL SIGN VOCALIC R
+ key(VOWEL_SIGN_VOCALIC_R, "\u0943"),
// U+0925: "थ" DEVANAGARI LETTER THA
// U+091E: "ञ" DEVANAGARI LETTER NYA
+ "\u0925", "\u091E",
// U+0942: "ू" DEVANAGARI VOWEL SIGN UU
+ key(VOWEL_SIGN_UU, "\u0942"),
// U+0940: "ी" DEVANAGARI VOWEL SIGN II
+ key(VOWEL_SIGN_II, "\u0940"),
// U+0913: "ओ" DEVANAGARI LETTER O
// U+092B: "फ" DEVANAGARI LETTER PHA
// U+0908: "ई" DEVANAGARI LETTER II
- "\u0920", "\u0914", "\u0948", "\u0943", "\u0925", "\u091E", "\u0942", "\u0940",
"\u0913", "\u092B", "\u0908")
.setKeysOfRow(2,
// U+0906: "आ" DEVANAGARI LETTER AA
@@ -158,18 +166,22 @@ public final class NepaliRomanized extends LayoutBase {
// U+0910: "ऐ" DEVANAGARI LETTER AI
// U+0903: "ः" DEVANAGARI SIGN VISARGA
"\u0906", "\u0936", "\u0927", "\u090A", "\u0918", "\u0905", "\u091D", "\u0916",
- "\u0965", "\u0910", "\u0903")
+ "\u0965", "\u0910", key(SIGN_VISARGA, "\u0903"))
.setKeysOfRow(3,
// U+090B: "ऋ" DEVANAGARI LETTER VOCALIC R
// U+0922: "ढ" DEVANAGARI LETTER DDHA
// U+091B: "छ" DEVANAGARI LETTER CHA
+ "\u090B", "\u0922", "\u091B",
// U+0901: "ँ" DEVANAGARI SIGN CANDRABINDU
+ key(SIGN_CANDRABINDU, "\u0901"),
// U+092D: "भ" DEVANAGARI LETTER BHA
// U+0923: "ण" DEVANAGARI LETTER NNA
+ "\u092D", "\u0923",
// U+0902: "ं" DEVANAGARI SIGN ANUSVARA
+ key(SIGN_ANUSVARA, "\u0902"),
// U+0919: "ङ" DEVANAGARI LETTER NGA
+ "\u0919",
// U+094D: "्" DEVANAGARI SIGN VIRAMA
- "\u090B", "\u0922", "\u091B", "\u0901", "\u092D", "\u0923", "\u0902", "\u0919",
- "\u094D")
+ key(SIGN_VIRAMA, "\u094D"))
.build();
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java b/tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java
index 1599fd7a6..4d6cdedbf 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/NepaliTraditional.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.keyboard.layout;
+import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.*;
+
import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.layout.Hindi.HindiSymbols;
import com.android.inputmethod.keyboard.layout.NepaliRomanized.NepaliRomanizedCustomizer;
@@ -47,7 +49,7 @@ public final class NepaliTraditional extends LayoutBase {
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
if (isPhone) {
// U+094D: "्" DEVANAGARI SIGN VIRAMA
- return joinKeys(key("\u094D", PHONE_PUNCTUATION_MORE_KEYS));
+ return joinKeys(key(SIGN_VIRAMA, "\u094D", PHONE_PUNCTUATION_MORE_KEYS));
}
return super.getKeysRightToSpacebar(isPhone);
}
@@ -61,7 +63,8 @@ public final class NepaliTraditional extends LayoutBase {
// U+0947: "े" DEVANAGARI VOWEL SIGN E
// U+0903: "ः‍" DEVANAGARI SIGN VISARGA
// U+093D: "ऽ" DEVANAGARI SIGN AVAGRAHA
- key("\u0947", joinMoreKeys("\u0903", "\u093D")),
+ key(VOWEL_SIGN_E, "\u0947", joinMoreKeys(
+ moreKey(SIGN_VISARGA, "\u0903"), "\u093D")),
// U+0964: "।" DEVANAGARI DANDA
"\u0964",
// U+0930: "र" DEVANAGARI LETTER RA
@@ -71,14 +74,15 @@ public final class NepaliTraditional extends LayoutBase {
builder.addKeysOnTheRightOfRow(3,
// U+0903: "ः" DEVANAGARI SIGN VISARGA
// U+093D: "ऽ" DEVANAGARI SIGN AVAGRAHA
- key("\u0903", moreKey("\u093D")),
+ key(SIGN_VISARGA, "\u0903", moreKey("\u093D")),
// U+0947: "े" DEVANAGARI VOWEL SIGN E
+ key(VOWEL_SIGN_E, "\u0947"),
// U+0964: "।" DEVANAGARI DANDA
- "\u0947", "\u0964",
+ "\u0964",
// U+0930: "र" DEVANAGARI LETTER RA
key("\u0930", moreKey("!")),
// U+094D: "्" DEVANAGARI SIGN VIRAMA
- key("\u094D", moreKey("?")));
+ key(SIGN_VIRAMA, "\u094D", moreKey("?")));
}
return builder.build();
}
@@ -93,21 +97,23 @@ public final class NepaliTraditional extends LayoutBase {
if (isPhone) {
builder.addKeysOnTheRightOfRow(3,
// U+0902: "ं" DEVANAGARI SIGN ANUSVARA
+ key(SIGN_ANUSVARA, "\u0902"),
// U+0919: "ङ" DEVANAGARI LETTER NGA
- "\u0902", "\u0919",
+ "\u0919",
// U+0948: "ै" DEVANAGARI VOWEL SIGN AI
// U+0936/U+094D/U+0930:
// "श्र" DEVANAGARI LETTER SHA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER RA
- key("\u0948", moreKey("\u0936\u094D\u0930")));
+ key(VOWEL_SIGN_AI, "\u0948", moreKey("\u0936\u094D\u0930")));
} else {
builder.addKeysOnTheRightOfRow(3,
// U+0902: "ं" DEVANAGARI SIGN ANUSVARA
+ key(SIGN_ANUSVARA, "\u0902"),
// U+0919: "ङ" DEVANAGARI LETTER NGA
- "\u0902", "\u0919",
+ "\u0919",
// U+0948: "ै" DEVANAGARI VOWEL SIGN AI
// U+0936/U+094D/U+0930:
// "श्र" DEVANAGARI LETTER SHA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER RA
- key("\u0948", moreKey("\u0936\u094D\u0930")),
+ key(VOWEL_SIGN_AI, "\u0948", moreKey("\u0936\u094D\u0930")),
// U+0930/U+0941: "रु" DEVANAGARI LETTER RA/DEVANAGARI VOWEL SIGN U
key("\u0930\u0941", moreKey("!")),
"?");
@@ -154,16 +160,20 @@ public final class NepaliTraditional extends LayoutBase {
// U+092C: "ब" DEVANAGARI LETTER BA
// U+0915: "क" DEVANAGARI LETTER KA
// U+092E: "म" DEVANAGARI LETTER MA
+ "\u092C", "\u0915", "\u092E",
// U+093E: "ा" DEVANAGARI VOWEL SIGN AA
+ key(VOWEL_SIGN_AA, "\u093E"),
// U+0928: "न" DEVANAGARI LETTER NA
// U+091C: "ज" DEVANAGARI LETTER JA
// U+0935: "व" DEVANAGARI LETTER VA
// U+092A: "प" DEVANAGARI LETTER PA
+ "\u0928", "\u091C", "\u0935", "\u092A",
// U+093F: "ि" DEVANAGARI VOWEL SIGN I
+ key(VOWEL_SIGN_I, "\u093F"),
// U+0938: "स" DEVANAGARI LETTER SA
+ "\u0938",
// U+0941: "ु" DEVANAGARI VOWEL SIGN U
- "\u092C", "\u0915", "\u092E", "\u093E", "\u0928", "\u091C", "\u0935", "\u092A",
- "\u093F", "\u0938", "\u0941")
+ key(VOWEL_SIGN_U, "\u0941"))
.setKeysOfRow(3,
// U+0936: "श" DEVANAGARI LETTER SHA
// U+0939: "ह" DEVANAGARI LETTER HA
@@ -219,34 +229,41 @@ public final class NepaliTraditional extends LayoutBase {
key("\u090F", moreKey("\u0923")),
// U+0943: "ृ" DEVANAGARI VOWEL SIGN VOCALIC R
// U+0913: "ओ" DEVANAGARI LETTER O
- key("\u0943", moreKey("\u0913")))
+ key(VOWEL_SIGN_VOCALIC_R, "\u0943", moreKey("\u0913")))
.setKeysOfRow(2,
// U+0906: "आ" DEVANAGARI LETTER AA
// U+0919/U+094D: "ङ्" DEVANAGARI LETTER NGA/DEVANAGARI SIGN VIRAMA
// U+0921/U+094D/U+0921:
// "ड्ड" DEVANAGARI LETTER DDA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER DDA
+ "\u0906", "\u0919\u094D", "\u0921\u094D\u0921",
// U+0901: "ँ" DEVANAGARI SIGN CANDRABINDU
+ key(SIGN_CANDRABINDU, "\u0901"),
// U+0926/U+094D/U+0926:
// "द्द" DEVANAGARI LETTER DA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER DA
// U+091D: "झ" DEVANAGARI LETTER JHA
+ "\u0926\u094D\u0926", "\u091D",
// U+094B: "ो" DEVANAGARI VOWEL SIGN O
+ key(VOWEL_SIGN_O, "\u094B"),
// U+092B: "फ" DEVANAGARI LETTER PHA
+ "\u092B",
// U+0940: "ी" DEVANAGARI VOWEL SIGN II
+ key(VOWEL_SIGN_II, "\u0940"),
// U+091F/U+094D/U+0920:
// "ट्ठ" DEVANAGARI LETTER TTA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER TTHA
+ "\u091F\u094D\u0920",
// U+0942: "ू" DEVANAGARI VOWEL SIGN UU
- "\u0906", "\u0919\u094D", "\u0921\u094D\u0921", "\u0901", "\u0926\u094D\u0926",
- "\u091D", "\u094B", "\u092B", "\u0940", "\u091F\u094D\u0920", "\u0942")
+ key(VOWEL_SIGN_UU, "\u0942"))
.setKeysOfRow(3,
// U+0915/U+094D: "क्" DEVANAGARI LETTER KA/DEVANAGARI SIGN VIRAMA
// U+0939/U+094D/U+092E:
// "ह्म" DEVANAGARI LETTER HA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER MA
// U+090B: "ऋ" DEVANAGARI LETTER VOCALIC R
// U+0950: "ॐ" DEVANAGARI OM
+ "\u0915\u094D", "\u0939\u094D\u092E", "\u090B", "\u0950",
// U+094C: "ौ" DEVANAGARI VOWEL SIGN AU
+ key(VOWEL_SIGN_AU, "\u094C"),
// U+0926/U+094D/U+092F:
// "द्य" DEVANAGARI LETTER DA/DEVANAGARI SIGN VIRAMA/DEVANAGARI LETTER YA
- "\u0915\u094D", "\u0939\u094D\u092E", "\u090B", "\u0950", "\u094C",
"\u0926\u094D\u092F")
.build();
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java
new file mode 100644
index 000000000..2e676df26
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.keyboard.layout.tests;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import com.android.inputmethod.keyboard.layout.HindiCompact;
+import com.android.inputmethod.keyboard.layout.HindiCompact.HindiCompactCustomizer;
+import com.android.inputmethod.keyboard.layout.LayoutBase;
+
+import java.util.Locale;
+
+/**
+ * hi: Hindi/hindi_compact
+ */
+@SmallTest
+public final class TestsHindiCompact extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("hi");
+ private static final LayoutBase LAYOUT = new HindiCompact(new HindiCompactCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+}
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index b36645289..d2dd29262 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -16,7 +16,10 @@
package com.android.inputmethod.latin;
+import com.android.inputmethod.latin.settings.Settings;
+
import android.test.suitebuilder.annotation.LargeTest;
+import android.text.TextUtils;
import android.view.inputmethod.BaseInputConnection;
@LargeTest
@@ -179,6 +182,8 @@ public class InputLogicTests extends InputTestsBase {
}
public void testDoubleSpace() {
+ // Set default pref just in case
+ setBooleanPreference(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true, true);
// U+1F607 is an emoji
final String[] STRINGS_TO_TYPE =
new String[] { "this ", "a+ ", "\u1F607 ", ".. ", ") ", "( ", "% " };
@@ -200,6 +205,76 @@ public class InputLogicTests extends InputTestsBase {
assertEquals("double space make a period", EXPECTED_RESULT, mEditText.getText().toString());
}
+ private void testDoubleSpacePeriodWithSettings(final boolean expectsPeriod,
+ final Object... settingsKeysValues) {
+ final Object[] oldSettings = new Object[settingsKeysValues.length / 2];
+ final String STRING_WITHOUT_PERIOD = "this ";
+ final String STRING_WITH_PERIOD = "this. ";
+ final String EXPECTED_RESULT = expectsPeriod ? STRING_WITH_PERIOD : STRING_WITHOUT_PERIOD;
+ try {
+ for (int i = 0; i < settingsKeysValues.length; i += 2) {
+ if (settingsKeysValues[i + 1] instanceof String) {
+ oldSettings[i / 2] = setStringPreference((String)settingsKeysValues[i],
+ (String)settingsKeysValues[i + 1], "0");
+ } else {
+ oldSettings[i / 2] = setBooleanPreference((String)settingsKeysValues[i],
+ (Boolean)settingsKeysValues[i + 1], false);
+ }
+ }
+ mLatinIME.loadSettings();
+ mEditText.setText("");
+ type(STRING_WITHOUT_PERIOD);
+ assertEquals("double-space-to-period with specific settings "
+ + TextUtils.join(" ", settingsKeysValues),
+ EXPECTED_RESULT, mEditText.getText().toString());
+ } finally {
+ // Restore old settings
+ for (int i = 0; i < settingsKeysValues.length; i += 2) {
+ if (null == oldSettings[i / 2]) {
+ break;
+ } if (oldSettings[i / 2] instanceof String) {
+ setStringPreference((String)settingsKeysValues[i], (String)oldSettings[i / 2],
+ "");
+ } else {
+ setBooleanPreference((String)settingsKeysValues[i], (Boolean)oldSettings[i / 2],
+ false);
+ }
+ }
+ }
+ }
+
+ public void testDoubleSpacePeriod() {
+ // Reset settings to default, else these tests will go flaky.
+ setStringPreference(Settings.PREF_SHOW_SUGGESTIONS_SETTING, "0", "0");
+ setStringPreference(Settings.PREF_AUTO_CORRECTION_THRESHOLD, "1", "1");
+ setBooleanPreference(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true, true);
+ testDoubleSpacePeriodWithSettings(true /* expectsPeriod */);
+ // "Suggestion visibility" to "always hide"
+ testDoubleSpacePeriodWithSettings(true, Settings.PREF_SHOW_SUGGESTIONS_SETTING, "2");
+ // "Suggestion visibility" to "portrait only"
+ testDoubleSpacePeriodWithSettings(true, Settings.PREF_SHOW_SUGGESTIONS_SETTING, "1");
+ // "Suggestion visibility" to "always show"
+ testDoubleSpacePeriodWithSettings(true, Settings.PREF_SHOW_SUGGESTIONS_SETTING, "0");
+
+ // "Double-space period" to "off"
+ testDoubleSpacePeriodWithSettings(false, Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, false);
+
+ // "Auto-correction" to "off"
+ testDoubleSpacePeriodWithSettings(true, Settings.PREF_AUTO_CORRECTION_THRESHOLD, "0");
+ // "Auto-correction" to "modest"
+ testDoubleSpacePeriodWithSettings(true, Settings.PREF_AUTO_CORRECTION_THRESHOLD, "1");
+ // "Auto-correction" to "very aggressive"
+ testDoubleSpacePeriodWithSettings(true, Settings.PREF_AUTO_CORRECTION_THRESHOLD, "3");
+
+ // "Suggestion visibility" to "always hide" and "Auto-correction" to "off"
+ testDoubleSpacePeriodWithSettings(true, Settings.PREF_SHOW_SUGGESTIONS_SETTING, "0",
+ Settings.PREF_AUTO_CORRECTION_THRESHOLD, "0");
+ // "Suggestion visibility" to "always hide" and "Auto-correction" to "off"
+ testDoubleSpacePeriodWithSettings(false, Settings.PREF_SHOW_SUGGESTIONS_SETTING, "0",
+ Settings.PREF_AUTO_CORRECTION_THRESHOLD, "0",
+ Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, false);
+ }
+
public void testBackspaceAtStartAfterAutocorrect() {
final String STRING_TO_TYPE = "tgis ";
final int typedLength = STRING_TO_TYPE.length();
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
index 690c559e8..1383ff903 100644
--- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java
+++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
@@ -65,7 +65,6 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
protected MyEditText mEditText;
protected View mInputView;
protected InputConnection mInputConnection;
- private boolean mPreviousDebugSetting;
private boolean mPreviousBigramPredictionSettings;
private String mPreviousAutoCorrectSetting;
@@ -185,7 +184,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
mEditText.setEnabled(true);
setupService();
mLatinIME = getService();
- mPreviousDebugSetting = setDebugMode(true);
+ setDebugMode(true);
mPreviousBigramPredictionSettings = setBooleanPreference(Settings.PREF_BIGRAM_PREDICTIONS,
true, true /* defaultValue */);
mPreviousAutoCorrectSetting = setStringPreference(Settings.PREF_AUTO_CORRECTION_THRESHOLD,
@@ -219,7 +218,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
true /* defaultValue */);
setStringPreference(Settings.PREF_AUTO_CORRECTION_THRESHOLD, mPreviousAutoCorrectSetting,
DEFAULT_AUTO_CORRECTION_THRESHOLD);
- setDebugMode(mPreviousDebugSetting);
+ setDebugMode(false);
super.tearDown();
}