Merge "Add mongolian keyboard test"

This commit is contained in:
Tadashi G. Takaoka 2014-03-17 03:25:50 +00:00 committed by Android (Google) Code Review
commit 082e033ea2
2 changed files with 155 additions and 0 deletions

View file

@ -0,0 +1,118 @@
/*
* 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 Mongolian extends LayoutBase {
private static final String LAYOUT_NAME = "mongolian";
public Mongolian(final LayoutCustomizer customizer) {
super(customizer, Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
public static class MongolianMNCustomizer extends EastSlavicCustomizer {
public MongolianMNCustomizer(final Locale locale) {
super(locale);
}
@Override
public ExpectedKey getCurrencyKey() { return CURRENCY_TUGRIK; }
@Override
public ExpectedKey[] getOtherCurrencyKeys() {
return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
}
// U+20AE: "" TUGRIK SIGN
private static final ExpectedKey CURRENCY_TUGRIK = key("\u20AE",
Symbols.CURRENCY_GENERIC_MORE_KEYS);
}
@Override
ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; }
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+0444: "ф" CYRILLIC SMALL LETTER EF
key("\u0444", moreKey("1")),
// U+0446: "ц" CYRILLIC SMALL LETTER TSE
key("\u0446", moreKey("2")),
// U+0443: "у" CYRILLIC SMALL LETTER U
key("\u0443", moreKey("3")),
// U+0436: "ж" CYRILLIC SMALL LETTER ZHE
key("\u0436", moreKey("4")),
// U+044D: "э" CYRILLIC SMALL LETTER E
key("\u044D", 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
// U+0449: "щ" CYRILLIC SMALL LETTER SHCHA
key("\u0448", joinMoreKeys("8", "\u0449")),
// U+04AF: "ү" CYRILLIC SMALL LETTER STRAIGHT U
key("\u04AF", moreKey("9")),
// U+0437: "з" CYRILLIC SMALL LETTER ZE
key("\u0437", moreKey("0")),
// U+043A: "к" CYRILLIC SMALL LETTER KA
key("\u043A"))
// U+0439: "й" CYRILLIC SMALL LETTER SHORT I
// U+044B: "ы" CYRILLIC SMALL LETTER YERU
// U+0431: "б" CYRILLIC SMALL LETTER BE
// U+04E9: "ө" CYRILLIC SMALL LETTER BARRED O
// U+0430: "а" CYRILLIC SMALL LETTER A
// U+0445: "х" CYRILLIC SMALL LETTER HA
// 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+043F: "п" CYRILLIC SMALL LETTER PE
.setLabelsOfRow(2,
"\u0439", "\u044B", "\u0431", "\u04E9", "\u0430", "\u0445", "\u0440", "\u043E",
"\u043B", "\u0434", "\u043F")
.setKeysOfRow(3,
// U+044F: "я" CYRILLIC SMALL LETTER YA
key("\u044F"),
// U+0447: "ч" CYRILLIC SMALL LETTER CHE
key("\u0447"),
// U+0451: "ё" CYRILLIC SMALL LETTER IO
// U+0435: "е" CYRILLIC SMALL LETTER IE
key("\u0451", moreKey("\u0435")),
// U+0441: "с" CYRILLIC SMALL LETTER ES
key("\u0441"),
// U+043C: "м" CYRILLIC SMALL LETTER EM
key("\u043C"),
// U+0438: "и" CYRILLIC SMALL LETTER I
key("\u0438"),
// U+0442: "т" CYRILLIC SMALL LETTER TE
key("\u0442"),
// U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
// U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN
key("\u044C", moreKey("\u044A")),
// U+0432: "в" CYRILLIC SMALL LETTER VE
// U+044E: "ю" CYRILLIC SMALL LETTER YU
key("\u0432", moreKey("\u044E")))
.build();
}

View file

@ -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.LayoutBase;
import com.android.inputmethod.keyboard.layout.Mongolian;
import com.android.inputmethod.keyboard.layout.Mongolian.MongolianMNCustomizer;
import java.util.Locale;
/**
* mn_MN: Mongolian (Mongolia)/mongolian
*/
@SmallTest
public final class TestsMongolianMN extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("mn", "MN");
private static final LayoutBase LAYOUT = new Mongolian(new MongolianMNCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
}