diff options
Diffstat (limited to 'tests/src')
7 files changed, 122 insertions, 74 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java index b12b8be64..a080cac30 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java @@ -21,9 +21,6 @@ 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; -import com.android.inputmethod.latin.Constants; - -import java.util.Locale; /** * The Hindi keyboard. @@ -38,50 +35,6 @@ public final class Hindi extends LayoutBase { @Override public String getName() { return LAYOUT_NAME; } - public static class HindiCustomizer extends LayoutCustomizer { - public HindiCustomizer(final Locale locale) { super(locale); } - - @Override - public ExpectedKey getAlphabetKey() { return HINDI_ALPHABET_KEY; } - - @Override - public ExpectedKey getSymbolsKey() { return HINDI_SYMBOLS_KEY; } - - @Override - public ExpectedKey getBackToSymbolsKey() { return HINDI_BACK_TO_SYMBOLS_KEY; } - - @Override - public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; } - - @Override - public ExpectedKey[] getOtherCurrencyKeys() { - return SymbolsShifted.CURRENCIES_OTHER_GENERIC; - } - - @Override - public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { - return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS; - } - - // U+0915: "क" DEVANAGARI LETTER KA - // U+0916: "ख" DEVANAGARI LETTER KHA - // U+0917: "ग" DEVANAGARI LETTER GA - private static final ExpectedKey HINDI_ALPHABET_KEY = key( - "\u0915\u0916\u0917", Constants.CODE_SWITCH_ALPHA_SYMBOL); - // U+0967: "१" DEVANAGARI DIGIT ONE - // U+0968: "२" DEVANAGARI DIGIT TWO - // U+0969: "३" DEVANAGARI DIGIT THREE - private static final String HINDI_SYMBOLS_LABEL = "?\u0967\u0968\u0969"; - private static final ExpectedKey HINDI_SYMBOLS_KEY = key(HINDI_SYMBOLS_LABEL, - Constants.CODE_SWITCH_ALPHA_SYMBOL); - private static final ExpectedKey HINDI_BACK_TO_SYMBOLS_KEY = key(HINDI_SYMBOLS_LABEL, - Constants.CODE_SHIFT); - - // U+20B9: "₹" INDIAN RUPEE SIGN - private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9", - Symbols.CURRENCY_GENERIC_MORE_KEYS); - } - @Override ExpectedKey[][] getCommonAlphabetLayout(boolean isPhone) { return ALPHABET_COMMON; } diff --git a/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java b/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java index c2a15f3f3..457851b0c 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java @@ -18,10 +18,10 @@ package com.android.inputmethod.keyboard.layout; import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.*; -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.keyboard.layout.tests.HindiCustomizer; import java.util.Locale; @@ -45,27 +45,6 @@ public final class HindiCompact extends LayoutBase { 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 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 diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Marathi.java b/tests/src/com/android/inputmethod/keyboard/layout/Marathi.java index 00cf838f9..615ec89bf 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/Marathi.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/Marathi.java @@ -18,10 +18,10 @@ package com.android.inputmethod.keyboard.layout; import static com.android.inputmethod.keyboard.layout.DevanagariLetterConstants.*; -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.keyboard.layout.tests.DevanagariCustomizer; import java.util.Locale; @@ -38,7 +38,7 @@ public final class Marathi extends LayoutBase { @Override public String getName() { return LAYOUT_NAME; } - public static class MarathiCustomizer extends HindiCustomizer { + public static class MarathiCustomizer extends DevanagariCustomizer { public MarathiCustomizer(final Locale locale) { super(locale); } @Override diff --git a/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java b/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java index 7933d078c..fec226109 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java @@ -19,10 +19,10 @@ 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; import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; +import com.android.inputmethod.keyboard.layout.tests.DevanagariCustomizer; import java.util.Locale; @@ -39,7 +39,7 @@ public final class NepaliRomanized extends LayoutBase { @Override public String getName() { return LAYOUT_NAME; } - public static class NepaliRomanizedCustomizer extends HindiCustomizer { + public static class NepaliRomanizedCustomizer extends DevanagariCustomizer { public NepaliRomanizedCustomizer(final Locale locale) { super(locale); } @Override diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/DevanagariCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/DevanagariCustomizer.java new file mode 100644 index 000000000..a31591d32 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/DevanagariCustomizer.java @@ -0,0 +1,70 @@ +/* + * 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.Hindi; +import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer; +import com.android.inputmethod.keyboard.layout.Symbols; +import com.android.inputmethod.keyboard.layout.SymbolsShifted; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.latin.Constants; + +import java.util.Locale; + +public class DevanagariCustomizer extends LayoutCustomizer { + public DevanagariCustomizer(final Locale locale) { super(locale); } + + @Override + public ExpectedKey getAlphabetKey() { return HINDI_ALPHABET_KEY; } + + @Override + public ExpectedKey getSymbolsKey() { return HINDI_SYMBOLS_KEY; } + + @Override + public ExpectedKey getBackToSymbolsKey() { return HINDI_BACK_TO_SYMBOLS_KEY; } + + @Override + public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; } + + @Override + public ExpectedKey[] getOtherCurrencyKeys() { + return SymbolsShifted.CURRENCIES_OTHER_GENERIC; + } + + @Override + public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { + return isPhone ? EMPTY_KEYS : Hindi.EXCLAMATION_AND_QUESTION_MARKS; + } + + // U+0915: "क" DEVANAGARI LETTER KA + // U+0916: "ख" DEVANAGARI LETTER KHA + // U+0917: "ग" DEVANAGARI LETTER GA + private static final ExpectedKey HINDI_ALPHABET_KEY = Hindi.key( + "\u0915\u0916\u0917", Constants.CODE_SWITCH_ALPHA_SYMBOL); + // U+0967: "१" DEVANAGARI DIGIT ONE + // U+0968: "२" DEVANAGARI DIGIT TWO + // U+0969: "३" DEVANAGARI DIGIT THREE + private static final String HINDI_SYMBOLS_LABEL = "?\u0967\u0968\u0969"; + private static final ExpectedKey HINDI_SYMBOLS_KEY = Hindi.key(HINDI_SYMBOLS_LABEL, + Constants.CODE_SWITCH_ALPHA_SYMBOL); + private static final ExpectedKey HINDI_BACK_TO_SYMBOLS_KEY = Hindi.key(HINDI_SYMBOLS_LABEL, + Constants.CODE_SHIFT); + + // U+20B9: "₹" INDIAN RUPEE SIGN + private static final ExpectedKey CURRENCY_RUPEE = Hindi.key("\u20B9", + Symbols.CURRENCY_GENERIC_MORE_KEYS); +}
\ No newline at end of file diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/HindiCustomizer.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/HindiCustomizer.java new file mode 100644 index 000000000..cb53bdc24 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/HindiCustomizer.java @@ -0,0 +1,47 @@ +/* + * 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.expected.ExpectedKey; + +import java.util.Locale; + +public class HindiCustomizer extends DevanagariCustomizer { + public HindiCustomizer(final Locale locale) { super(locale); } + + @Override + public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) { + // U+0964: "।" DEVANAGARI DANDA + final ExpectedKey periodKey = LayoutBase.key("\u0964", getPunctuationMoreKeys(isPhone)); + return LayoutBase.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 = LayoutBase.joinKeys( + ",", ".", "?", "!", "#", ")", "(", "/", ";", + "'", "@", ":", "-", "\"", "+", "%", "&"); + // Punctuation more keys for tablet form factor. + private static final ExpectedKey[] HINDI_TABLET_PUNCTUATION_MORE_KEYS = LayoutBase.joinKeys( + ",", ".", "'", "#", ")", "(", "/", ";", + "@", ":", "-", "\"", "+", "%", "&"); +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java index 84053b5be..abea51a8d 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHindi.java @@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.layout.tests; import android.test.suitebuilder.annotation.SmallTest; import com.android.inputmethod.keyboard.layout.Hindi; -import com.android.inputmethod.keyboard.layout.Hindi.HindiCustomizer; import com.android.inputmethod.keyboard.layout.LayoutBase; import java.util.Locale; |