Add georgian keyboard test

This CL adds Georgian (Georgia) keyboard test.

Bug: 13017434
Change-Id: I8499bda89365a15cfb417bdfc0bf07cf51ab232b
This commit is contained in:
Tadashi G. Takaoka 2014-03-15 15:50:04 +09:00
parent e8dd8b99e6
commit 1234c7c4c6
2 changed files with 216 additions and 0 deletions

View file

@ -0,0 +1,179 @@
/*
* 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.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 Georgian alphabet keyboard.
*/
public final class Georgian extends LayoutBase {
private static final String LAYOUT_NAME = "georgian";
public Georgian(final LayoutCustomizer customizer) {
super(customizer, Symbols.class, SymbolsShifted.class);
}
@Override
public String getName() { return LAYOUT_NAME; }
public static class GeorgianCustomizer extends LayoutCustomizer {
public GeorgianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey getAlphabetKey() { return GEORGIAN_ALPHABET_KEY; }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
@Override
public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_R9L; }
// U+10D0: "" GEORGIAN LETTER AN
// U+10D1: "" GEORGIAN LETTER BAN
// U+10D2: "" GEORGIAN LETTER GAN
private static final ExpectedKey GEORGIAN_ALPHABET_KEY = key(
"\u10D0\u10D1\u10D2", Constants.CODE_SWITCH_ALPHA_SYMBOL);
}
@Override
ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) {
return ALPHABET_COMMON;
}
@Override
public ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone,
final int elementId) {
if (elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) {
return getCommonAlphabetLayout(isPhone);
}
return ALPHABET_SHIFTED_COMMON;
}
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+10E5: "" GEORGIAN LETTER GHAN
key("\u10E5", moreKey("1")),
// U+10EC: "" GEORGIAN LETTER CIL
key("\u10EC", moreKey("2")),
// U+10D4: "" GEORGIAN LETTER EN
// U+10F1: "" GEORGIAN LETTER HE
key("\u10D4", joinMoreKeys("3", "\u10F1")),
// U+10E0: "" GEORGIAN LETTER RAE
key("\u10E0", moreKey("4")),
// U+10E2: "" GEORGIAN LETTER TAR
key("\u10E2", moreKey("5")),
// U+10E7: "" GEORGIAN LETTER QAR
// U+10F8: "" GEORGIAN LETTER ELIFI
key("\u10E7", joinMoreKeys("6", "\u10F8")),
// U+10E3: "" GEORGIAN LETTER UN
key("\u10E3", moreKey("7")),
// U+10D8: "" GEORGIAN LETTER IN
// U+10F2: "" GEORGIAN LETTER HIE
key("\u10D8", joinMoreKeys("8", "\u10F2")),
// U+10DD: "" GEORGIAN LETTER ON
key("\u10DD", moreKey("9")),
// U+10DE: "" GEORGIAN LETTER PAR
key("\u10DE", moreKey("0")))
.setKeysOfRow(2,
// U+10D0: "" GEORGIAN LETTER AN
// U+10FA: "" GEORGIAN LETTER AIN
key("\u10D0", moreKey("\u10FA")),
// U+10E1: "" GEORGIAN LETTER SAN
key("\u10E1"),
// U+10D3: "" GEORGIAN LETTER DON
key("\u10D3"),
// U+10E4: "" GEORGIAN LETTER PHAR
// U+10F6: "" GEORGIAN LETTER FI
key("\u10E4", moreKey("\u10F6")),
// U+10D2: "" GEORGIAN LETTER GAN
// U+10F9: "" GEORGIAN LETTER TURNED GAN
key("\u10D2", moreKey("\u10F9")),
// U+10F0: "" GEORGIAN LETTER HAE
// U+10F5: "" GEORGIAN LETTER HOE
key("\u10F0", moreKey("\u10F5")),
// U+10EF: "" GEORGIAN LETTER JHAN
// U+10F7: "" GEORGIAN LETTER YN
key("\u10EF", moreKey("\u10F7")),
// U+10D9: "" GEORGIAN LETTER KAN
key("\u10D9"),
// U+10DA: "" GEORGIAN LETTER LAS
key("\u10DA"))
.setKeysOfRow(3,
// U+10D6: "" GEORGIAN LETTER ZEN
key("\u10D6"),
// U+10EE: "" GEORGIAN LETTER XAN
// U+10F4: "" GEORGIAN LETTER HAR
key("\u10EE", moreKey("\u10F4")),
// U+10EA: "" GEORGIAN LETTER CAN
key("\u10EA"),
// U+10D5: "" GEORGIAN LETTER VIN
// U+10F3: "" GEORGIAN LETTER WE
key("\u10D5", moreKey("\u10F3")),
// U+10D1: "" GEORGIAN LETTER BAN
key("\u10D1"),
// U+10DC: "" GEORGIAN LETTER NAR
// U+10FC: "" MODIFIER LETTER GEORGIAN NAR
key("\u10DC", moreKey("\u10FC")),
// U+10DB: "" GEORGIAN LETTER MAN
key("\u10DB"))
.build();
private static final ExpectedKey[][] ALPHABET_SHIFTED_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
key("Q", moreKey("1")),
// U+10ED: "" GEORGIAN LETTER CHAR
key("\u10ED", moreKey("2")),
key("E", moreKey("3")),
// U+10E6: "" GEORGIAN LETTER GHAN
key("\u10E6", moreKey("4")),
// U+10D7: "" GEORGIAN LETTER TAN
key("\u10D7", moreKey("5")),
key("Y", moreKey("6")),
key("U", moreKey("7")),
key("I", moreKey("8")),
key("O", moreKey("9")),
key("P", moreKey("0")))
.setKeysOfRow(2,
key("A"),
// U+10E8: "" GEORGIAN LETTER SHIN
key("\u10E8"),
key("D"),
key("F"),
key("G"),
key("H"),
// U+10DF: "" GEORGIAN LETTER ZHAR
key("\u10DF"),
key("K"),
key("L"))
.setKeysOfRow(3,
// U+10EB: "" GEORGIAN LETTER JIL
key("\u10EB"),
key("X"),
// U+10E9: "" GEORGIAN LETTER CHIN
key("\u10E9"),
key("V"),
key("B"),
key("N"),
key("M"))
.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.Georgian;
import com.android.inputmethod.keyboard.layout.Georgian.GeorgianCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import java.util.Locale;
/**
* ka_GE: Georgian (Georgia)/georgian
*/
@SmallTest
public final class TestsGeorgianGE extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("ka", "GE");
private static final LayoutBase LAYOUT = new Georgian(new GeorgianCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
}