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.PcQwerty; 23import com.android.inputmethod.keyboard.layout.customizer.LayoutCustomizer; 24import com.android.inputmethod.keyboard.layout.customizer.PcQwertyCustomizer; 25import com.android.inputmethod.keyboard.layout.customizer.SwedishCustomizer; 26import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; 27import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; 28 29import java.util.Locale; 30 31/** 32 * sv: Swedish/pcqwerty 33 */ 34@SmallTest 35public final class TestsSwedishPcQwerty extends LayoutTestsBase { 36 private static final Locale LOCALE = new Locale("sv"); 37 private static final LayoutBase LAYOUT = new PcQwerty(new SwedishPcQwertyCustomizer(LOCALE)); 38 39 @Override 40 LayoutBase getLayout() { return LAYOUT; } 41 42 private static class SwedishPcQwertyCustomizer extends SwedishCustomizer { 43 private final LayoutCustomizer mPcQwertyCustomizer; 44 45 SwedishPcQwertyCustomizer(final Locale locale) { 46 super(locale); 47 mPcQwertyCustomizer = new PcQwertyCustomizer(locale); 48 } 49 50 @Override 51 public ExpectedKey getCurrencyKey() { 52 return mPcQwertyCustomizer.getCurrencyKey(); 53 } 54 55 @Override 56 public ExpectedKey[] getOtherCurrencyKeys() { 57 return mPcQwertyCustomizer.getOtherCurrencyKeys(); 58 } 59 60 @Override 61 public int getNumberOfRows() { 62 return mPcQwertyCustomizer.getNumberOfRows(); 63 } 64 65 @Override 66 public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) { 67 return mPcQwertyCustomizer.getLeftShiftKeys(isPhone); 68 } 69 70 @Override 71 public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { 72 return mPcQwertyCustomizer.getRightShiftKeys(isPhone); 73 } 74 75 @Override 76 public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) { 77 return mPcQwertyCustomizer.getKeysLeftToSpacebar(isPhone); 78 } 79 80 @Override 81 public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) { 82 return mPcQwertyCustomizer.getKeysRightToSpacebar(isPhone); 83 } 84 85 @Override 86 protected void setNordicKeys(final ExpectedKeyboardBuilder builder) { 87 // PC QWERTY layout doesn't have Nordic keys. 88 } 89 90 @Override 91 protected void setMoreKeysOfA(final ExpectedKeyboardBuilder builder) { 92 builder 93 // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS 94 // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE 95 // U+00E6: "æ" LATIN SMALL LETTER AE 96 // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE 97 // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE 98 // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX 99 // U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK 100 // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE 101 .setMoreKeysOf("a", "\u00E4", "\u00E5", "\u00E6", "\u00E1", "\u00E0", "\u00E2", 102 "\u0105", "\u00E3"); 103 } 104 105 @Override 106 protected void setMoreKeysOfO(final ExpectedKeyboardBuilder builder) { 107 builder 108 // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS 109 // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE 110 // U+0153: "œ" LATIN SMALL LIGATURE OE 111 // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE 112 // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE 113 // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX 114 // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE 115 // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON 116 .setMoreKeysOf("o", "\u00F6", "\u00F8", "\u0153", "\u00F3", "\u00F2", "\u00F4", 117 "\u00F5", "\u014D"); 118 } 119 120 } 121} 122