From e6674070a5da6cc21b8a727554597ba2237de567 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 6 Mar 2014 21:33:05 +0900 Subject: [PATCH] Add bulgarian and bulgarian_bds keyboard layout tests Bug: 13017434 Change-Id: I271476d06941864a44890321231b1f0ad570c05b --- .../keyboard/layout/Bulgarian.java | 105 ++++++++++++++++++ .../keyboard/layout/BulgarianBds.java | 97 ++++++++++++++++ .../keyboard/layout/tests/TestsBulgarian.java | 37 ++++++ .../layout/tests/TestsBulgarianBds.java | 37 ++++++ 4 files changed, 276 insertions(+) create mode 100644 tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java create mode 100644 tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java create mode 100644 tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.java create mode 100644 tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.java diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java b/tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java new file mode 100644 index 000000000..a1ad54957 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/Bulgarian.java @@ -0,0 +1,105 @@ +/* + * 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.EastSlavic.EastSlavicCustomizer; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; + +import java.util.Locale; + +public final class Bulgarian extends LayoutBase { + private static final String LAYOUT_NAME = "bulgarian"; + + public Bulgarian(final LayoutCustomizer customizer) { + super(customizer, Symbols.class, SymbolsShifted.class); + } + + @Override + public String getName() { return LAYOUT_NAME; } + + public static class BulgarianCustomizer extends LayoutCustomizer { + private final EastSlavicCustomizer mEastSlavicCustomizer; + + public BulgarianCustomizer(final Locale locale) { + super(locale); + mEastSlavicCustomizer = new EastSlavicCustomizer(locale); + } + + @Override + public ExpectedKey getAlphabetKey() { + return mEastSlavicCustomizer.getAlphabetKey(); + } + + @Override + public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; } + } + + @Override + ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; } + + private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + // U+044F: "я" CYRILLIC SMALL LETTER YA + key("\u044F", moreKey("1")), + // U+0432: "в" CYRILLIC SMALL LETTER VE + key("\u0432", moreKey("2")), + // U+0435: "е" CYRILLIC SMALL LETTER IE + key("\u0435", moreKey("3")), + // U+0440: "р" CYRILLIC SMALL LETTER ER + key("\u0440", moreKey("4")), + // U+0442: "т" CYRILLIC SMALL LETTER TE + key("\u0442", moreKey("5")), + // U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN + key("\u044A", moreKey("6")), + // U+0443: "у" CYRILLIC SMALL LETTER U + key("\u0443", moreKey("7")), + // U+0438: "и" CYRILLIC SMALL LETTER I + // U+045D: "ѝ" CYRILLIC SMALL LETTER I WITH GRAVE + key("\u0438", joinMoreKeys("8", "\u045D")), + // U+043E: "о" CYRILLIC SMALL LETTER O + key("\u043E", moreKey("9")), + // U+043F: "п" CYRILLIC SMALL LETTER PE + key("\u043F", moreKey("0")), + // U+0447: "ч" CYRILLIC SMALL LETTER CHE + key("\u0447")) + // U+0430: "а" CYRILLIC SMALL LETTER A + // U+0441: "с" CYRILLIC SMALL LETTER ES + // U+0434: "д" CYRILLIC SMALL LETTER DE + // U+0444: "ф" CYRILLIC SMALL LETTER EF + // U+0433: "г" CYRILLIC SMALL LETTER GHE + // U+0445: "х" CYRILLIC SMALL LETTER HA + // U+0439: "й" CYRILLIC SMALL LETTER SHORT I + // U+043A: "к" CYRILLIC SMALL LETTER KA + // U+043B: "л" CYRILLIC SMALL LETTER EL + // U+0448: "ш" CYRILLIC SMALL LETTER SHA + // U+0449: "щ" CYRILLIC SMALL LETTER SHCHA + .setLabelsOfRow(2, + "\u0430", "\u0441", "\u0434", "\u0444", "\u0433", "\u0445", "\u0439", "\u043A", + "\u043B", "\u0448", "\u0449") + // U+0437: "з" CYRILLIC SMALL LETTER ZE + // U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN + // U+0446: "ц" CYRILLIC SMALL LETTER TSE + // U+0436: "ж" CYRILLIC SMALL LETTER ZHE + // U+0431: "б" CYRILLIC SMALL LETTER BE + // U+043D: "н" CYRILLIC SMALL LETTER EN + // U+043C: "м" CYRILLIC SMALL LETTER EM + // U+044E: "ю" CYRILLIC SMALL LETTER YU + .setLabelsOfRow(3, + "\u0437", "\u044C", "\u0446", "\u0436", "\u0431", "\u043D", "\u043C", "\u044E") + .build(); +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java b/tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java new file mode 100644 index 000000000..b47b59216 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/BulgarianBds.java @@ -0,0 +1,97 @@ +/* + * 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.EastSlavic.EastSlavicCustomizer; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; + +import java.util.Locale; + +public final class BulgarianBds extends LayoutBase { + private static final String LAYOUT_NAME = "bulgarian_bds"; + + public BulgarianBds(final LayoutCustomizer customizer) { + super(customizer, Symbols.class, SymbolsShifted.class); + } + + @Override + public String getName() { return LAYOUT_NAME; } + + public static class BulgarianBdsCustomizer extends EastSlavicCustomizer { + public BulgarianBdsCustomizer(final Locale locale) { super(locale); } + + @Override + public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; } + } + + @Override + ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; } + + private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + // U+0443: "у" CYRILLIC SMALL LETTER U + key("\u0443", moreKey("1")), + // U+0435: "е" CYRILLIC SMALL LETTER IE + key("\u0435", moreKey("2")), + // U+0438: "и" CYRILLIC SMALL LETTER I + // U+045D: "ѝ" CYRILLIC SMALL LETTER I WITH GRAVE + key("\u0438", joinMoreKeys("3", "\u045D")), + // U+0448: "ш" CYRILLIC SMALL LETTER SHA + key("\u0448", moreKey("4")), + // U+0449: "щ" CYRILLIC SMALL LETTER SHCHA + key("\u0449", moreKey("5")), + // U+043A: "к" CYRILLIC SMALL LETTER KA + key("\u043A", moreKey("6")), + // U+0441: "с" CYRILLIC SMALL LETTER ES + key("\u0441", moreKey("7")), + // U+0434: "д" CYRILLIC SMALL LETTER DE + key("\u0434", moreKey("8")), + // U+0437: "з" CYRILLIC SMALL LETTER ZE + key("\u0437", moreKey("9")), + // U+0446: "ц" CYRILLIC SMALL LETTER TSE + key("\u0446", moreKey("0")), + // U+0431: "б" CYRILLIC SMALL LETTER BE + key("\u0431")) + // U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN + // U+044F: "я" CYRILLIC SMALL LETTER YA + // U+0430: "а" CYRILLIC SMALL LETTER A + // U+043E: "о" CYRILLIC SMALL LETTER O + // U+0436: "ж" CYRILLIC SMALL LETTER ZHE + // U+0433: "г" CYRILLIC SMALL LETTER GHE + // U+0442: "т" CYRILLIC SMALL LETTER TE + // U+043D: "н" CYRILLIC SMALL LETTER EN + // U+0432: "в" CYRILLIC SMALL LETTER VE + // U+043C: "м" CYRILLIC SMALL LETTER EM + // U+0447: "ч" CYRILLIC SMALL LETTER CHE + .setLabelsOfRow(2, + "\u044C", "\u044F", "\u0430", "\u043E", "\u0436", "\u0433", "\u0442", "\u043D", + "\u0432", "\u043C", "\u0447") + // U+044E: "ю" CYRILLIC SMALL LETTER YU + // U+0439: "й" CYRILLIC SMALL LETTER SHORT I + // U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN + // U+044D: "э" CYRILLIC SMALL LETTER E + // U+0444: "ф" CYRILLIC SMALL LETTER EF + // U+0445: "х" CYRILLIC SMALL LETTER HA + // U+043F: "п" CYRILLIC SMALL LETTER PE + // U+0440: "р" CYRILLIC SMALL LETTER ER + // U+043B: "л" CYRILLIC SMALL LETTER EL + .setLabelsOfRow(3, + "\u044E", "\u0439", "\u044A", "\u044D", "\u0444", "\u0445", "\u043F", "\u0440", + "\u043B") + .build(); +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.java new file mode 100644 index 000000000..ded8d7243 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarian.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.Bulgarian; +import com.android.inputmethod.keyboard.layout.Bulgarian.BulgarianCustomizer; +import com.android.inputmethod.keyboard.layout.LayoutBase; + +import java.util.Locale; + +/** + * bg: TestsBulgarian/bulgarian + */ +@SmallTest +public final class TestsBulgarian extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("bg"); + private static final LayoutBase LAYOUT = new Bulgarian(new BulgarianCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.java new file mode 100644 index 000000000..22b2011ee --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsBulgarianBds.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.BulgarianBds; +import com.android.inputmethod.keyboard.layout.BulgarianBds.BulgarianBdsCustomizer; +import com.android.inputmethod.keyboard.layout.LayoutBase; + +import java.util.Locale; + +/** + * bg: Bulgarian/bulgarian_bds + */ +@SmallTest +public final class TestsBulgarianBds extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("bg"); + private static final LayoutBase LAYOUT = new BulgarianBds(new BulgarianBdsCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } +}