Add east_slavic keyboard layout tests

This CL adds, Belarusian, Kazakh, Kyrgyz, Russian, and Ukrainian
keyboard tests.

Bug: 13017434
Change-Id: I0c53c66dd062e549485075398ed80e7836b50566
main
Tadashi G. Takaoka 2014-03-06 21:29:54 +09:00
parent 598c311ce0
commit 240fb4b3ff
6 changed files with 488 additions and 0 deletions

View File

@ -0,0 +1,110 @@
/*
* 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;
import com.android.inputmethod.latin.Constants;
import java.util.Locale;
public final class EastSlavic extends LayoutBase {
private static final String LAYOUT_NAME = "east_slavic";
public EastSlavic(final LayoutCustomizer customizer) {
super(customizer, Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
public static class EastSlavicCustomizer extends LayoutCustomizer {
public EastSlavicCustomizer(final Locale locale) {
super(locale);
}
@Override
public final ExpectedKey getAlphabetKey() { return EAST_SLAVIC_ALPHABET_KEY; }
@Override
public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS;
}
// U+0410: "А" CYRILLIC CAPITAL LETTER A
// U+0411: "Б" CYRILLIC CAPITAL LETTER BE
// U+0412: "В" CYRILLIC CAPITAL LETTER VE
private static final ExpectedKey EAST_SLAVIC_ALPHABET_KEY = key(
"\u0410\u0411\u0412", Constants.CODE_SWITCH_ALPHA_SYMBOL);
}
@Override
ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; }
public static final String ROW1_9 = "ROW1_9";
public static final String ROW2_2 = "ROW2_2";
public static final String ROW2_11 = "ROW2_11";
public static final String ROW3_5 = "ROW3_5";
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+0443: "у" CYRILLIC SMALL LETTER U
key("\u0439", moreKey("1")),
// U+0446: "ц" CYRILLIC SMALL LETTER TSE
key("\u0446", moreKey("2")),
// U+0439: "й" CYRILLIC SMALL LETTER SHORT I
key("\u0443", moreKey("3")),
// U+043A: "к" CYRILLIC SMALL LETTER KA
key("\u043A", moreKey("4")),
// U+0435: "е" CYRILLIC SMALL LETTER IE
key("\u0435", moreKey("5")),
// U+043D: "н" CYRILLIC SMALL LETTER EN
key("\u043D", moreKey("6")),
// U+0433: "г" CYRILLIC SMALL LETTER GHE
key("\u0433", moreKey("7")),
// U+0448: "ш" CYRILLIC SMALL LETTER SHA
key("\u0448", moreKey("8")),
key(ROW1_9, moreKey("9")),
// U+0437: "з" CYRILLIC SMALL LETTER ZE
key("\u0437", moreKey("0")),
// U+0445: "х" CYRILLIC SMALL LETTER HA
key("\u0445"))
// U+0444: "ф" CYRILLIC SMALL LETTER EF
// U+0432: "в" CYRILLIC SMALL LETTER VE
// U+0430: "а" CYRILLIC SMALL LETTER A
// U+043F: "п" CYRILLIC SMALL LETTER PE
// U+0440: "р" CYRILLIC SMALL LETTER ER
// U+043E: "о" CYRILLIC SMALL LETTER O
// U+043B: "л" CYRILLIC SMALL LETTER EL
// U+0434: "д" CYRILLIC SMALL LETTER DE
// U+0436: "ж" CYRILLIC SMALL LETTER ZHE
.setLabelsOfRow(2,
"\u0444", ROW2_2, "\u0432", "\u0430", "\u043F", "\u0440", "\u043E", "\u043B",
"\u0434", "\u0436", ROW2_11)
// U+044F: "я" CYRILLIC SMALL LETTER YA
// U+0447: "ч" CYRILLIC SMALL LETTER CHE
// U+0441: "с" CYRILLIC SMALL LETTER ES
// U+043C: "м" CYRILLIC SMALL LETTER EM
// U+0442: "т" CYRILLIC SMALL LETTER TE
// U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
// U+0431: "б" CYRILLIC SMALL LETTER BE
// U+044E: "ю" CYRILLIC SMALL LETTER YU
.setLabelsOfRow(3,
"\u044F", "\u0447", "\u0441", "\u043C", ROW3_5, "\u0442", "\u044C", "\u0431",
"\u044E")
.build();
}

View File

@ -0,0 +1,73 @@
/*
* 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.EastSlavic;
import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* be_BY: Belarusian (Belarus)/east_slavic
*/
@SmallTest
public final class TestsBelarusianBY extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("be", "BY");
private static final LayoutBase LAYOUT = new EastSlavic(new BelarusianBYCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class BelarusianBYCustomizer extends EastSlavicCustomizer {
public BelarusianBYCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() {
return Symbols.DOUBLE_QUOTES_R9L;
}
@Override
public ExpectedKey[] getSingleQuoteMoreKeys() {
return Symbols.SINGLE_QUOTES_R9L;
}
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+0435: "е" CYRILLIC SMALL LETTER IE
// U+0451: "ё" CYRILLIC SMALL LETTER IO
.setMoreKeysOf("\u0435", "5", "\u0451")
// U+045E: "ў" CYRILLIC SMALL LETTER SHORT U
.replaceKeyOfLabel(EastSlavic.ROW1_9, key("\u045E", moreKey("9")))
// U+044B: "ы" CYRILLIC SMALL LETTER YERU
.replaceKeyOfLabel(EastSlavic.ROW2_2, key("\u044B"))
// U+044D: "э" CYRILLIC SMALL LETTER E
.replaceKeyOfLabel(EastSlavic.ROW2_11, key("\u044D"))
// U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
.replaceKeyOfLabel(EastSlavic.ROW3_5, key("\u0456"))
// U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
// U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN
.setMoreKeysOf("\u044C", "\u044A");
}
}
}

View File

@ -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 android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.EastSlavic;
import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* kk: Kazakh/east_slavic
*/
@SmallTest
public final class TestsKazakh extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("kk");
private static final LayoutBase LAYOUT = new EastSlavic(new KazakhCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class KazakhCustomizer extends EastSlavicCustomizer {
public KazakhCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+0443: "у" CYRILLIC SMALL LETTER U
// U+04AF: "ү" CYRILLIC SMALL LETTER STRAIGHT U
// U+04B1: "ұ" CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE
.setMoreKeysOf("\u0443", "3", "\u04AF", "\u04B1")
// U+043A: "к" CYRILLIC SMALL LETTER KA
// U+049B: "қ" CYRILLIC SMALL LETTER KA WITH DESCENDER
.setMoreKeysOf("\u043A", "4", "\u049B")
// U+0435: "е" CYRILLIC SMALL LETTER IE
// U+0451: "ё" CYRILLIC SMALL LETTER IO
.setMoreKeysOf("\u0435", "5", "\u0451")
// U+043D: "н" CYRILLIC SMALL LETTER EN
// U+04A3: "ң" CYRILLIC SMALL LETTER EN WITH DESCENDER
.setMoreKeysOf("\u043D", "6", "\u04A3")
// U+0433: "г" CYRILLIC SMALL LETTER GHE
// U+0493: "ғ" CYRILLIC SMALL LETTER GHE WITH STROKE
.setMoreKeysOf("\u0433", "7", "\u0493")
// U+0449: "щ" CYRILLIC SMALL LETTER SHCHA
.replaceKeyOfLabel(EastSlavic.ROW1_9, key("\u0449", moreKey("9")))
// U+044B: "ы" CYRILLIC SMALL LETTER YERU
// U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
.replaceKeyOfLabel(EastSlavic.ROW2_2, key("\u044B", moreKey("\u0456")))
// U+0430: "а" CYRILLIC SMALL LETTER A
// U+04D9: "ә" CYRILLIC SMALL LETTER SCHWA
.setMoreKeysOf("\u0430", "\u04D9")
// U+043E: "о" CYRILLIC SMALL LETTER O
// U+04E9: "ө" CYRILLIC SMALL LETTER BARRED O
.setMoreKeysOf("\u043E", "\u04E9")
// U+044D: "э" CYRILLIC SMALL LETTER E
// U+04BB: "һ" CYRILLIC SMALL LETTER SHHA
.replaceKeyOfLabel(EastSlavic.ROW2_11, key("\u044D", moreKey("\u04BB")))
// U+0438: "и" CYRILLIC SMALL LETTER I
.replaceKeyOfLabel(EastSlavic.ROW3_5, key("\u0438"))
// U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
// U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN
.setMoreKeysOf("\u044C", "\u044A");
}
}
}

View File

