aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/ShiftModeTests.java
diff options
context:
space:
mode:
authorAmin Bandali <bandali@kelar.org>2024-12-16 21:45:41 -0500
committerAmin Bandali <bandali@kelar.org>2025-01-11 14:17:35 -0500
commite9a0e66716dab4dd3184d009d8920de1961efdfa (patch)
tree02dcc096643d74645bf28459c2834c3d4a2ad7f2 /tests/src/com/android/inputmethod/latin/ShiftModeTests.java
parentfb3b9360d70596d7e921de8bf7d3ca99564a077e (diff)
downloadlatinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.tar.gz
latinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.tar.xz
latinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.zip
Rename to Kelar Keyboard (org.kelar.inputmethod.latin)
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/ShiftModeTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/ShiftModeTests.java125
1 files changed, 0 insertions, 125 deletions
diff --git a/tests/src/com/android/inputmethod/latin/ShiftModeTests.java b/tests/src/com/android/inputmethod/latin/ShiftModeTests.java
deleted file mode 100644
index 9b6e72be2..000000000
--- a/tests/src/com/android/inputmethod/latin/ShiftModeTests.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.text.TextUtils;
-import android.view.inputmethod.EditorInfo;
-
-import androidx.test.filters.LargeTest;
-
-import com.android.inputmethod.latin.common.Constants;
-
-@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());
- }
-
- public void testBackspace() {
- assertTrue("Initial auto caps state", isCapsModeAutoShifted());
- type("A");
- assertFalse("Caps state after one letter", isCapsModeAutoShifted());
- type(Constants.CODE_DELETE);
- assertTrue("Auto caps state at start after delete", isCapsModeAutoShifted());
- }
-
- public void testRepeatingBackspace() {
- final String SENTENCE_TO_TYPE = "Test sentence. Another.";
- final int BACKSPACE_COUNT =
- SENTENCE_TO_TYPE.length() - SENTENCE_TO_TYPE.lastIndexOf(' ') - 1;
-
- type(SENTENCE_TO_TYPE);
- assertFalse("Caps after typing \"" + SENTENCE_TO_TYPE + "\"", isCapsModeAutoShifted());
- type(Constants.CODE_DELETE);
- for (int i = 1; i < BACKSPACE_COUNT; ++i) {
- repeatKey(Constants.CODE_DELETE);
- }
- assertFalse("Caps immediately after repeating Backspace a lot", isCapsModeAutoShifted());
- sleep(DELAY_TO_WAIT_FOR_PREDICTIONS_MILLIS);
- runMessages();
- assertTrue("Caps after a while after repeating Backspace a lot", isCapsModeAutoShifted());
- }
-
- public void testAutoCapsAfterDigitsPeriod() {
- changeLanguage("en");
- type("On 22.11.");
- assertFalse("(English) Auto caps after digits-period", isCapsModeAutoShifted());
- type(" ");
- assertTrue("(English) Auto caps after digits-period-whitespace", isCapsModeAutoShifted());
- mEditText.setText("");
- changeLanguage("fr");
- type("Le 22.");
- assertFalse("(French) Auto caps after digits-period", isCapsModeAutoShifted());
- type(" ");
- assertTrue("(French) Auto caps after digits-period-whitespace", isCapsModeAutoShifted());
- mEditText.setText("");
- changeLanguage("de");
- type("Am 22.");
- assertFalse("(German) Auto caps after digits-period", isCapsModeAutoShifted());
- type(" ");
- // For German, no auto-caps in this case
- assertFalse("(German) Auto caps after digits-period-whitespace", isCapsModeAutoShifted());
- }
-
- public void testAutoCapsAfterInvertedMarks() {
- changeLanguage("es");
- assertTrue("(Spanish) Auto caps at start", isCapsModeAutoShifted());
- type("Hey. ¿");
- assertTrue("(Spanish) Auto caps after inverted what", isCapsModeAutoShifted());
- mEditText.setText("");
- type("¡");
- assertTrue("(Spanish) Auto caps after inverted bang", isCapsModeAutoShifted());
- }
-
- public void testOtherSentenceSeparators() {
- changeLanguage("hy_AM");
- assertTrue("(Armenian) Auto caps at start", isCapsModeAutoShifted());
- type("Hey. ");
- assertFalse("(Armenian) No auto-caps after latin period", isCapsModeAutoShifted());
- type("Hey\u0589");
- assertFalse("(Armenian) No auto-caps directly after armenian period",
- isCapsModeAutoShifted());
- type(" ");
- assertTrue("(Armenian) Auto-caps after armenian period-whitespace",
- isCapsModeAutoShifted());
- }
-}