aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java128
-rw-r--r--tests/src/com/android/inputmethod/latin/ExpandableDictionaryTests.java13
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java15
-rw-r--r--tests/src/com/android/inputmethod/latin/InputTestsBase.java6
-rw-r--r--tests/src/com/android/inputmethod/latin/LatinImeStressTests.java61
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/CodePointUtils.java36
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java82
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java8
8 files changed, 294 insertions, 55 deletions
diff --git a/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java b/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java
index ded8eaa97..cd5384ea4 100644
--- a/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java
+++ b/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java
@@ -18,14 +18,18 @@ package com.android.inputmethod.latin;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
+import android.util.Pair;
+import com.android.inputmethod.latin.makedict.CodePointUtils;
import com.android.inputmethod.latin.makedict.FormatSpec;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import java.util.Random;
@LargeTest
public class BinaryDictionaryDecayingTests extends AndroidTestCase {
@@ -121,11 +125,16 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
binaryDictionary.addBigramWords("a", "c", DUMMY_PROBABILITY);
assertTrue(binaryDictionary.isValidBigram("a", "c"));
+ // Add bigrams of not valid unigrams.
+ binaryDictionary.addBigramWords("x", "y", Dictionary.NOT_A_PROBABILITY);
+ assertFalse(binaryDictionary.isValidBigram("x", "y"));
+ binaryDictionary.addBigramWords("x", "y", DUMMY_PROBABILITY);
+ assertFalse(binaryDictionary.isValidBigram("x", "y"));
+
binaryDictionary.close();
dictFile.delete();
}
- // TODO: Add large tests.
public void testDecayingProbability() {
File dictFile = null;
try {
@@ -179,4 +188,121 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
binaryDictionary.close();
dictFile.delete();
}
+
+ public void testAddManyUnigramsToDecayingDict() {
+ final int unigramCount = 30000;
+ final int unigramTypedCount = 100000;
+ final int codePointSetSize = 50;
+ final long seed = System.currentTimeMillis();
+ final Random random = new Random(seed);
+
+ File dictFile = null;
+ try {
+ dictFile = createEmptyDictionaryAndGetFile("TestBinaryDictionary");
+ } catch (IOException e) {
+ fail("IOException while writing an initial dictionary : " + e);
+ }
+ BinaryDictionary binaryDictionary = new BinaryDictionary(dictFile.getAbsolutePath(),
+ 0 /* offset */, dictFile.length(), true /* useFullEditDistance */,
+ Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */);
+
+ final int[] codePointSet = CodePointUtils.generateCodePointSet(codePointSetSize, random);
+ final ArrayList<String> words = new ArrayList<String>();
+
+ for (int i = 0; i < unigramCount; i++) {
+ final String word = CodePointUtils.generateWord(random, codePointSet);
+ words.add(word);
+ }
+
+ final int maxUnigramCount = Integer.parseInt(
+ binaryDictionary.getPropertyForTests(BinaryDictionary.MAX_UNIGRAM_COUNT_QUERY));
+ for (int i = 0; i < unigramTypedCount; i++) {
+ final String word = words.get(random.nextInt(words.size()));
+ binaryDictionary.addUnigramWord(word, DUMMY_PROBABILITY);
+
+ if (binaryDictionary.needsToRunGC(true /* mindsBlockByGC */)) {
+ final int unigramCountBeforeGC =
+ Integer.parseInt(binaryDictionary.getPropertyForTests(
+ BinaryDictionary.UNIGRAM_COUNT_QUERY));
+ while (binaryDictionary.needsToRunGC(true /* mindsBlockByGC */)) {
+ binaryDictionary.flushWithGC();
+ }
+ final int unigramCountAfterGC =
+ Integer.parseInt(binaryDictionary.getPropertyForTests(
+ BinaryDictionary.UNIGRAM_COUNT_QUERY));
+ assertTrue(unigramCountBeforeGC > unigramCountAfterGC);
+ }
+ }
+
+ assertTrue(Integer.parseInt(binaryDictionary.getPropertyForTests(
+ BinaryDictionary.UNIGRAM_COUNT_QUERY)) > 0);
+ assertTrue(Integer.parseInt(binaryDictionary.getPropertyForTests(
+ BinaryDictionary.UNIGRAM_COUNT_QUERY)) <= maxUnigramCount);
+ }
+
+ public void testAddManyBigramsToDecayingDict() {
+ final int unigramCount = 5000;
+ final int bigramCount = 30000;
+ final int bigramTypedCount = 100000;
+ final int codePointSetSize = 50;
+ final long seed = System.currentTimeMillis();
+ final Random random = new Random(seed);
+
+ File dictFile = null;
+ try {
+ dictFile = createEmptyDictionaryAndGetFile("TestBinaryDictionary");
+ } catch (IOException e) {
+ fail("IOException while writing an initial dictionary : " + e);
+ }
+ BinaryDictionary binaryDictionary = new BinaryDictionary(dictFile.getAbsolutePath(),
+ 0 /* offset */, dictFile.length(), true /* useFullEditDistance */,
+ Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */);
+
+ final int[] codePointSet = CodePointUtils.generateCodePointSet(codePointSetSize, random);
+ final ArrayList<String> words = new ArrayList<String>();
+ final ArrayList<Pair<String, String>> bigrams = new ArrayList<Pair<String, String>>();
+
+ for (int i = 0; i < unigramCount; ++i) {
+ final String word = CodePointUtils.generateWord(random, codePointSet);
+ words.add(word);
+ }
+ for (int i = 0; i < bigramCount; ++i) {
+ final int word0Index = random.nextInt(words.size());
+ int word1Index = random.nextInt(words.size() - 1);
+ if (word1Index >= word0Index) {
+ word1Index += 1;
+ }
+ final String word0 = words.get(word0Index);
+ final String word1 = words.get(word1Index);
+ final Pair<String, String> bigram = new Pair<String, String>(word0, word1);
+ bigrams.add(bigram);
+ }
+
+ final int maxBigramCount = Integer.parseInt(
+ binaryDictionary.getPropertyForTests(BinaryDictionary.MAX_BIGRAM_COUNT_QUERY));
+ for (int i = 0; i < bigramTypedCount; ++i) {
+ final Pair<String, String> bigram = bigrams.get(random.nextInt(bigrams.size()));
+ binaryDictionary.addUnigramWord(bigram.first, DUMMY_PROBABILITY);
+ binaryDictionary.addUnigramWord(bigram.second, DUMMY_PROBABILITY);
+ binaryDictionary.addBigramWords(bigram.first, bigram.second, DUMMY_PROBABILITY);
+
+ if (binaryDictionary.needsToRunGC(true /* mindsBlockByGC */)) {
+ final int bigramCountBeforeGC =
+ Integer.parseInt(binaryDictionary.getPropertyForTests(
+ BinaryDictionary.BIGRAM_COUNT_QUERY));
+ while (binaryDictionary.needsToRunGC(true /* mindsBlockByGC */)) {
+ binaryDictionary.flushWithGC();
+ }
+ final int bigramCountAfterGC =
+ Integer.parseInt(binaryDictionary.getPropertyForTests(
+ BinaryDictionary.BIGRAM_COUNT_QUERY));
+ assertTrue(bigramCountBeforeGC > bigramCountAfterGC);
+ }
+ }
+
+ assertTrue(Integer.parseInt(binaryDictionary.getPropertyForTests(
+ BinaryDictionary.BIGRAM_COUNT_QUERY)) > 0);
+ assertTrue(Integer.parseInt(binaryDictionary.getPropertyForTests(
+ BinaryDictionary.BIGRAM_COUNT_QUERY)) <= maxBigramCount);
+ }
}
diff --git a/tests/src/com/android/inputmethod/latin/ExpandableDictionaryTests.java b/tests/src/com/android/inputmethod/latin/ExpandableDictionaryTests.java
index ecf3af736..6aae1044e 100644
--- a/tests/src/com/android/inputmethod/latin/ExpandableDictionaryTests.java
+++ b/tests/src/com/android/inputmethod/latin/ExpandableDictionaryTests.java
@@ -26,13 +26,16 @@ import android.test.suitebuilder.annotation.SmallTest;
public class ExpandableDictionaryTests extends AndroidTestCase {
private final static int UNIGRAM_FREQ = 50;
+ // See UserBinaryDictionary for more information about this variable.
+ // For tests, its actual value does not matter.
+ private final static int SHORTCUT_FREQ = 14;
public void testAddWordAndGetWordFrequency() {
final ExpandableDictionary dict = new ExpandableDictionary(Dictionary.TYPE_USER);
// Add words
- dict.addWord("abcde", "abcde", UNIGRAM_FREQ);
- dict.addWord("abcef", null, UNIGRAM_FREQ + 1);
+ dict.addWord("abcde", "abcde", UNIGRAM_FREQ, SHORTCUT_FREQ);
+ dict.addWord("abcef", null, UNIGRAM_FREQ + 1, 0);
// Check words
assertFalse(dict.isValidWord("abcde"));
@@ -40,16 +43,16 @@ public class ExpandableDictionaryTests extends AndroidTestCase {
assertTrue(dict.isValidWord("abcef"));
assertEquals(UNIGRAM_FREQ+1, dict.getWordFrequency("abcef"));
- dict.addWord("abc", null, UNIGRAM_FREQ + 2);
+ dict.addWord("abc", null, UNIGRAM_FREQ + 2, 0);
assertTrue(dict.isValidWord("abc"));
assertEquals(UNIGRAM_FREQ + 2, dict.getWordFrequency("abc"));
// Add existing word with lower frequency
- dict.addWord("abc", null, UNIGRAM_FREQ);
+ dict.addWord("abc", null, UNIGRAM_FREQ, 0);
assertEquals(UNIGRAM_FREQ + 2, dict.getWordFrequency("abc"));
// Add existing word with higher frequency
- dict.addWord("abc", null, UNIGRAM_FREQ + 3);
+ dict.addWord("abc", null, UNIGRAM_FREQ + 3, 0);
assertEquals(UNIGRAM_FREQ + 3, dict.getWordFrequency("abc"));
}
}
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index cc2569f5e..6bc8b9dd5 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -179,10 +179,17 @@ public class InputLogicTests extends InputTestsBase {
}
public void testDoubleSpace() {
- final String STRING_TO_TYPE = "this ";
- final String EXPECTED_RESULT = "this. ";
- type(STRING_TO_TYPE);
- assertEquals("double space make a period", EXPECTED_RESULT, mEditText.getText().toString());
+ // U+1F607 is an emoji
+ final String[] STRINGS_TO_TYPE =
+ new String[] { "this ", "a+ ", "\u1F607 ", ".. ", ") ", "( ", "% " };
+ final String[] EXPECTED_RESULTS =
+ new String[] { "this. ", "a+. ", "\u1F607. ", ".. ", "). ", "( ", "% " };
+ for (int i = 0; i < STRINGS_TO_TYPE.length; ++i) {
+ mEditText.setText("");
+ type(STRINGS_TO_TYPE[i]);
+ assertEquals("double space processing", EXPECTED_RESULTS[i],
+ mEditText.getText().toString());
+ }
}
public void testCancelDoubleSpace() {
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
index 234bb1b31..b9b52a6f3 100644
--- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java
+++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
@@ -238,12 +238,16 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
}
protected void changeLanguage(final String locale) {
+ changeLanguageWithoutWait(locale);
+ waitForDictionaryToBeLoaded();
+ }
+
+ protected void changeLanguageWithoutWait(final String locale) {
mEditText.mCurrentLocale = LocaleUtils.constructLocaleFromString(locale);
SubtypeSwitcher.getInstance().forceLocale(mEditText.mCurrentLocale);
mLatinIME.loadKeyboard();
runMessages();
mKeyboard = mLatinIME.mKeyboardSwitcher.getKeyboard();
- waitForDictionaryToBeLoaded();
}
protected void changeKeyboardLocaleAndDictLocale(final String keyboardLocale,
diff --git a/tests/src/com/android/inputmethod/latin/LatinImeStressTests.java b/tests/src/com/android/inputmethod/latin/LatinImeStressTests.java
new file mode 100644
index 000000000..5e98cdf8d
--- /dev/null
+++ b/tests/src/com/android/inputmethod/latin/LatinImeStressTests.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 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.test.suitebuilder.annotation.LargeTest;
+
+import com.android.inputmethod.latin.makedict.CodePointUtils;
+
+import java.util.Random;
+
+@LargeTest
+public class LatinImeStressTests extends InputTestsBase {
+ public void testSwitchLanguagesAndInputLatinRandomCodePoints() {
+ final String[] locales = {"en_US", "de", "el", "es", "fi", "it", "nl", "pt", "ru"};
+ final int switchCount = 50;
+ final int maxWordCountToTypeInEachIteration = 20;
+ final long seed = System.currentTimeMillis();
+ final Random random = new Random(seed);
+ final int codePointSetSize = 30;
+ final int[] codePointSet = CodePointUtils.LATIN_ALPHABETS_LOWER;
+ for (int i = 0; i < switchCount; ++i) {
+ changeLanguageWithoutWait(locales[random.nextInt(locales.length)]);
+ final int wordCount = random.nextInt(maxWordCountToTypeInEachIteration);
+ for (int j = 0; j < wordCount; ++j) {
+ final String word = CodePointUtils.generateWord(random, codePointSet);
+ type(word);
+ }
+ }
+ }
+ public void testSwitchLanguagesAndInputRandamCodePoints() {
+ final String[] locales = {"en_US", "de", "el", "es", "fi", "it", "nl", "pt", "ru"};
+ final int switchCount = 50;
+ final int maxWordCountToTypeInEachIteration = 20;
+ final long seed = System.currentTimeMillis();
+ final Random random = new Random(seed);
+ final int codePointSetSize = 30;
+ final int[] codePointSet = CodePointUtils.generateCodePointSet(codePointSetSize, random);
+ for (int i = 0; i < switchCount; ++i) {
+ changeLanguageWithoutWait(locales[random.nextInt(locales.length)]);
+ final int wordCount = random.nextInt(maxWordCountToTypeInEachIteration);
+ for (int j = 0; j < wordCount; ++j) {
+ final String word = CodePointUtils.generateWord(random, codePointSet);
+ type(word);
+ }
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/latin/makedict/CodePointUtils.java b/tests/src/com/android/inputmethod/latin/makedict/CodePointUtils.java
index 36b958af8..a270ee774 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/CodePointUtils.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/CodePointUtils.java
@@ -24,6 +24,42 @@ public class CodePointUtils {
// This utility class is not publicly instantiable.
}
+ public static final int[] LATIN_ALPHABETS_LOWER = {
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ 0x00E0 /* LATIN SMALL LETTER A WITH GRAVE */,
+ 0x00E1 /* LATIN SMALL LETTER A WITH ACUTE */,
+ 0x00E2 /* LATIN SMALL LETTER A WITH CIRCUMFLEX */,
+ 0x00E3 /* LATIN SMALL LETTER A WITH TILDE */,
+ 0x00E4 /* LATIN SMALL LETTER A WITH DIAERESIS */,
+ 0x00E5 /* LATIN SMALL LETTER A WITH RING ABOVE */,
+ 0x00E6 /* LATIN SMALL LETTER AE */,
+ 0x00E7 /* LATIN SMALL LETTER C WITH CEDILLA */,
+ 0x00E8 /* LATIN SMALL LETTER E WITH GRAVE */,
+ 0x00E9 /* LATIN SMALL LETTER E WITH ACUTE */,
+ 0x00EA /* LATIN SMALL LETTER E WITH CIRCUMFLEX */,
+ 0x00EB /* LATIN SMALL LETTER E WITH DIAERESIS */,
+ 0x00EC /* LATIN SMALL LETTER I WITH GRAVE */,
+ 0x00ED /* LATIN SMALL LETTER I WITH ACUTE */,
+ 0x00EE /* LATIN SMALL LETTER I WITH CIRCUMFLEX */,
+ 0x00EF /* LATIN SMALL LETTER I WITH DIAERESIS */,
+ 0x00F0 /* LATIN SMALL LETTER ETH */,
+ 0x00F1 /* LATIN SMALL LETTER N WITH TILDE */,
+ 0x00F2 /* LATIN SMALL LETTER O WITH GRAVE */,
+ 0x00F3 /* LATIN SMALL LETTER O WITH ACUTE */,
+ 0x00F4 /* LATIN SMALL LETTER O WITH CIRCUMFLEX */,
+ 0x00F5 /* LATIN SMALL LETTER O WITH TILDE */,
+ 0x00F6 /* LATIN SMALL LETTER O WITH DIAERESIS */,
+ 0x00F7 /* LATIN SMALL LETTER O WITH STROKE */,
+ 0x00F9 /* LATIN SMALL LETTER U WITH GRAVE */,
+ 0x00FA /* LATIN SMALL LETTER U WITH ACUTE */,
+ 0x00FB /* LATIN SMALL LETTER U WITH CIRCUMFLEX */,
+ 0x00FC /* LATIN SMALL LETTER U WITH DIAERESIS */,
+ 0x00FD /* LATIN SMALL LETTER Y WITH ACUTE */,
+ 0x00FE /* LATIN SMALL LETTER THORN */,
+ 0x00FF /* LATIN SMALL LETTER Y WITH DIAERESIS */
+ };
+
public static int[] generateCodePointSet(final int codePointSetSize, final Random random) {
final int[] codePointSet = new int[codePointSetSize];
for (int i = codePointSet.length - 1; i >= 0; ) {
diff --git a/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
index cf3bdd680..1fd5c989a 100644
--- a/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.latin.utils;
+import com.android.inputmethod.latin.settings.SettingsValues;
+
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.TextUtils;
@@ -25,64 +27,64 @@ import java.util.Locale;
@SmallTest
public class CapsModeUtilsTests extends AndroidTestCase {
private static void onePathForCaps(final CharSequence cs, final int expectedResult,
- final int mask, final Locale l, final boolean hasSpaceBefore) {
+ final int mask, final SettingsValues sv, final boolean hasSpaceBefore) {
int oneTimeResult = expectedResult & mask;
assertEquals("After >" + cs + "<", oneTimeResult,
- CapsModeUtils.getCapsMode(cs, mask, l, hasSpaceBefore));
+ CapsModeUtils.getCapsMode(cs, mask, sv, hasSpaceBefore));
}
private static void allPathsForCaps(final CharSequence cs, final int expectedResult,
- final Locale l, final boolean hasSpaceBefore) {
+ final SettingsValues sv, final boolean hasSpaceBefore) {
final int c = TextUtils.CAP_MODE_CHARACTERS;
final int w = TextUtils.CAP_MODE_WORDS;
final int s = TextUtils.CAP_MODE_SENTENCES;
- onePathForCaps(cs, expectedResult, c | w | s, l, hasSpaceBefore);
- onePathForCaps(cs, expectedResult, w | s, l, hasSpaceBefore);
- onePathForCaps(cs, expectedResult, c | s, l, hasSpaceBefore);
- onePathForCaps(cs, expectedResult, c | w, l, hasSpaceBefore);
- onePathForCaps(cs, expectedResult, c, l, hasSpaceBefore);
- onePathForCaps(cs, expectedResult, w, l, hasSpaceBefore);
- onePathForCaps(cs, expectedResult, s, l, hasSpaceBefore);
+ onePathForCaps(cs, expectedResult, c | w | s, sv, hasSpaceBefore);
+ onePathForCaps(cs, expectedResult, w | s, sv, hasSpaceBefore);
+ onePathForCaps(cs, expectedResult, c | s, sv, hasSpaceBefore);
+ onePathForCaps(cs, expectedResult, c | w, sv, hasSpaceBefore);
+ onePathForCaps(cs, expectedResult, c, sv, hasSpaceBefore);
+ onePathForCaps(cs, expectedResult, w, sv, hasSpaceBefore);
+ onePathForCaps(cs, expectedResult, s, sv, hasSpaceBefore);
}
public void testGetCapsMode() {
final int c = TextUtils.CAP_MODE_CHARACTERS;
final int w = TextUtils.CAP_MODE_WORDS;
final int s = TextUtils.CAP_MODE_SENTENCES;
- Locale l = Locale.ENGLISH;
- allPathsForCaps("", c | w | s, l, false);
- allPathsForCaps("Word", c, l, false);
- allPathsForCaps("Word.", c, l, false);
- allPathsForCaps("Word ", c | w, l, false);
- allPathsForCaps("Word. ", c | w | s, l, false);
- allPathsForCaps("Word..", c, l, false);
- allPathsForCaps("Word.. ", c | w | s, l, false);
- allPathsForCaps("Word... ", c | w | s, l, false);
- allPathsForCaps("Word ... ", c | w | s, l, false);
- allPathsForCaps("Word . ", c | w, l, false);
- allPathsForCaps("In the U.S ", c | w, l, false);
- allPathsForCaps("In the U.S. ", c | w, l, false);
- allPathsForCaps("Some stuff (e.g. ", c | w, l, false);
- allPathsForCaps("In the U.S.. ", c | w | s, l, false);
- allPathsForCaps("\"Word.\" ", c | w | s, l, false);
- allPathsForCaps("\"Word\". ", c | w | s, l, false);
- allPathsForCaps("\"Word\" ", c | w, l, false);
+ SettingsValues sv = SettingsValues.makeDummySettingsValuesForTest(Locale.ENGLISH);
+ allPathsForCaps("", c | w | s, sv, false);
+ allPathsForCaps("Word", c, sv, false);
+ allPathsForCaps("Word.", c, sv, false);
+ allPathsForCaps("Word ", c | w, sv, false);
+ allPathsForCaps("Word. ", c | w | s, sv, false);
+ allPathsForCaps("Word..", c, sv, false);
+ allPathsForCaps("Word.. ", c | w | s, sv, false);
+ allPathsForCaps("Word... ", c | w | s, sv, false);
+ allPathsForCaps("Word ... ", c | w | s, sv, false);
+ allPathsForCaps("Word . ", c | w, sv, false);
+ allPathsForCaps("In the U.S ", c | w, sv, false);
+ allPathsForCaps("In the U.S. ", c | w, sv, false);
+ allPathsForCaps("Some stuff (e.g. ", c | w, sv, false);
+ allPathsForCaps("In the U.S.. ", c | w | s, sv, false);
+ allPathsForCaps("\"Word.\" ", c | w | s, sv, false);
+ allPathsForCaps("\"Word\". ", c | w | s, sv, false);
+ allPathsForCaps("\"Word\" ", c | w, sv, false);
// Test for phantom space
- allPathsForCaps("Word", c | w, l, true);
- allPathsForCaps("Word.", c | w | s, l, true);
+ allPathsForCaps("Word", c | w, sv, true);
+ allPathsForCaps("Word.", c | w | s, sv, true);
// Tests after some whitespace
- allPathsForCaps("Word\n", c | w | s, l, false);
- allPathsForCaps("Word\n", c | w | s, l, true);
- allPathsForCaps("Word\n ", c | w | s, l, true);
- allPathsForCaps("Word.\n", c | w | s, l, false);
- allPathsForCaps("Word.\n", c | w | s, l, true);
- allPathsForCaps("Word.\n ", c | w | s, l, true);
+ allPathsForCaps("Word\n", c | w | s, sv, false);
+ allPathsForCaps("Word\n", c | w | s, sv, true);
+ allPathsForCaps("Word\n ", c | w | s, sv, true);
+ allPathsForCaps("Word.\n", c | w | s, sv, false);
+ allPathsForCaps("Word.\n", c | w | s, sv, true);
+ allPathsForCaps("Word.\n ", c | w | s, sv, true);
- l = Locale.FRENCH;
- allPathsForCaps("\"Word.\" ", c | w, l, false);
- allPathsForCaps("\"Word\". ", c | w | s, l, false);
- allPathsForCaps("\"Word\" ", c | w, l, false);
+ sv = SettingsValues.makeDummySettingsValuesForTest(Locale.FRENCH);
+ allPathsForCaps("\"Word.\" ", c | w, sv, false);
+ allPathsForCaps("\"Word\". ", c | w | s, sv, false);
+ allPathsForCaps("\"Word\" ", c | w, sv, false);
}
}
diff --git a/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java
index 3eabe2b3c..1944fd332 100644
--- a/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java
@@ -196,8 +196,8 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase
final UserHistoryDictionaryBigramList resultList = new UserHistoryDictionaryBigramList();
final OnAddWordListener listener = new OnAddWordListener() {
@Override
- public void setUnigram(final String word,
- final String shortcutTarget, final int frequency) {
+ public void setUnigram(final String word, final String shortcutTarget,
+ final int frequency, final int shortcutFreq) {
Log.d(TAG, "in: setUnigram: " + word + "," + frequency);
resultList.addBigram(null, word, (byte)frequency);
}
@@ -220,8 +220,8 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase
final UserHistoryDictionaryBigramList resultList2 = new UserHistoryDictionaryBigramList();
final OnAddWordListener listener2 = new OnAddWordListener() {
@Override
- public void setUnigram(final String word,
- final String shortcutTarget, final int frequency) {
+ public void setUnigram(final String word, final String shortcutTarget,
+ final int frequency, final int shortcutFreq) {
Log.d(TAG, "in: setUnigram: " + word + "," + frequency);
resultList2.addBigram(null, word, (byte)frequency);
}