Merge "Add azerty layout keyboard tests"
commit
391eaaeed5
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The AZERTY alphabet keyboard.
|
||||
*/
|
||||
public final class Azerty extends LayoutBase {
|
||||
public Azerty(final LayoutCustomizer customizer) {
|
||||
super(customizer, Symbols.class, SymbolsShifted.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() { return "azerty"; }
|
||||
|
||||
@Override
|
||||
ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) {
|
||||
final LayoutCustomizer customizer = getCustomizer();
|
||||
final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON);
|
||||
customizer.setAccentedLetters(builder);
|
||||
builder.replaceKeyOfLabel(ROW3_QUOTE, key("'", joinMoreKeys(
|
||||
customizer.getSingleQuoteMoreKeys(),
|
||||
customizer.getSingleAngleQuoteKeys())));
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone, final int elementId) {
|
||||
final ExpectedKeyboardBuilder builder;
|
||||
if (elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED
|
||||
|| elementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED) {
|
||||
builder = new ExpectedKeyboardBuilder(getCommonAlphabetLayout(isPhone));
|
||||
} else {
|
||||
builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON);
|
||||
getCustomizer().setAccentedLetters(builder);
|
||||
builder.replaceKeyOfLabel(ROW3_QUOTE, key("?"));
|
||||
}
|
||||
builder.toUpperCase(getLocale());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static final String ROW3_QUOTE = "ROW3_QUOUTE";
|
||||
|
||||
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
|
||||
.setKeysOfRow(1,
|
||||
key("a", moreKey("1")),
|
||||
key("z", moreKey("2")),
|
||||
key("e", moreKey("3")),
|
||||
key("r", moreKey("4")),
|
||||
key("t", moreKey("5")),
|
||||
key("y", moreKey("6")),
|
||||
key("u", moreKey("7")),
|
||||
key("i", moreKey("8")),
|
||||
key("o", moreKey("9")),
|
||||
key("p", moreKey("0")))
|
||||
.setLabelsOfRow(2, "q", "s", "d", "f", "g", "h", "j", "k", "l", "m")
|
||||
.setLabelsOfRow(3, "w", "x", "c", "v", "b", "n", ROW3_QUOTE)
|
||||
.build();
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* 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.Azerty;
|
||||
import com.android.inputmethod.keyboard.layout.LayoutBase;
|
||||
import com.android.inputmethod.keyboard.layout.LayoutBase.EuroLayoutCustomizer;
|
||||
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;
|
||||
|
||||
/**
|
||||
* nl_BE: Dutch (Belgium)/azerty
|
||||
*/
|
||||
@SmallTest
|
||||
public final class TestsDutchBE extends LayoutTestsBase {
|
||||
private static final Locale LOCALE = new Locale("nl", "BE");
|
||||
private static final LayoutBase LAYOUT = new Azerty(new DutchBECustomizer(LOCALE));
|
||||
|
||||
@Override
|
||||
LayoutBase getLayout() { return LAYOUT; }
|
||||
|
||||
private static class DutchBECustomizer extends EuroLayoutCustomizer {
|
||||
public DutchBECustomizer(final Locale locale) { super(locale); }
|
||||
|
||||
@Override
|
||||
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
|
||||
|
||||
@Override
|
||||
public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_L9R; }
|
||||
|
||||
@Override
|
||||
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
|
||||
return builder
|
||||
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
|
||||
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
|
||||
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
|
||||
// U+00E6: "æ" LATIN SMALL LETTER AE
|
||||
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
|
||||
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
|
||||
// U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
|
||||
.setMoreKeysOf("a",
|
||||
"1", "\u00E1", "\u00E4", "\u00E2", "\u00E0", "\u00E6", "\u00E3",
|
||||
"\u00E5", "\u0101")
|
||||
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
|
||||
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
|
||||
// U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
|
||||
// U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
|
||||
// U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
|
||||
// U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
|
||||
// U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
|
||||
.setMoreKeysOf("e",
|
||||
"3", "\u00E9", "\u00EB", "\u00EA", "\u00E8", "\u0119", "\u0117",
|
||||
"\u0113")
|
||||
// U+0133: "ij" LATIN SMALL LIGATURE IJ
|
||||
.setMoreKeysOf("y", "6", "\u0133")
|
||||
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
|
||||
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
|
||||
// U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
|
||||
// U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
|
||||
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
|
||||
.setMoreKeysOf("u", "7", "\u00FA", "\u00FC", "\u00FB", "\u00F9", "\u016B")
|
||||
// U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
|
||||
// U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
|
||||
// U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
|
||||
// U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
// U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
|
||||
// U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
|
||||
// U+0133: "ij" LATIN SMALL LIGATURE IJ
|
||||
.setMoreKeysOf("i",
|
||||
"8", "\u00ED", "\u00EF", "\u00EC", "\u00EE", "\u012F", "\u012B",
|
||||
"\u0133")
|
||||
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
|
||||
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
|
||||
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
|
||||
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
|
||||
// U+0153: "œ" LATIN SMALL LIGATURE OE
|
||||
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
|
||||
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
|
||||
.setMoreKeysOf("o",
|
||||
"9", "\u00F3", "\u00F6", "\u00F4", "\u00F2", "\u00F5", "\u0153",
|
||||
"\u00F8", "\u014D")
|
||||
// U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
|
||||
// U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
|
||||
.setMoreKeysOf("n", "\u00F1", "\u0144");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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.Azerty;
|
||||
import com.android.inputmethod.keyboard.layout.LayoutBase;
|
||||
import com.android.inputmethod.keyboard.layout.LayoutBase.EuroLayoutCustomizer;
|
||||
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* fr: French/azerty
|
||||
*/
|
||||
@SmallTest
|
||||
public final class TestsFrench extends LayoutTestsBase {
|
||||
private static final Locale LOCALE = new Locale("fr");
|
||||
private static final LayoutBase LAYOUT = new Azerty(new FrenchCustomizer(LOCALE));
|
||||
|
||||
@Override
|
||||
LayoutBase getLayout() { return LAYOUT; }
|
||||
|
||||
private static class FrenchCustomizer extends EuroLayoutCustomizer {
|
||||
public FrenchCustomizer(final Locale locale) { super(locale); }
|
||||
|
||||
@Override
|
||||
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
|
||||
return builder
|
||||
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
|
||||
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
|
||||
// U+00E6: "æ" LATIN SMALL LETTER AE
|
||||
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
|
||||
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
|
||||
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
|
||||
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
|
||||
// U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
|
||||
// U+00AA: "ª" FEMININE ORDINAL INDICATOR
|
||||
.setMoreKeysOf("a",
|
||||
"\u00E0", "\u00E2", "1", "\u00E6", "\u00E1", "\u00E4", "\u00E3",
|
||||
"\u00E5", "\u0101", "\u00AA")
|
||||
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
|
||||
// U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
|
||||
// U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
|
||||
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
|
||||
// U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
|
||||
// U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
|
||||
// U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
|
||||
.setMoreKeysOf("e",
|
||||
"\u00E9", "\u00E8", "\u00EA", "\u00EB", "3", "\u0119", "\u0117",
|
||||
"\u0113")
|
||||
// U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS
|
||||
.setMoreKeysOf("y", "6", "\u00FF")
|
||||
// U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
|
||||
// U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
|
||||
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
|
||||
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
|
||||
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
|
||||
.setMoreKeysOf("u", "\u00F9", "\u00FB", "7", "\u00FC", "\u00FA", "\u016B")
|
||||
// U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
|
||||
// U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
|
||||
// U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
|
||||
// U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
|
||||
// U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
|
||||
// U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
|
||||
.setMoreKeysOf("i", "\u00EE", "8", "\u00EF", "\u00EC", "\u00ED", "\u012F",
|
||||
"\u012B")
|
||||
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
|
||||
// U+0153: "œ" LATIN SMALL LIGATURE OE
|
||||
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
|
||||
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
|
||||
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
|
||||
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
|
||||
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
|
||||
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
|
||||
// U+00BA: "º" MASCULINE ORDINAL INDICATOR
|
||||
.setMoreKeysOf("o",
|
||||
"\u00F4", "\u0153", "9", "\u00F6", "\u00F2", "\u00F3", "\u00F5",
|
||||
"\u00F8", "\u014D", "\u00BA")
|
||||
// U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
|
||||
// U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
|
||||
// U+010D: "č" LATIN SMALL LETTER C WITH CARON
|
||||
.setMoreKeysOf("c", "\u00E7", "\u0107", "\u010D");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue