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.LayoutBase;
23import com.android.inputmethod.keyboard.layout.Symbols;
24import com.android.inputmethod.keyboard.layout.SymbolsShifted;
25import com.android.inputmethod.keyboard.layout.customizer.EastSlavicCustomizer;
26import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
27import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
28
29import java.util.Locale;
30
31/**
32 * uk: Ukrainian/east_slavic
33 */
34@SmallTest
35public final class TestsUkrainian extends LayoutTestsBase {
36    private static final Locale LOCALE = new Locale("uk");
37    private static final LayoutBase LAYOUT = new EastSlavic(new UkrainianCustomizer(LOCALE));
38
39    @Override
40    LayoutBase getLayout() { return LAYOUT; }
41
42    private static class UkrainianCustomizer extends EastSlavicCustomizer {
43        UkrainianCustomizer(final Locale locale) { super(locale); }
44
45        @Override
46        public ExpectedKey getCurrencyKey() { return CURRENCY_HRYVNIA; }
47
48        @Override
49        public ExpectedKey[] getOtherCurrencyKeys() {
50            return SymbolsShifted.CURRENCIES_OTHER_GENERIC;
51        }
52
53        @Override
54        public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
55
56        @Override
57        public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_R9L; }
58
59        // U+20B4: "₴" HRYVNIA SIGN
60        private static final ExpectedKey CURRENCY_HRYVNIA = key("\u20B4",
61                Symbols.CURRENCY_GENERIC_MORE_KEYS);
62
63        @Override
64        public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
65            return builder
66                    // U+0433: "г" CYRILLIC SMALL LETTER GHE
67                    // U+0491: "ґ" CYRILLIC SMALL LETTER GHE WITH UPTURN
68                    .setMoreKeysOf("\u0433", "\u0491")
69                    // U+0449: "щ" CYRILLIC SMALL LETTER SHCHA
70                    .replaceKeyOfLabel(EastSlavic.ROW1_9, key("\u0449", additionalMoreKey("9")))
71                    // U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
72                    // U+0457: "ї" CYRILLIC SMALL LETTER YI
73                    .replaceKeyOfLabel(EastSlavic.ROW2_2, key("\u0456", moreKey("\u0457")))
74                    // U+0454: "є" CYRILLIC SMALL LETTER UKRAINIAN IE
75                    .replaceKeyOfLabel(EastSlavic.ROW2_11, "\u0454")
76                    // U+0438: "и" CYRILLIC SMALL LETTER I
77                    .replaceKeyOfLabel(EastSlavic.ROW3_5, "\u0438")
78                    // U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
79                    // U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN
80                    .setMoreKeysOf("\u044C", "\u044A");
81        }
82    }
83}
84