diff options
author | 2014-04-08 18:58:26 +0900 | |
---|---|---|
committer | 2014-04-08 22:24:25 +0900 | |
commit | 90608190ecbcdcb9a820174c4eb8166439932f61 (patch) | |
tree | 7efd4a0ef23e1d1b2f00d59c0a1cef685c26a69d /tests/src/com/android/inputmethod/latin/ShiftModeTests.java | |
parent | 36dfb6d1a4188be8ad4458808f7b5dc8fe88306c (diff) | |
download | latinime-90608190ecbcdcb9a820174c4eb8166439932f61.tar.gz latinime-90608190ecbcdcb9a820174c4eb8166439932f61.tar.xz latinime-90608190ecbcdcb9a820174c4eb8166439932f61.zip |
Add shift mode tests
Change-Id: I067e91a1f899c1f83fd60adeae66495606812a95
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/ShiftModeTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/ShiftModeTests.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/ShiftModeTests.java b/tests/src/com/android/inputmethod/latin/ShiftModeTests.java new file mode 100644 index 000000000..806fad060 --- /dev/null +++ b/tests/src/com/android/inputmethod/latin/ShiftModeTests.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.latin; + +import android.test.suitebuilder.annotation.LargeTest; +import android.text.TextUtils; +import android.view.inputmethod.EditorInfo; + +import com.android.inputmethod.latin.Constants; +import com.android.inputmethod.latin.WordComposer; + +@LargeTest +public class ShiftModeTests extends InputTestsBase { + + @Override + protected EditorInfo enrichEditorInfo(final EditorInfo ei) { + ei.inputType |= TextUtils.CAP_MODE_SENTENCES; + ei.initialCapsMode = TextUtils.CAP_MODE_SENTENCES; + return ei; + } + + private boolean isCapsModeAutoShifted() { + return mLatinIME.mKeyboardSwitcher.getKeyboardShiftMode() + == WordComposer.CAPS_MODE_AUTO_SHIFTED; + } + + public void testTypicalSentence() { + assertTrue("Initial auto caps state", isCapsModeAutoShifted()); + type("Test"); + assertFalse("Caps after letter", isCapsModeAutoShifted()); + type(" "); + assertFalse("Caps after space", isCapsModeAutoShifted()); + type("some,"); + assertFalse("Caps after comma", isCapsModeAutoShifted()); + type(" "); + assertFalse("Caps after comma space", isCapsModeAutoShifted()); + type("words."); + assertFalse("Caps directly after period", isCapsModeAutoShifted()); + type(" "); + assertTrue("Caps after period space", isCapsModeAutoShifted()); + } +} |