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.Swiss;
23import com.android.inputmethod.keyboard.layout.customizer.ItalianCustomizer;
24import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
25
26import java.util.Locale;
27
28/**
29 * it_CH: Italian (Switzerland)/swiss
30 */
31@SmallTest
32public final class TestsItalianCH extends LayoutTestsBase {
33    private static final Locale LOCALE = new Locale("it", "CH");
34    private static final LayoutBase LAYOUT = new Swiss(new ItalianCHCustomizer(LOCALE));
35
36    @Override
37    LayoutBase getLayout() { return LAYOUT; }
38
39    private static class ItalianCHCustomizer extends ItalianCustomizer {
40        ItalianCHCustomizer(final Locale locale) { super(locale); }
41
42        @Override
43        public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
44            super.setAccentedLetters(builder);
45            return builder
46                    // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
47                    // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
48                    .replaceKeyOfLabel(Swiss.ROW1_11, key("\u00FC", moreKey("\u00E8")))
49                    // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
50                    // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
51                    .replaceKeyOfLabel(Swiss.ROW2_10, key("\u00F6", moreKey("\u00E9")))
52                    // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
53                    // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
54                    .replaceKeyOfLabel(Swiss.ROW2_11, key("\u00E4", moreKey("\u00E0")));
55        }
56    }
57}
58