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