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.LayoutBase;
22import com.android.inputmethod.keyboard.layout.Qwerty;
23import com.android.inputmethod.keyboard.layout.customizer.EstonianEECustomizer;
24import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
25
26import java.util.Locale;
27
28/**
29 * et_EE: Estonian (Estonia)/qwerty
30 */
31@SmallTest
32public final class TestsEstonianEEQwerty extends LayoutTestsBase {
33    private static final Locale LOCALE = new Locale("et", "EE");
34    private static final LayoutBase LAYOUT = new Qwerty(new EstonianEEQwertyCustomizer(LOCALE));
35
36    @Override
37    LayoutBase getLayout() { return LAYOUT; }
38
39    private static class EstonianEEQwertyCustomizer extends EstonianEECustomizer {
40        EstonianEEQwertyCustomizer(final Locale locale) { super(locale); }
41
42        @Override
43        protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
44            // QWERTY layout doesn't have Nordic keys.
45        }
46
47        @Override
48        protected void setMoreKeysOfA(final ExpectedKeyboardBuilder builder) {
49            builder
50                    // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
51                    // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
52                    // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
53                    // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
54                    // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
55                    // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
56                    // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
57                    // U+00E6: "æ" LATIN SMALL LETTER AE
58                    // U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK
59                    .setMoreKeysOf("a", "\u00E4", "\u0101", "\u00E0", "\u00E1", "\u00E2", "\u00E3",
60                            "\u00E5", "\u00E6", "\u0105");
61        }
62
63        @Override
64        protected void setMoreKeysOfI(final ExpectedKeyboardBuilder builder, final int elementId) {
65            // TODO: The upper-case letter of "ı" in Estonian locale is "I". It should be omitted
66            // from the more keys of "I".
67            builder
68                    // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
69                    // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
70                    // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
71                    // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
72                    // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
73                    // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
74                    // U+0131: "ı" LATIN SMALL LETTER DOTLESS I
75                    .setMoreKeysOf("i",
76                            "\u012B", "\u00EC", "\u012F", "\u00ED", "\u00EE", "\u00EF", "\u0131");
77        }
78
79        @Override
80        protected void setMoreKeysOfO(final ExpectedKeyboardBuilder builder) {
81            builder
82                    // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
83                    // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
84                    // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
85                    // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
86                    // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
87                    // U+0153: "œ" LATIN SMALL LIGATURE OE
88                    // U+0151: "ő" LATIN SMALL LETTER O WITH DOUBLE ACUTE
89                    // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
90                    .setMoreKeysOf("o", "\u00F6", "\u00F5", "\u00F2", "\u00F3", "\u00F4", "\u0153",
91                            "\u0151", "\u00F8");
92        }
93
94        @Override
95        protected void setMoreKeysOfU(final ExpectedKeyboardBuilder builder) {
96            builder
97                    // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
98                    // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
99                    // U+0173: "ų" LATIN SMALL LETTER U WITH OGONEK
100                    // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
101                    // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
102                    // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
103                    // U+016F: "ů" LATIN SMALL LETTER U WITH RING ABOVE
104                    // U+0171: "ű" LATIN SMALL LETTER U WITH DOUBLE ACUTE
105                    .setMoreKeysOf("u", "\u00FC", "\u016B", "\u0173", "\u00F9", "\u00FA", "\u00FB",
106                            "\u016F", "\u0171");
107        }
108    }
109}
110