Home | History | Annotate | Download | only in tests
      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 
     17 package com.android.inputmethod.keyboard.layout.tests;
     18 
     19 import android.test.suitebuilder.annotation.SmallTest;
     20 
     21 import com.android.inputmethod.keyboard.layout.LayoutBase;
     22 import com.android.inputmethod.keyboard.layout.SouthSlavic;
     23 import com.android.inputmethod.keyboard.layout.SouthSlavic.SouthSlavicLayoutCustomizer;
     24 import com.android.inputmethod.keyboard.layout.Symbols;
     25 import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
     26 import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
     27 
     28 import java.util.Locale;
     29 
     30 /**
     31  * sr: Serbian/south_slavic
     32  */
     33 @SmallTest
     34 public final class TestsSerbian extends LayoutTestsBase {
     35     private static final Locale LOCALE = new Locale("sr");
     36     private static final LayoutBase LAYOUT = new SouthSlavic(new SerbianCustomizer(LOCALE));
     37 
     38     @Override
     39     LayoutBase getLayout() { return LAYOUT; }
     40 
     41     private static class SerbianCustomizer extends SouthSlavicLayoutCustomizer {
     42         public SerbianCustomizer(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 ExpectedKey[] getDoubleAngleQuoteKeys() { return Symbols.DOUBLE_ANGLE_QUOTES_RL; }
     52 
     53         @Override
     54         public ExpectedKey[] getSingleAngleQuoteKeys() { return Symbols.SINGLE_ANGLE_QUOTES_RL; }
     55 
     56         @Override
     57         public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
     58             return builder
     59                     // U+0435: "" CYRILLIC SMALL LETTER IE
     60                     // U+0450: "" CYRILLIC SMALL LETTER IE WITH GRAVE
     61                     .setMoreKeysOf("\u0435", "\u0450")
     62                     // U+0437: "" CYRILLIC SMALL LETTER ZE
     63                     .replaceKeyOfLabel(SouthSlavic.ROW1_6, key("\u0437", additionalMoreKey("6")))
     64                     // U+0438: "" CYRILLIC SMALL LETTER I
     65                     // U+045D: "" CYRILLIC SMALL LETTER I WITH GRAVE
     66                     .setMoreKeysOf("\u0438", "\u045D")
     67                     // U+045B: "" CYRILLIC SMALL LETTER TSHE
     68                     .replaceKeyOfLabel(SouthSlavic.ROW2_11, "\u045B")
     69                     // U+0455: "" CYRILLIC SMALL LETTER DZE
     70                     .replaceKeyOfLabel(SouthSlavic.ROW3_1, "\u0455")
     71                     // U+0452: "" CYRILLIC SMALL LETTER DJE
     72                     .replaceKeyOfLabel(SouthSlavic.ROW3_8, "\u0452");
     73         }
     74     }
     75 }
     76