diff options
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java | 13 | ||||
-rw-r--r-- | tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java | 82 |
2 files changed, 48 insertions, 47 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java index 3cd6a8944..1f6141e50 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java @@ -90,7 +90,8 @@ public class KeyboardStateTests extends AndroidTestCase { // Argument for KeyboardState.onCodeInput. private static final boolean SINGLE = true; private static final boolean MULTI = false; - + private static final boolean NO_AUTO_CAPS = false; + private static final boolean AUTO_CAPS = true; private void assertAlphabetNormal() { assertEquals(ALPHABET_UNSHIFTED, mSwitcher.mLayout); @@ -213,7 +214,7 @@ public class KeyboardStateTests extends AndroidTestCase { // Long press recognized in LatinKeyboardView.KeyTimerHandler. mState.onToggleCapsLock(); assertAlphabetShiftLocked(); - mState.onCodeInput(Keyboard.CODE_CAPSLOCK, SINGLE); + mState.onCodeInput(Keyboard.CODE_CAPSLOCK, SINGLE, NO_AUTO_CAPS); assertAlphabetShiftLocked(); mState.onReleaseShift(NOT_SLIDING); assertAlphabetShiftLocked(); @@ -224,7 +225,7 @@ public class KeyboardStateTests extends AndroidTestCase { // Long press recognized in LatinKeyboardView.KeyTimerHandler. mState.onToggleCapsLock(); assertAlphabetNormal(); - mState.onCodeInput(Keyboard.CODE_CAPSLOCK, SINGLE); + mState.onCodeInput(Keyboard.CODE_CAPSLOCK, SINGLE, NO_AUTO_CAPS); assertAlphabetNormal(); mState.onReleaseShift(NOT_SLIDING); assertAlphabetNormal(); @@ -236,7 +237,7 @@ public class KeyboardStateTests extends AndroidTestCase { // First shift key tap. mState.onPressShift(NOT_SLIDING); assertAlphabetManualShifted(); - mState.onCodeInput(Keyboard.CODE_SHIFT, SINGLE); + mState.onCodeInput(Keyboard.CODE_SHIFT, SINGLE, NO_AUTO_CAPS); assertAlphabetManualShifted(); mState.onReleaseShift(NOT_SLIDING); assertAlphabetManualShifted(); @@ -244,13 +245,13 @@ public class KeyboardStateTests extends AndroidTestCase { // Double tap recognized in LatinKeyboardView.KeyTimerHandler. mState.onToggleCapsLock(); assertAlphabetShiftLocked(); - mState.onCodeInput(Keyboard.CODE_SHIFT, SINGLE); + mState.onCodeInput(Keyboard.CODE_SHIFT, SINGLE, NO_AUTO_CAPS); assertAlphabetShiftLocked(); // First shift key tap. mState.onPressShift(NOT_SLIDING); assertAlphabetManualShifted(); - mState.onCodeInput(Keyboard.CODE_SHIFT, SINGLE); + mState.onCodeInput(Keyboard.CODE_SHIFT, SINGLE, NO_AUTO_CAPS); assertAlphabetManualShifted(); mState.onReleaseShift(NOT_SLIDING); assertAlphabetNormal(); diff --git a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java index 798fca0f5..0eb324234 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java @@ -89,78 +89,78 @@ public class MoreKeySpecParserTests extends AndroidTestCase { assertParser("Single escaped at", "\\@", "@", null, ICON_UNDEFINED, '@'); assertParser("Single letter with outputText", "a|abc", - "a", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a", "abc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single letter with escaped outputText", "a|a\\|c", - "a", "a|c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a", "a|c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single letter with comma outputText", "a|a,b", - "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single letter with escaped comma outputText", "a|a\\,b", - "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single letter with outputText starts with at", "a|@bc", - "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single letter with outputText contains at", "a|a@c", - "a", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a", "a@c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single letter with escaped at outputText", "a|\\@bc", - "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single escaped escape with outputText", "\\\\|\\\\", - "\\", "\\", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "\\", "\\", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single escaped bar with outputText", "\\||\\|", - "|", "|", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "|", "|", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Single letter with code", "a|" + CODE_SETTINGS, "a", null, ICON_UNDEFINED, mCodeSettings); } public void testLabel() { assertParser("Simple label", "abc", - "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped bar", "a\\|c", - "a|c", "a|c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a|c", "a|c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped escape", "a\\\\c", - "a\\c", "a\\c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a\\c", "a\\c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with comma", "a,c", - "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped comma", "a\\,c", - "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label starts with at", "@bc", - "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label contains at", "a@c", - "a@c", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a@c", "a@c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped at", "\\@bc", - "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped letter", "\\abc", - "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with outputText", "abc|def", - "abc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with comma and outputText", "a,c|def", - "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Escaped comma label with outputText", "a\\,c|def", - "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Escaped label with outputText", "a\\|c|def", - "a|c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a|c", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped bar outputText", "abc|d\\|f", - "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Escaped escape label with outputText", "a\\\\|def", - "a\\", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a\\", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label starts with at and outputText", "@bc|def", - "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label contains at label and outputText", "a@c|def", - "a@c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a@c", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Escaped at label with outputText", "\\@bc|def", - "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with comma outputText", "abc|a,b", - "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped comma outputText", "abc|a\\,b", - "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with outputText starts with at", "abc|@bc", - "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with outputText contains at", "abc|a@c", - "abc", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "a@c", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped at outputText", "abc|\\@bc", - "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with escaped bar outputText", "abc|d\\|f", - "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Escaped bar label with escaped bar outputText", "a\\|c|d\\|f", - "a|c", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + "a|c", "d|f", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParser("Label with code", "abc|" + CODE_SETTINGS, "abc", null, ICON_UNDEFINED, mCodeSettings); assertParser("Escaped label with code", "a\\|c|" + CODE_SETTINGS, @@ -169,13 +169,13 @@ public class MoreKeySpecParserTests extends AndroidTestCase { public void testIconAndCode() { assertParser("Icon with outputText", ICON_SETTINGS + "|abc", - null, "abc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); + null, "abc", ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED); assertParser("Icon with outputText starts with at", ICON_SETTINGS + "|@bc", - null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); + null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED); assertParser("Icon with outputText contains at", ICON_SETTINGS + "|a@c", - null, "a@c", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); + null, "a@c", ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED); assertParser("Icon with escaped at outputText", ICON_SETTINGS + "|\\@bc", - null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); + null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED); assertParser("Label starts with at and code", "@bc|" + CODE_SETTINGS, "@bc", null, ICON_UNDEFINED, mCodeSettings); assertParser("Label contains at and code", "a@c|" + CODE_SETTINGS, @@ -190,7 +190,7 @@ public class MoreKeySpecParserTests extends AndroidTestCase { assertParserError("Empty spec", "", null, null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParserError("Empty label with outputText", "|a", - null, "a", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + null, "a", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParserError("Empty label with code", "|" + CODE_SETTINGS, null, null, ICON_UNDEFINED, mCodeSettings); assertParserError("Empty outputText with label", "a|", @@ -200,9 +200,9 @@ public class MoreKeySpecParserTests extends AndroidTestCase { assertParserError("Empty icon and code", "|", null, null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParserError("Icon without code", ICON_SETTINGS, - null, null, ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY); + null, null, ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED); assertParser("Non existing icon", ICON_NON_EXISTING + "|abc", - null, "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY); + null, "abc", ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParserError("Non existing code", "abc|" + CODE_NON_EXISTING, "abc", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED); assertParserError("Third bar at end", "a|b|", |