diff options
author | 2014-01-17 10:40:05 +0900 | |
---|---|---|
committer | 2014-01-27 18:17:33 +0900 | |
commit | c7ef305bbc119b820fd619d3ed205198d4f98c3f (patch) | |
tree | e219c2485b2da81ac5a9a6f2373dce60408bc765 /tests/src/com/android/inputmethod/latin/PunctuationTests.java | |
parent | 963d97af6d83f62c48a4395caca8ac64972f8a57 (diff) | |
download | latinime-c7ef305bbc119b820fd619d3ed205198d4f98c3f.tar.gz latinime-c7ef305bbc119b820fd619d3ed205198d4f98c3f.tar.xz latinime-c7ef305bbc119b820fd619d3ed205198d4f98c3f.zip |
Try to figure out whether d.quotes open or close.
Bug: 8911672
Change-Id: I5d5635949530a67f95e5208986907251b7bce903
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/PunctuationTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/PunctuationTests.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/PunctuationTests.java b/tests/src/com/android/inputmethod/latin/PunctuationTests.java index d5c06e223..556af0906 100644 --- a/tests/src/com/android/inputmethod/latin/PunctuationTests.java +++ b/tests/src/com/android/inputmethod/latin/PunctuationTests.java @@ -169,4 +169,32 @@ public class PunctuationTests extends InputTestsBase { + " ; Suggestions = " + mLatinIME.getSuggestedWords(), EXPECTED_RESULT, mEditText.getText().toString()); } + + public void testAutoSpaceWithDoubleQuotes() { + final String STRING_TO_TYPE = "He said\"hello\"to me. I replied,\"hi\"." + + "Then, 5\"passed. He said\"bye\"and left."; + final String EXPECTED_RESULT = "He said \"hello\" to me. I replied, \"hi\". " + + "Then, 5\" passed. He said \"bye\" and left. \""; + // Split by double quote, so that we can type the double quotes individually. + for (final String partToType : STRING_TO_TYPE.split("\"")) { + // Split at word boundaries. This regexp means "anywhere that is preceded + // by a word character but not followed by a word character, OR that is not + // preceded by a word character but followed by a word character". + // We need to input word by word because auto-spaces are only active when + // manually picking or gesturing (which we can't simulate yet), but only words + // can be picked. + final String[] wordsToType = partToType.split("(?<=\\w)(?!\\w)|(?<!\\w)(?=\\w)"); + for (final String wordToType : wordsToType) { + type(wordToType); + if (wordToType.matches("^\\w+$")) { + // Only pick selection if that was a word, because if that was not a word, + // then we don't have a composition. + pickSuggestionManually(0, wordToType); + } + } + type("\""); + } + assertEquals("auto-space with double quotes", + EXPECTED_RESULT, mEditText.getText().toString()); + } } |