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.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/DevanagariLetterConstants.java75
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Greek.java8
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Hindi.java59
-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/GermanCustomizer.java3
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/ItalianCustomizer.java77
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java55
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindiCompact.java37
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java59
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java56
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java36
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java75
-rw-r--r--tests/src/com/android/inputmethod/latin/InputTestsBase.java10
-rw-r--r--tests/src/com/android/inputmethod/latin/ShiftModeTests.java56
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java64
19 files changed, 872 insertions, 106 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
index bbffc8dd5..e4aaf0317 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
@@ -25,8 +25,8 @@ import java.util.ArrayList;
@SmallTest
public class KeyboardLayoutSetSubtypesCountTests extends KeyboardLayoutSetTestsBase {
- private static final int NUMBER_OF_SUBTYPES = 66;
- private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 42;
+ private static final int NUMBER_OF_SUBTYPES = 70;
+ private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 45;
private static final int NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES = 2;
private static String toString(final ArrayList<InputMethodSubtype> subtypeList) {
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/Greek.java b/tests/src/com/android/inputmethod/keyboard/layout/Greek.java
index 0ec9f4cf4..475052c75 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Greek.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Greek.java
@@ -85,7 +85,7 @@ public final class Greek extends LayoutBase {
key(ROW1_2, moreKey("2")),
// U+03B5: "ε" GREEK SMALL LETTER EPSILON
// U+03AD: "έ" GREEK SMALL LETTER EPSILON WITH TONOS
- key("\u03B5", joinMoreKeys("3", "\u03AD")),
+ key("\u03B5", joinMoreKeys("\u03AD", "3")),
// U+03C1: "ρ" GREEK SMALL LETTER RHO
key("\u03C1", moreKey("4")),
// U+03C4: "τ" GREEK SMALL LETTER TAU
@@ -94,17 +94,17 @@ public final class Greek extends LayoutBase {
// U+03CD: "ύ" GREEK SMALL LETTER UPSILON WITH TONOS
// U+03CB: "ϋ" GREEK SMALL LETTER UPSILON WITH DIALYTIKA
// U+03B0: "ΰ" GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
- key("\u03C5", joinMoreKeys("6", "\u03CD", "\u03CB", "\u03B0")),
+ key("\u03C5", joinMoreKeys("\u03CD", "6", "\u03CB", "\u03B0")),
// U+03B8: "θ" GREEK SMALL LETTER THETA
key("\u03B8", moreKey("7")),
// U+03B9: "ι" GREEK SMALL LETTER IOTA
// U+03AF: "ί" GREEK SMALL LETTER IOTA WITH TONOS
// U+03CA: "ϊ" GREEK SMALL LETTER IOTA WITH DIALYTIKA
// U+0390: "ΐ" GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
- key("\u03B9", joinMoreKeys("8", "\u03AF", "\u03CA", "\u0390")),
+ key("\u03B9", joinMoreKeys("\u03AF", "8", "\u03CA", "\u0390")),
// U+03BF: "ο" GREEK SMALL LETTER OMICRON
// U+03CC: "ό" GREEK SMALL LETTER OMICRON WITH TONOS
- key("\u03BF", joinMoreKeys("9", "\u03CC")),
+ key("\u03BF", joinMoreKeys("\u03CC", "9")),
// U+03C0: "π" GREEK SMALL LETTER PI
key("\u03C0", moreKey("0")))
.setKeysOfRow(2,
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java
index 7ff2dcbbc..b12b8be64 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;
@@ -49,7 +51,7 @@ public final class Hindi extends LayoutBase {
public ExpectedKey getBackToSymbolsKey() { return HINDI_BACK_TO_SYMBOLS_KEY; }
@Override
- public ExpectedKey getCurrencyKey() { return CURRENCY_HINDI; }
+ public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
@Override
public ExpectedKey[] getOtherCurrencyKeys() {
@@ -76,7 +78,7 @@ public final class Hindi extends LayoutBase {
Constants.CODE_SHIFT);
// U+20B9: "₹" INDIAN RUPEE SIGN
- private static final ExpectedKey CURRENCY_HINDI = key("\u20B9",
+ private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9",
Symbols.CURRENCY_GENERIC_MORE_KEYS);
}
@@ -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/GermanCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/GermanCustomizer.java
index cd881406e..6d38937aa 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/GermanCustomizer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/GermanCustomizer.java
@@ -53,6 +53,7 @@ class GermanCustomizer extends LayoutCustomizer {
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
.setMoreKeysOf("u", "\u00FC", "\u00FB", "\u00F9", "\u00FA", "\u016B")
+ .setAdditionalMoreKeysPositionOf("u", 2)
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
@@ -64,6 +65,7 @@ class GermanCustomizer extends LayoutCustomizer {
.setMoreKeysOf("o",
"\u00F6", "\u00F4", "\u00F2", "\u00F3", "\u00F5", "\u0153", "\u00F8",
"\u014D")
+ .setAdditionalMoreKeysPositionOf("o", 2)
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
@@ -75,6 +77,7 @@ class GermanCustomizer extends LayoutCustomizer {
.setMoreKeysOf("a",
"\u00E4", "\u00E2", "\u00E0", "\u00E1", "\u00E6", "\u00E3", "\u00E5",
"\u0101")
+ .setAdditionalMoreKeysPositionOf("a", 2)
// U+00DF: "ß" LATIN SMALL LETTER SHARP S
// U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
// U+0161: "š" LATIN SMALL LETTER S WITH CARON
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/ItalianCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/ItalianCustomizer.java
new file mode 100644
index 000000000..735070946
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/ItalianCustomizer.java
@@ -0,0 +1,77 @@
+/*
+ * 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 com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+
+import java.util.Locale;
+
+class ItalianCustomizer extends LayoutCustomizer {
+ public ItalianCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
+ return builder
+ // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+ // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+ // U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
+ // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
+ // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
+ .setMoreKeysOf("e",
+ "\u00E8", "\u00E9", "\u00EA", "\u00EB", "\u0119", "\u0117", "\u0113")
+ // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+ // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
+ .setMoreKeysOf("u", "\u00F9", "\u00FA", "\u00FB", "\u00FC", "\u016B")
+ // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+ // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+ // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
+ // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
+ .setMoreKeysOf("i", "\u00EC", "\u00ED", "\u00EE", "\u00EF", "\u012F", "\u012B")
+ // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+ // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
+ // U+0153: "œ" LATIN SMALL LIGATURE OE
+ // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+ // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+ // U+00BA: "º" MASCULINE ORDINAL INDICATOR
+ .setMoreKeysOf("o",
+ "\u00F2", "\u00F3", "\u00F4", "\u00F6", "\u00F5", "\u0153", "\u00F8",
+ "\u014D", "\u00BA")
+ // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+ // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+ // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+ // U+00E6: "æ" LATIN SMALL LETTER AE
+ // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+ // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+ // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
+ // U+00AA: "ª" FEMININE ORDINAL INDICATOR
+ .setMoreKeysOf("a",
+ "\u00E0", "\u00E1", "\u00E2", "\u00E4", "\u00E6", "\u00E3", "\u00E5",
+ "\u0101", "\u00AA");
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java
new file mode 100644
index 000000000..c80b25024
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishIN.java
@@ -0,0 +1,55 @@
+/*
+ * 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.LayoutBase;
+import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.Symbols;
+import com.android.inputmethod.keyboard.layout.SymbolsShifted;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+
+import java.util.Locale;
+
+/*
+ * en_IN: English (India)/qwerty
+ */
+@SmallTest
+public final class TestsEnglishIN extends TestsEnglishUS {
+ private static final Locale LOCALE = new Locale("en", "IN");
+ private static final LayoutBase LAYOUT = new Qwerty(new EnglishINCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+
+ private static class EnglishINCustomizer extends EnglishCustomizer {
+ public EnglishINCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; }
+
+ @Override
+ public ExpectedKey[] getOtherCurrencyKeys() {
+ return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
+ }
+
+ // U+20B9: "₹" INDIAN RUPEE SIGN
+ private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9",
+ Symbols.CURRENCY_GENERIC_MORE_KEYS);
+ }
+}
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/keyboard/layout/tests/TestsItalian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java
index 4a2200364..f3c610c8b 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalian.java
@@ -31,63 +31,22 @@ import java.util.Locale;
@SmallTest
public final class TestsItalian extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("it");
- private static final LayoutBase LAYOUT = new Qwerty(new ItalianCustomizer(LOCALE));
+ private static final LayoutBase LAYOUT = new Qwerty(new ItalianITCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
- private static class ItalianCustomizer extends EuroCustomizer {
- public ItalianCustomizer(final Locale locale) { super(locale); }
+ private static class ItalianITCustomizer extends EuroCustomizer {
+ private final ItalianCustomizer mItalianCustomizer;
+
+ public ItalianITCustomizer(final Locale locale) {
+ super(locale);
+ mItalianCustomizer = new ItalianCustomizer(locale);
+ }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
- return builder
- // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
- // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
- // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
- // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
- // U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
- // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
- // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
- .setMoreKeysOf("e",
- "\u00E8", "\u00E9", "\u00EA", "\u00EB", "\u0119", "\u0117", "\u0113")
- // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
- // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
- // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
- // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
- // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
- .setMoreKeysOf("u", "\u00F9", "\u00FA", "\u00FB", "\u00FC", "\u016B")
- // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
- // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
- // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
- // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
- // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
- // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
- .setMoreKeysOf("i", "\u00EC", "\u00ED", "\u00EE", "\u00EF", "\u012F", "\u012B")
- // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
- // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
- // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
- // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
- // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
- // U+0153: "œ" LATIN SMALL LIGATURE OE
- // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
- // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
- // U+00BA: "º" MASCULINE ORDINAL INDICATOR
- .setMoreKeysOf("o",
- "\u00F2", "\u00F3", "\u00F4", "\u00F6", "\u00F5", "\u0153", "\u00F8",
- "\u014D", "\u00BA")
- // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
- // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
- // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
- // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
- // U+00E6: "æ" LATIN SMALL LETTER AE
- // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
- // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
- // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
- // U+00AA: "ª" FEMININE ORDINAL INDICATOR
- .setMoreKeysOf("a",
- "\u00E0", "\u00E1", "\u00E2", "\u00E4", "\u00E6", "\u00E3", "\u00E5",
- "\u0101", "\u00AA");
+ return mItalianCustomizer.setAccentedLetters(builder);
}
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java
new file mode 100644
index 000000000..d32f9e957
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsItalianCH.java
@@ -0,0 +1,56 @@
+/*
+ * 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.LayoutBase;
+import com.android.inputmethod.keyboard.layout.Swiss;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+
+import java.util.Locale;
+
+/**
+ * it_CH: Italian (Switzerland)/swiss
+ */
+@SmallTest
+public final class TestsItalianCH extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("it", "CH");
+ private static final LayoutBase LAYOUT = new Swiss(new ItalianCHCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+
+ private static class ItalianCHCustomizer extends ItalianCustomizer {
+ public ItalianCHCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
+ super.setAccentedLetters(builder);
+ return builder
+ // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ .replaceKeyOfLabel(Swiss.ROW1_11, key("\u00FC", moreKey("\u00E8")))
+ // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+ // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ .replaceKeyOfLabel(Swiss.ROW2_10, key("\u00F6", moreKey("\u00E9")))
+ // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+ // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ .replaceKeyOfLabel(Swiss.ROW2_11, key("\u00E4", moreKey("\u00E0")));
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java
new file mode 100644
index 000000000..75aad136f
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSpanish419.java
@@ -0,0 +1,36 @@
+/*
+ * 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.LayoutBase;
+import com.android.inputmethod.keyboard.layout.Spanish;
+
+import java.util.Locale;
+
+/**
+ * es_419: Spanish (Latin America)/spanish
+ */
+@SmallTest
+public class TestsSpanish419 extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("es", "419");
+ private static final LayoutBase LAYOUT = new Spanish(new SpanishCustomizer(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..e5f111ab6 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,
@@ -214,13 +213,18 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
@Override
protected void tearDown() throws Exception {
+ mLatinIME.onFinishInputView(true);
+ mLatinIME.onFinishInput();
+ runMessages();
mLatinIME.mHandler.removeAllMessages();
setBooleanPreference(Settings.PREF_BIGRAM_PREDICTIONS, mPreviousBigramPredictionSettings,
true /* defaultValue */);
setStringPreference(Settings.PREF_AUTO_CORRECTION_THRESHOLD, mPreviousAutoCorrectSetting,
DEFAULT_AUTO_CORRECTION_THRESHOLD);
- setDebugMode(mPreviousDebugSetting);
+ setDebugMode(false);
+ mLatinIME.recycle();
super.tearDown();
+ mLatinIME = null;
}
// We need to run the messages added to the handler from LatinIME. The only way to do
diff --git a/tests/src/com/android/inputmethod/latin/ShiftModeTests.java b/tests/src/com/android/inputmethod/latin/ShiftModeTests.java
new file mode 100644
index 000000000..806fad060
--- /dev/null
+++ b/tests/src/com/android/inputmethod/latin/ShiftModeTests.java
@@ -0,0 +1,56 @@
+/*
+ * 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.latin;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.text.TextUtils;
+import android.view.inputmethod.EditorInfo;
+
+import com.android.inputmethod.latin.Constants;
+import com.android.inputmethod.latin.WordComposer;
+
+@LargeTest
+public class ShiftModeTests extends InputTestsBase {
+
+ @Override
+ protected EditorInfo enrichEditorInfo(final EditorInfo ei) {
+ ei.inputType |= TextUtils.CAP_MODE_SENTENCES;
+ ei.initialCapsMode = TextUtils.CAP_MODE_SENTENCES;
+ return ei;
+ }
+
+ private boolean isCapsModeAutoShifted() {
+ return mLatinIME.mKeyboardSwitcher.getKeyboardShiftMode()
+ == WordComposer.CAPS_MODE_AUTO_SHIFTED;
+ }
+
+ public void testTypicalSentence() {
+ assertTrue("Initial auto caps state", isCapsModeAutoShifted());
+ type("Test");
+ assertFalse("Caps after letter", isCapsModeAutoShifted());
+ type(" ");
+ assertFalse("Caps after space", isCapsModeAutoShifted());
+ type("some,");
+ assertFalse("Caps after comma", isCapsModeAutoShifted());
+ type(" ");
+ assertFalse("Caps after comma space", isCapsModeAutoShifted());
+ type("words.");
+ assertFalse("Caps directly after period", isCapsModeAutoShifted());
+ type(" ");
+ assertTrue("Caps after period space", isCapsModeAutoShifted());
+ }
+}
diff --git a/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
index e55c32bd0..2a4ead383 100644
--- a/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
@@ -308,4 +308,68 @@ public class StringAndJsonUtilsTests extends AndroidTestCase {
assertEquals(objs[i], newObjArray.get(i));
}
}
+
+ 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',
+ 0, 0x2002, 0x2003, 0x3000, 'x', 'x'};
+ final int[] codePointArray = StringUtils.toCodePointArray(STR_WITH_SUPPLEMENTARY_CHAR, 0,
+ STR_WITH_SUPPLEMENTARY_CHAR.length());
+ assertEquals("toCodePointArray, size matches", codePointArray.length,
+ EXPECTED_RESULT.length);
+ for (int i = 0; i < EXPECTED_RESULT.length; ++i) {
+ assertEquals("toCodePointArray position " + i, codePointArray[i], EXPECTED_RESULT[i]);
+ }
+ }
+
+ 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,
+ 'f', 'G', 'h', 0, 0x2002, 0x3000, 'あ', 'x'};
+ final int[] EXPECTED_RESULT_DOWNCASE = new int[] { 'a', 'b', 'c', 'd', 'e', 0x286D7,
+ 'f', 'g', 'h', 0, 0x2002, 0x3000, 'あ', 'x'};
+
+ int[] codePointArray = new int[50];
+ int codePointCount = StringUtils.copyCodePointsAndReturnCodePointCount(codePointArray,
+ STR_WITH_SUPPLEMENTARY_CHAR, 0,
+ STR_WITH_SUPPLEMENTARY_CHAR.length(), false /* downCase */);
+ assertEquals("copyCodePointsAndReturnCodePointCount, size matches", codePointCount,
+ EXPECTED_RESULT.length);
+ for (int i = 0; i < codePointCount; ++i) {
+ assertEquals("copyCodePointsAndReturnCodePointCount position " + i, codePointArray[i],
+ EXPECTED_RESULT[i]);
+ }
+
+ codePointCount = StringUtils.copyCodePointsAndReturnCodePointCount(codePointArray,
+ STR_WITH_SUPPLEMENTARY_CHAR, 0,
+ STR_WITH_SUPPLEMENTARY_CHAR.length(), true /* downCase */);
+ assertEquals("copyCodePointsAndReturnCodePointCount downcase, size matches", codePointCount,
+ EXPECTED_RESULT_DOWNCASE.length);
+ for (int i = 0; i < codePointCount; ++i) {
+ assertEquals("copyCodePointsAndReturnCodePointCount position " + i, codePointArray[i],
+ EXPECTED_RESULT_DOWNCASE[i]);
+ }
+
+ final int JAVA_CHAR_COUNT = 8;
+ final int CODEPOINT_COUNT = 7;
+ codePointCount = StringUtils.copyCodePointsAndReturnCodePointCount(codePointArray,
+ STR_WITH_SUPPLEMENTARY_CHAR, 0, JAVA_CHAR_COUNT, false /* downCase */);
+ assertEquals("copyCodePointsAndReturnCodePointCount, size matches", codePointCount,
+ CODEPOINT_COUNT);
+ for (int i = 0; i < codePointCount; ++i) {
+ assertEquals("copyCodePointsAndReturnCodePointCount position " + i, codePointArray[i],
+ EXPECTED_RESULT[i]);
+ }
+
+ boolean exceptionHappened = false;
+ codePointArray = new int[5];
+ try {
+ codePointCount = StringUtils.copyCodePointsAndReturnCodePointCount(codePointArray,
+ STR_WITH_SUPPLEMENTARY_CHAR, 0, JAVA_CHAR_COUNT, false /* downCase */);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ exceptionHappened = true;
+ }
+ assertTrue("copyCodePointsAndReturnCodePointCount throws when array is too small",
+ exceptionHappened);
+ }
}