aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-02-13 18:43:48 +0900
committerTadashi G. Takaoka <takaoka@google.com>2014-02-14 14:13:39 +0900
commita273319c59ad24070ee5b35d72f044df496faa02 (patch)
treef3505d45280906128912a0ba99ac44bb984b1843 /tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java
parent4197c6f3ab1db7d37bfb5fca05bd7169504f451e (diff)
downloadlatinime-a273319c59ad24070ee5b35d72f044df496faa02.tar.gz
latinime-a273319c59ad24070ee5b35d72f044df496faa02.tar.xz
latinime-a273319c59ad24070ee5b35d72f044df496faa02.zip
Add PunctuationSuggestions class
This change must be checked in together with I366c477516. Bug: 12640318 Change-Id: I8d3864b9d9649c9e3306e82b01a6327b11281b1f
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java40
1 files changed, 24 insertions, 16 deletions
diff --git a/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java b/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java
index 424e7ff1b..09920bfe9 100644
--- a/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java
+++ b/tests/src/com/android/inputmethod/latin/settings/SpacingAndPunctuationsTests.java
@@ -373,29 +373,37 @@ public class SpacingAndPunctuationsTests extends AndroidTestCase {
assertTrue(SWISS_GERMAN.mUsesGermanRules);
}
- private static void testingStandardPunctuationSuggestions(final SpacingAndPunctuations sp) {
+ private static final String[] PUNCTUATION_LABELS = {
+ "!", "?", ",", ":", ";", "\"", "(", ")", "'", "-", "/", "@", "_"
+ };
+ private static final String[] PUNCTUATION_WORDS_LTR = PUNCTUATION_LABELS;
+ private static final String[] PUNCTUATION_WORDS_RTL = {
+ "!", "?", ",", ":", ";", "\"", ")", "(", "'", "-", "/", "@", "_"
+ };
+
+ private static void testingStandardPunctuationSuggestions(final SpacingAndPunctuations sp,
+ final String[] punctuationWords) {
final SuggestedWords suggestedWords = sp.mSuggestPuncList;
assertFalse("typedWordValid", suggestedWords.mTypedWordValid);
assertFalse("willAutoCorrect", suggestedWords.mWillAutoCorrect);
- assertTrue("isPunctuationSuggestions", suggestedWords.mIsPunctuationSuggestions);
+ assertTrue("isPunctuationSuggestions", suggestedWords.isPunctuationSuggestions());
assertFalse("isObsoleteSuggestions", suggestedWords.mIsObsoleteSuggestions);
assertFalse("isPrediction", suggestedWords.mIsPrediction);
- final String[] punctuations = {
- "!", "?", ",", ":", ";", "\"", "(", ")", "'", "-", "/", "@", "_"
- };
- assertEquals("size", punctuations.length, suggestedWords.size());
- for (int index = 0; index < punctuations.length; index++) {
- assertEquals("punctuation at " + index,
- punctuations[index], suggestedWords.getWord(index));
+ assertEquals("size", PUNCTUATION_LABELS.length, suggestedWords.size());
+ for (int index = 0; index < suggestedWords.size(); index++) {
+ assertEquals("punctuation label at " + index,
+ PUNCTUATION_LABELS[index], suggestedWords.getLabel(index));
+ assertEquals("punctuation word at " + index,
+ punctuationWords[index], suggestedWords.getWord(index));
}
}
+
public void testPunctuationSuggestions() {
- testingStandardPunctuationSuggestions(ENGLISH);
- testingStandardPunctuationSuggestions(FRENCH);
- testingStandardPunctuationSuggestions(GERMAN);
- // TODO: Should fix these RTL languages
- testingStandardPunctuationSuggestions(ARABIC);
- testingStandardPunctuationSuggestions(PERSIAN);
- testingStandardPunctuationSuggestions(HEBREW);
+ testingStandardPunctuationSuggestions(ENGLISH, PUNCTUATION_WORDS_LTR);
+ testingStandardPunctuationSuggestions(FRENCH, PUNCTUATION_WORDS_LTR);
+ testingStandardPunctuationSuggestions(GERMAN, PUNCTUATION_WORDS_LTR);
+ testingStandardPunctuationSuggestions(ARABIC, PUNCTUATION_WORDS_RTL);
+ testingStandardPunctuationSuggestions(PERSIAN, PUNCTUATION_WORDS_RTL);
+ testingStandardPunctuationSuggestions(HEBREW, PUNCTUATION_WORDS_RTL);
}
}