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; 20import android.view.inputmethod.EditorInfo; 21import android.view.inputmethod.InputMethodSubtype; 22 23import com.android.inputmethod.keyboard.KeyboardLayoutSet; 24import com.android.inputmethod.keyboard.layout.LayoutBase; 25import com.android.inputmethod.keyboard.layout.Qwerty; 26import com.android.inputmethod.keyboard.layout.customizer.EnglishCustomizer; 27import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; 28 29import java.util.Locale; 30 31/** 32 * en_US: English (United States)/qwerty - split layout 33 */ 34@SmallTest 35public class TestsSplitLayoutQwertyEnglishUS extends LayoutTestsBase { 36 private static final Locale LOCALE = new Locale("en", "US"); 37 private static final LayoutBase LAYOUT = new Qwerty(new EnglishSplitCustomizer(LOCALE)); 38 39 @Override 40 protected KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype, 41 final EditorInfo editorInfo, final boolean voiceInputKeyEnabled, 42 final boolean languageSwitchKeyEnabled, final boolean splitLayoutEnabled) { 43 return super.createKeyboardLayoutSet(subtype, editorInfo, voiceInputKeyEnabled, 44 languageSwitchKeyEnabled, true /* splitLayoutEnabled */); 45 } 46 47 @Override 48 LayoutBase getLayout() { return LAYOUT; } 49 50 private static class EnglishSplitCustomizer extends EnglishCustomizer { 51 EnglishSplitCustomizer(Locale locale) { super(locale); } 52 53 @Override 54 public ExpectedKey[] getSpaceKeys(final boolean isPhone) { 55 if (isPhone) { 56 return super.getSpaceKeys(isPhone); 57 } 58 return joinKeys(LANGUAGE_SWITCH_KEY, SPACE_KEY, SPACE_KEY); 59 } 60 } 61} 62