diff options
Diffstat (limited to 'tests')
3 files changed, 18 insertions, 3 deletions
diff --git a/tests/res/values/donottranslate.xml b/tests/res/values/donottranslate.xml index d0cde71a5..1ca4451d4 100644 --- a/tests/res/values/donottranslate.xml +++ b/tests/res/values/donottranslate.xml @@ -50,4 +50,7 @@ <string name="multiple_labels_with_escape_surrounded_by_spaces">" \\abc , d\\ef , gh\\i "</string> <string name="multiple_labels_with_comma_and_escape">"ab\\\\,d\\\\\\,,g\\,i"</string> <string name="multiple_labels_with_comma_and_escape_surrounded_by_spaces">" ab\\\\ , d\\\\\\, , g\\,i "</string> + <string name="indirect_string">@string/multiple_chars</string> + <string name="indirect_string_with_literal">x,@string/multiple_chars,y</string> + <string name="infinite_indirection">infinite,@string/infinite_indirection,loop</string> </resources> diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserCsvTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserCsvTests.java index a0ce86d1c..e090031e4 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserCsvTests.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserCsvTests.java @@ -288,4 +288,16 @@ public class KeySpecParserCsvTests extends AndroidTestCase { "abc@string/multiple_labels", "abcabc", "def", "ghi"); } + + public void testParseIndirectReference() { + assertTextArray("Indirect", + "@string/indirect_string", "a", "b", "c"); + assertTextArray("Indirect with literal", + "1,@string/indirect_string_with_literal,2", "1", "x", "a", "b", "c", "y", "2"); + } + + public void testParseInfiniteIndirectReference() { + assertError("Infinite indirection", + "1,@string/infinite_indirection,2", "1", "infinite", "<infinite>", "loop", "2"); + } } diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java index ee3a97fab..693352c85 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java @@ -186,7 +186,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> { } public void testCancelDoubleSpace() { - final String STRING_TO_TYPE = "tgis "; + final String STRING_TO_TYPE = "this "; final String EXPECTED_RESULT = "this "; type(STRING_TO_TYPE); type(Keyboard.CODE_DELETE); @@ -202,7 +202,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> { mInputConnection.setSelection(NEW_CURSOR_POSITION, NEW_CURSOR_POSITION); mLatinIME.onUpdateSelection(0, 0, NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1); type(Keyboard.CODE_DELETE); - assertEquals("auto correct then move curor to start of line then backspace", + assertEquals("auto correct then move cursor to start of line then backspace", EXPECTED_RESULT, mTextView.getText().toString()); } @@ -215,7 +215,7 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> { mInputConnection.setSelection(NEW_CURSOR_POSITION, NEW_CURSOR_POSITION); mLatinIME.onUpdateSelection(0, 0, NEW_CURSOR_POSITION, NEW_CURSOR_POSITION, -1, -1); type(Keyboard.CODE_DELETE); - assertEquals("auto correct then move curor then backspace", + assertEquals("auto correct then move cursor then backspace", EXPECTED_RESULT, mTextView.getText().toString()); } |