1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.inputmethod.keyboard.layout.tests; 18 19import android.test.suitebuilder.annotation.SmallTest; 20 21import com.android.inputmethod.keyboard.layout.EastSlavic; 22import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer; 23import com.android.inputmethod.keyboard.layout.LayoutBase; 24import com.android.inputmethod.keyboard.layout.Symbols; 25import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; 26import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; 27 28import java.util.Locale; 29 30/** 31 * ru: Russian/east_slavic 32 */ 33@SmallTest 34public final class TestsRussian extends LayoutTestsBase { 35 private static final Locale LOCALE = new Locale("ru"); 36 private static final LayoutBase LAYOUT = new EastSlavic(new RussianCustomizer(LOCALE)); 37 38 @Override 39 LayoutBase getLayout() { return LAYOUT; } 40 41 private static class RussianCustomizer extends EastSlavicCustomizer { 42 public RussianCustomizer(final Locale locale) { super(locale); } 43 44 @Override 45 public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; } 46 47 @Override 48 public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_R9L; } 49 50 @Override 51 public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) { 52 return builder 53 // U+0435: "е" CYRILLIC SMALL LETTER IE 54 // U+0451: "ё" CYRILLIC SMALL LETTER IO 55 .setMoreKeysOf("\u0435", "\u0451") 56 // U+0449: "щ" CYRILLIC SMALL LETTER SHCHA 57 .replaceKeyOfLabel(EastSlavic.ROW1_9, key("\u0449", additionalMoreKey("9"))) 58 // U+044B: "ы" CYRILLIC SMALL LETTER YERU 59 .replaceKeyOfLabel(EastSlavic.ROW2_2, "\u044B") 60 // U+044D: "э" CYRILLIC SMALL LETTER E 61 .replaceKeyOfLabel(EastSlavic.ROW2_11, "\u044D") 62 // U+0438: "и" CYRILLIC SMALL LETTER I 63 .replaceKeyOfLabel(EastSlavic.ROW3_5, "\u0438") 64 // U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN 65 // U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN 66 .setMoreKeysOf("\u044C", "\u044A"); 67 } 68 } 69} 70