aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-09-26 02:28:21 +0900
committerTadashi G. Takaoka <takaoka@google.com>2014-09-26 16:01:34 +0900
commit8108a3e1cdceb1874804f74ec24d824a7df1b669 (patch)
tree06559a6aebed62cd907328606ad65858c48a28cc /tests
parent1c70a8e147cebd045ab4963751bbcb7b9bbc1962 (diff)
downloadlatinime-8108a3e1cdceb1874804f74ec24d824a7df1b669.tar.gz
latinime-8108a3e1cdceb1874804f74ec24d824a7df1b669.tar.xz
latinime-8108a3e1cdceb1874804f74ec24d824a7df1b669.zip
Add Serbian Latin keyboard
Bug: 9687668 Change-Id: I0631ab04cf33e3d454c965e98a756c31666537bf
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionLabelTests.java13
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java57
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/SerbianLatinCustomizer.java82
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java88
7 files changed, 279 insertions, 3 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java
index 89c06a747..25bac9dd4 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 = 80;
- private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 48;
+ private static final int NUMBER_OF_SUBTYPES = 81;
+ private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 49;
private static final int NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES = 2;
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionLabelTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionLabelTests.java
index 3fd3a36fc..74343cb6a 100644
--- a/tests/src/com/android/inputmethod/keyboard/action/KlpActionLabelTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionLabelTests.java
@@ -156,4 +156,17 @@ public class KlpActionLabelTests extends KlpActionTestsBase {
doTestActionKeysInLocaleWithKeyboardTextsSet(hinglish, hi_ZZ, Locale.ITALIAN);
doTestActionKeysInLocaleWithKeyboardTextsSet(hinglish, hi_ZZ, Locale.JAPANESE);
}
+
+ public void testSerbianLatinActionLabel() {
+ final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
+ final Locale sr_ZZ = new Locale("sr", "ZZ");
+ final InputMethodSubtype hinglish = richImm.findSubtypeByLocaleAndKeyboardLayoutSet(
+ sr_ZZ.toString(), "serbian_qwertz");
+ // An action label should be displayed in subtype's locale regardless of the system locale.
+ doTestActionKeysInLocaleWithKeyboardTextsSet(hinglish, sr_ZZ, sr_ZZ);
+ doTestActionKeysInLocaleWithKeyboardTextsSet(hinglish, sr_ZZ, Locale.US);
+ doTestActionKeysInLocaleWithKeyboardTextsSet(hinglish, sr_ZZ, Locale.FRENCH);
+ doTestActionKeysInLocaleWithKeyboardTextsSet(hinglish, sr_ZZ, Locale.ITALIAN);
+ doTestActionKeysInLocaleWithKeyboardTextsSet(hinglish, sr_ZZ, Locale.JAPANESE);
+ }
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
index b05789b73..eb11278d6 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
@@ -310,7 +310,7 @@ public abstract class LayoutBase extends AbstractLayoutBase {
// U+00A1: "¡" INVERTED EXCLAMATION MARK
// U+00BF: "¿" INVERTED QUESTION MARK
- static final ExpectedKey[] EXCLAMATION_AND_QUESTION_MARKS = joinKeys(
+ public static final ExpectedKey[] EXCLAMATION_AND_QUESTION_MARKS = joinKeys(
key("!", moreKey("\u00A1")), key("?", moreKey("\u00BF")));
// U+200C: ZERO WIDTH NON-JOINER
// U+200D: ZERO WIDTH JOINER
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java b/tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java
new file mode 100644
index 000000000..b23fe768e
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/SerbianQwertz.java
@@ -0,0 +1,57 @@
+/*
+ * 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 com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+
+public final class SerbianQwertz extends LayoutBase {
+ private static final String LAYOUT_NAME = "serbian_qwertz";
+
+ public SerbianQwertz(final LayoutCustomizer customizer) {
+ super(customizer, Symbols.class, SymbolsShifted.class);
+ }
+
+ @Override
+ public String getName() { return LAYOUT_NAME; }
+
+ @Override
+ ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; }
+
+ public static final String ROW1_11 = "ROW1_11";
+ public static final String ROW2_10 = "ROW2_10";
+ public static final String ROW2_11 = "ROW2_11";
+ public static final String ROW3_8 = "ROW3_8";
+ public static final String ROW3_9 = "ROW3_9";
+
+ private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
+ .setKeysOfRow(1,
+ key("q", additionalMoreKey("1")),
+ key("w", additionalMoreKey("2")),
+ key("e", additionalMoreKey("3")),
+ key("r", additionalMoreKey("4")),
+ key("t", additionalMoreKey("5")),
+ key("z", additionalMoreKey("6")),
+ key("u", additionalMoreKey("7")),
+ key("i", additionalMoreKey("8")),
+ key("o", additionalMoreKey("9")),
+ key("p", additionalMoreKey("0")),
+ ROW1_11)
+ .setKeysOfRow(2, "a", "s", "d", "f", "g", "h", "j", "k", "l", ROW2_10, ROW2_11)
+ .setKeysOfRow(3, "y", "x", "c", "v", "b", "n", "m", ROW3_8, ROW3_9)
+ .build();
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/SerbianLatinCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/SerbianLatinCustomizer.java
new file mode 100644
index 000000000..3660ce4b7
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/SerbianLatinCustomizer.java
@@ -0,0 +1,82 @@
+/*
+ * 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;
+import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
+import com.android.inputmethod.keyboard.layout.SerbianQwertz;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+
+import java.util.Locale;
+
+class SerbianLatinCustomizer extends LayoutCustomizer {
+ public SerbianLatinCustomizer(final Locale locale) { super(locale); }
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS : LayoutBase.EXCLAMATION_AND_QUESTION_MARKS;
+ }
+
+ protected void setSerbianKeys(final ExpectedKeyboardBuilder builder) {
+ builder
+ // U+0161: "š" LATIN SMALL LETTER S WITH CARON
+ .replaceKeyOfLabel(SerbianQwertz.ROW1_11, "\u0161")
+ // U+010D: "č" LATIN SMALL LETTER C WITH CARON
+ .replaceKeyOfLabel(SerbianQwertz.ROW2_10, "\u010D")
+ // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
+ .replaceKeyOfLabel(SerbianQwertz.ROW2_11, "\u0107")
+ // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE
+ .replaceKeyOfLabel(SerbianQwertz.ROW3_8, "\u0111")
+ // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
+ .replaceKeyOfLabel(SerbianQwertz.ROW3_9, "\u017E");
+ }
+
+ @SuppressWarnings("unused")
+ protected void setMoreKeysOfS(final ExpectedKeyboardBuilder builder) {
+ // Serbian QWERTZ has a dedicated "š" key.
+ }
+
+ @SuppressWarnings("unused")
+ protected void setMoreKeysOfC(final ExpectedKeyboardBuilder builder) {
+ // Serbian QWERTZ has a dedicated "č" and "ć" keys.
+ }
+
+ @SuppressWarnings("unused")
+ protected void setMoreKeysOfD(final ExpectedKeyboardBuilder builder) {
+ // Serbian QWERTZ has a dedicated "đ" key.
+ }
+
+ @SuppressWarnings("unused")
+ protected void setMoreKeysOfZ(final ExpectedKeyboardBuilder builder) {
+ // Serbian QWERTZ has a dedicated "ž" key.
+ }
+
+ @Override
+ public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
+ setSerbianKeys(builder);
+ setMoreKeysOfS(builder);
+ setMoreKeysOfC(builder);
+ setMoreKeysOfD(builder);
+ setMoreKeysOfZ(builder);
+ return builder
+ // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ .setMoreKeysOf("e", "\u00E8")
+ // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+ .setMoreKeysOf("i", "\u00EC");
+ }
+} \ No newline at end of file
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.java
new file mode 100644
index 000000000..70f4bcefd
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatin.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.SerbianQwertz;
+
+import java.util.Locale;
+
+/**
+ * sr_ZZ: Serbian (Latin)/serbian_qwertz
+ */
+@SmallTest
+public final class TestsSerbianLatin extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("sr", "ZZ");
+ private static final LayoutBase LAYOUT = new SerbianQwertz(new SerbianLatinCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java
new file mode 100644
index 000000000..d8ef51b45
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsSerbianLatinQwerty.java
@@ -0,0 +1,88 @@
+/*
+ * 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.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
+
+import java.util.Locale;
+
+/**
+ * sr_ZZ: Serbian (Latin)/qwerty
+ */
+@SmallTest
+public final class TestsSerbianLatinQwerty extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("sr", "ZZ");
+ private static final LayoutBase LAYOUT = new Qwerty(new SerbianLatinQwertyCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+
+ private static class SerbianLatinQwertyCustomizer extends SerbianLatinCustomizer {
+ public SerbianLatinQwertyCustomizer(final Locale locale) {
+ super(locale);
+ }
+
+ @Override
+ public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
+ return isPhone ? EMPTY_KEYS
+ : joinKeys(LayoutBase.EXCLAMATION_AND_QUESTION_MARKS, LayoutBase.SHIFT_KEY);
+ }
+
+ @Override
+ protected void setSerbianKeys(final ExpectedKeyboardBuilder builder) {
+ // QWERTY layout doesn't have Serbian Latin Keys.
+ }
+
+ @Override
+ protected void setMoreKeysOfS(final ExpectedKeyboardBuilder builder) {
+ builder
+ // U+0161: "š" LATIN SMALL LETTER S WITH CARON
+ .setMoreKeysOf("s", "\u0161")
+ .setAdditionalMoreKeysPositionOf("s", 2);
+ }
+
+ @Override
+ protected void setMoreKeysOfC(final ExpectedKeyboardBuilder builder) {
+ builder
+ // U+010D: "č" LATIN SMALL LETTER C WITH CARON
+ // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
+ .setMoreKeysOf("c", "\u010D", "\u0107")
+ .setAdditionalMoreKeysPositionOf("c", 3);
+ }
+
+ @Override
+ protected void setMoreKeysOfD(final ExpectedKeyboardBuilder builder) {
+ builder
+ // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE
+ .setMoreKeysOf("d", "\u0111")
+ .setAdditionalMoreKeysPositionOf("d", 2);
+ }
+
+ @Override
+ protected void setMoreKeysOfZ(final ExpectedKeyboardBuilder builder) {
+ builder
+ // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
+ .setMoreKeysOf("z", "\u017E")
+ .setAdditionalMoreKeysPositionOf("z", 2);
+ }
+ }
+}