@ -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 android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.EastSlavic;
import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* ky: Kyrgyz/east_slavic
*/
@SmallTest
public final class TestsKyrgyz extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("ky");
private static final LayoutBase LAYOUT = new EastSlavic(new KyrgyzCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class KyrgyzCustomizer extends EastSlavicCustomizer {
public KyrgyzCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+0443: "у" CYRILLIC SMALL LETTER U
// U+04AF: "ү" CYRILLIC SMALL LETTER STRAIGHT U
.setMoreKeysOf("\u0443", "3", "\u04AF")
// U+0435: "е" CYRILLIC SMALL LETTER IE
// U+0451: "ё" CYRILLIC SMALL LETTER IO
.setMoreKeysOf("\u0435", "5", "\u0451")
// U+043D: "н" CYRILLIC SMALL LETTER EN
// U+04A3: "ң" CYRILLIC SMALL LETTER EN WITH DESCENDER
.setMoreKeysOf("\u043D", "6", "\u04A3")
// U+0449: "щ" CYRILLIC SMALL LETTER SHCHA
.replaceKeyOfLabel(EastSlavic.ROW1_9, key("\u0449", moreKey("9")))
// U+044B: "ы" CYRILLIC SMALL LETTER YERU
.replaceKeyOfLabel(EastSlavic.ROW2_2, key("\u044B"))
// U+043E: "о" CYRILLIC SMALL LETTER O
// U+04E9: "ө" CYRILLIC SMALL LETTER BARRED O
.setMoreKeysOf("\u043E", "\u04E9")
// U+044D: "э" CYRILLIC SMALL LETTER E
.replaceKeyOfLabel(EastSlavic.ROW2_11, key("\u044D"))
// U+0438: "и" CYRILLIC SMALL LETTER I
.replaceKeyOfLabel(EastSlavic.ROW3_5, key("\u0438"))
// U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
// U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN
.setMoreKeysOf("\u044C", "\u044A");
}
}
}

View File

@ -0,0 +1,69 @@
/*
* 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.EastSlavic;
import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* ru: Russian/east_slavic
*/
@SmallTest
public final class TestsRussian extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("ru");
private static final LayoutBase LAYOUT = new EastSlavic(new RussianCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class RussianCustomizer extends EastSlavicCustomizer {
public RussianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
@Override
public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_R9L; }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+0435: "е" CYRILLIC SMALL LETTER IE
// U+0451: "ё" CYRILLIC SMALL LETTER IO
.setMoreKeysOf("\u0435", "5", "\u0451")
// U+0449: "щ" CYRILLIC SMALL LETTER SHCHA
.replaceKeyOfLabel(EastSlavic.ROW1_9, key("\u0449", moreKey("9")))
// U+044B: "ы" CYRILLIC SMALL LETTER YERU
.replaceKeyOfLabel(EastSlavic.ROW2_2, key("\u044B"))
// U+044D: "э" CYRILLIC SMALL LETTER E
.replaceKeyOfLabel(EastSlavic.ROW2_11, key("\u044D"))
// U+0438: "и" CYRILLIC SMALL LETTER I
.replaceKeyOfLabel(EastSlavic.ROW3_5, key("\u0438"))
// U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
// U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN
.setMoreKeysOf("\u044C", "\u044A");
}
}
}

View File

@ -0,0 +1,84 @@
/*
* 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.EastSlavic;
import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
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.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* uk: Ukrainian/east_slavic
*/
@SmallTest
public final class TestsUkrainian extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("uk");
private static final LayoutBase LAYOUT = new EastSlavic(new UkrainianCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class UkrainianCustomizer extends EastSlavicCustomizer {
public UkrainianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_HRYVNIA; }
@Override
public ExpectedKey[] getOtherCurrencyKeys() {
return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
}
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
@Override
public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_R9L; }
// U+20B4: "₴" HRYVNIA SIGN
private static final ExpectedKey CURRENCY_HRYVNIA = key("\u20B4",
Symbols.DOLLAR_SIGN, Symbols.CENT_SIGN, Symbols.EURO_SIGN, Symbols.POUND_SIGN,
Symbols.YEN_SIGN, Symbols.PESO_SIGN);
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+0433: "г" CYRILLIC SMALL LETTER GHE
// U+0491: "ґ" CYRILLIC SMALL LETTER GHE WITH UPTURN
.setMoreKeysOf("\u0433", "7", "\u0491")
// U+0449: "щ" CYRILLIC SMALL LETTER SHCHA
.replaceKeyOfLabel(EastSlavic.ROW1_9, key("\u0449", moreKey("9")))
// U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
// U+0457: "ї" CYRILLIC SMALL LETTER YI
.replaceKeyOfLabel(EastSlavic.ROW2_2, key("\u0456", moreKey("\u0457")))
// U+0454: "є" CYRILLIC SMALL LETTER UKRAINIAN IE
.replaceKeyOfLabel(EastSlavic.ROW2_11, key("\u0454"))
// U+0438: "и" CYRILLIC SMALL LETTER I
.replaceKeyOfLabel(EastSlavic.ROW3_5, key("\u0438"))
// U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
// U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN
.setMoreKeysOf("\u044C", "\u044A");
}
}
}