aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java2
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java26
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Khmer.java26
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Lao.java26
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java33
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java26
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java7
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Symbols.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java4
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/Thai.java26
-rw-r--r--tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java9
-rw-r--r--tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java6
-rw-r--r--tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java38
13 files changed, 91 insertions, 142 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
index 45e1558a8..c20954f81 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java
@@ -16,11 +16,11 @@
package com.android.inputmethod.keyboard;
+import static com.android.inputmethod.compat.BuildCompatUtils.VERSION_CODES_LXX;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_ICS;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_KLP;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_DARK;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_LIGHT;
-import static com.android.inputmethod.keyboard.KeyboardTheme.VERSION_CODES_LXX;
import android.content.SharedPreferences;
import android.os.Build.VERSION_CODES;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java b/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
index 42ce0c1ea..dba91b4da 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
@@ -39,6 +39,9 @@ public final class ArmenianPhonetic extends LayoutBase {
public ArmenianPhoneticCustomizer(final Locale locale) { super(locale); }
@Override
+ public int getNumberOfRows() { return 5; }
+
+ @Override
public ExpectedKey getAlphabetKey() { return ARMENIAN_ALPHABET_KEY; }
@Override
@@ -112,29 +115,6 @@ public final class ArmenianPhonetic extends LayoutBase {
return builder.build();
}
- // Helper method to create alphabet layout by adding special function keys.
- @Override
- ExpectedKeyboardBuilder convertCommonLayoutToKeyboard(final ExpectedKeyboardBuilder builder,
- final boolean isPhone) {
- final LayoutCustomizer customizer = getCustomizer();
- builder.setKeysOfRow(5, (Object[])customizer.getSpaceKeys(isPhone));
- builder.addKeysOnTheLeftOfRow(5, (Object[])customizer.getKeysLeftToSpacebar(isPhone));
- builder.addKeysOnTheRightOfRow(5, (Object[])customizer.getKeysRightToSpacebar(isPhone));
- if (isPhone) {
- builder.addKeysOnTheRightOfRow(4, DELETE_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, key(ENTER_KEY, EMOJI_KEY));
- } else {
- builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(3, ENTER_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, EMOJI_KEY);
- }
- builder.addKeysOnTheLeftOfRow(4, (Object[])customizer.getLeftShiftKeys(isPhone))
- .addKeysOnTheRightOfRow(4, (Object[])customizer.getRightShiftKeys(isPhone));
- return builder;
- }
-
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+0567: "է" ARMENIAN SMALL LETTER EH
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java b/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java
index 143ccf6eb..7e4f159ab 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java
@@ -40,6 +40,9 @@ public final class Khmer extends LayoutBase {
public KhmerCustomizer(final Locale locale) { super(locale); }
@Override
+ public int getNumberOfRows() { return 5; }
+
+ @Override
public ExpectedKey getAlphabetKey() { return KHMER_ALPHABET_KEY; }
@Override
@@ -79,29 +82,6 @@ public final class Khmer extends LayoutBase {
return ALPHABET_SHIFTED_COMMON;
}
- // Helper method to create alphabet layout by adding special function keys.
- @Override
- ExpectedKeyboardBuilder convertCommonLayoutToKeyboard(final ExpectedKeyboardBuilder builder,
- final boolean isPhone) {
- final LayoutCustomizer customizer = getCustomizer();
- builder.setKeysOfRow(5, (Object[])customizer.getSpaceKeys(isPhone));
- builder.addKeysOnTheLeftOfRow(5, (Object[])customizer.getKeysLeftToSpacebar(isPhone));
- builder.addKeysOnTheRightOfRow(5, (Object[])customizer.getKeysRightToSpacebar(isPhone));
- if (isPhone) {
- builder.addKeysOnTheRightOfRow(4, DELETE_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, key(ENTER_KEY, EMOJI_KEY));
- } else {
- builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(3, ENTER_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, EMOJI_KEY);
- }
- builder.addKeysOnTheLeftOfRow(4, (Object[])customizer.getLeftShiftKeys(isPhone))
- .addKeysOnTheRightOfRow(4, (Object[])customizer.getRightShiftKeys(isPhone));
- return builder;
- }
-
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+17E1: "១" KHMER DIGIT ONE
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Lao.java b/tests/src/com/android/inputmethod/keyboard/layout/Lao.java
index e7be9982a..aaa1c8a8a 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Lao.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Lao.java
@@ -40,6 +40,9 @@ public final class Lao extends LayoutBase {
public LaoCustomizer(final Locale locale) { super(locale); }
@Override
+ public int getNumberOfRows() { return 5; }
+
+ @Override
public ExpectedKey getAlphabetKey() { return LAO_ALPHABET_KEY; }
@Override
@@ -83,29 +86,6 @@ public final class Lao extends LayoutBase {
return ALPHABET_SHIFTED_COMMON;
}
- // Helper method to create alphabet layout by adding special function keys.
- @Override
- ExpectedKeyboardBuilder convertCommonLayoutToKeyboard(final ExpectedKeyboardBuilder builder,
- final boolean isPhone) {
- final LayoutCustomizer customizer = getCustomizer();
- builder.setKeysOfRow(5, (Object[])customizer.getSpaceKeys(isPhone));
- builder.addKeysOnTheLeftOfRow(5, (Object[])customizer.getKeysLeftToSpacebar(isPhone));
- builder.addKeysOnTheRightOfRow(5, (Object[])customizer.getKeysRightToSpacebar(isPhone));
- if (isPhone) {
- builder.addKeysOnTheRightOfRow(4, DELETE_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, key(ENTER_KEY, EMOJI_KEY));
- } else {
- builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(3, ENTER_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, EMOJI_KEY);
- }
- builder.addKeysOnTheLeftOfRow(4, (Object[])customizer.getLeftShiftKeys(isPhone))
- .addKeysOnTheRightOfRow(4, (Object[])customizer.getRightShiftKeys(isPhone));
- return builder;
- }
-
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+0EA2: "ຢ" LAO LETTER YO
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
index c5223720c..0548a010d 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
@@ -46,6 +46,10 @@ public abstract class LayoutBase extends AbstractLayoutBase {
return mLocale;
}
+ public int getNumberOfRows() {
+ return 4;
+ }
+
/**
* Set accented letters to common layout.
* @param builder the {@link ExpectedKeyboardBuilder} object that contains common keyboard
@@ -277,7 +281,7 @@ public abstract class LayoutBase extends AbstractLayoutBase {
",", "'", "#", ")", "(", "/", ";",
"@", ":", "-", "\"", "+", "%", "&");
- /**
+ /**
* Helper method to create alphabet layout adding special function keys.
* @param builder the {@link ExpectedKeyboardBuilder} object that contains common keyboard
* layout
@@ -287,21 +291,26 @@ public abstract class LayoutBase extends AbstractLayoutBase {
ExpectedKeyboardBuilder convertCommonLayoutToKeyboard(final ExpectedKeyboardBuilder builder,
final boolean isPhone) {
final LayoutCustomizer customizer = getCustomizer();
- builder.setKeysOfRow(4, (Object[])customizer.getSpaceKeys(isPhone));
- builder.addKeysOnTheLeftOfRow(4, (Object[])customizer.getKeysLeftToSpacebar(isPhone));
- builder.addKeysOnTheRightOfRow(4, (Object[])customizer.getKeysRightToSpacebar(isPhone));
+ final int numberOfRows = customizer.getNumberOfRows();
+ builder.setKeysOfRow(numberOfRows, (Object[])customizer.getSpaceKeys(isPhone));
+ builder.addKeysOnTheLeftOfRow(
+ numberOfRows, (Object[])customizer.getKeysLeftToSpacebar(isPhone));
+ builder.addKeysOnTheRightOfRow(
+ numberOfRows, (Object[])customizer.getKeysRightToSpacebar(isPhone));
if (isPhone) {
- builder.addKeysOnTheRightOfRow(3, DELETE_KEY)
- .addKeysOnTheLeftOfRow(4, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_KEY));
+ builder.addKeysOnTheRightOfRow(numberOfRows - 1, DELETE_KEY)
+ .addKeysOnTheLeftOfRow(numberOfRows, customizer.getSymbolsKey())
+ .addKeysOnTheRightOfRow(numberOfRows, key(ENTER_KEY, EMOJI_ACTION_KEY));
} else {
builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(2, ENTER_KEY)
- .addKeysOnTheLeftOfRow(4, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(4, EMOJI_KEY);
+ .addKeysOnTheRightOfRow(numberOfRows - 2, ENTER_KEY)
+ .addKeysOnTheLeftOfRow(numberOfRows, customizer.getSymbolsKey())
+ .addKeysOnTheRightOfRow(numberOfRows, EMOJI_NORMAL_KEY);
}
- builder.addKeysOnTheLeftOfRow(3, (Object[])customizer.getLeftShiftKeys(isPhone))
- .addKeysOnTheRightOfRow(3, (Object[])customizer.getRightShiftKeys(isPhone));
+ builder.addKeysOnTheLeftOfRow(
+ numberOfRows - 1, (Object[])customizer.getLeftShiftKeys(isPhone));
+ builder.addKeysOnTheRightOfRow(
+ numberOfRows - 1, (Object[])customizer.getRightShiftKeys(isPhone));
return builder;
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java b/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
index f2a2dfdd8..15c74ed8c 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
@@ -40,6 +40,9 @@ public final class Myanmar extends LayoutBase {
public MyanmarCustomizer(final Locale locale) { super(locale); }
@Override
+ public int getNumberOfRows() { return 5; }
+
+ @Override
public ExpectedKey getAlphabetKey() { return MYANMAR_ALPHABET_KEY; }
@Override
@@ -97,29 +100,6 @@ public final class Myanmar extends LayoutBase {
return ALPHABET_SHIFTED_COMMON;
}
- // Helper method to create alphabet layout by adding special function keys.
- @Override
- ExpectedKeyboardBuilder convertCommonLayoutToKeyboard(final ExpectedKeyboardBuilder builder,
- final boolean isPhone) {
- final LayoutCustomizer customizer = getCustomizer();
- builder.setKeysOfRow(5, (Object[])customizer.getSpaceKeys(isPhone));
- builder.addKeysOnTheLeftOfRow(5, (Object[])customizer.getKeysLeftToSpacebar(isPhone));
- builder.addKeysOnTheRightOfRow(5, (Object[])customizer.getKeysRightToSpacebar(isPhone));
- if (isPhone) {
- builder.addKeysOnTheRightOfRow(4, DELETE_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, key(ENTER_KEY, EMOJI_KEY));
- } else {
- builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(3, ENTER_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, EMOJI_KEY);
- }
- builder.addKeysOnTheLeftOfRow(4, (Object[])customizer.getLeftShiftKeys(isPhone))
- .addKeysOnTheRightOfRow(4, (Object[])customizer.getRightShiftKeys(isPhone));
- return builder;
- }
-
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+1041: "၁" MYANMAR DIGIT ONE
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java b/tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java
index 9da6dcc44..3f7340fd0 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/PcQwerty.java
@@ -39,6 +39,9 @@ public final class PcQwerty extends LayoutBase {
public PcQwertyCustomizer(final Locale locale) { super(locale); }
@Override
+ public int getNumberOfRows() { return 5; }
+
+ @Override
public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
return joinKeys(SHIFT_KEY);
}
@@ -55,7 +58,9 @@ public final class PcQwerty extends LayoutBase {
@Override
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
- return isPhone ? joinKeys(key(ENTER_KEY, EMOJI_KEY)) : joinKeys(EMOJI_KEY);
+ return isPhone
+ ? joinKeys(key(ENTER_KEY, EMOJI_ACTION_KEY))
+ : joinKeys(EMOJI_NORMAL_KEY);
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java b/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
index 5f3e4b196..2cee2d909 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
@@ -43,7 +43,7 @@ public class Symbols extends AbstractLayoutBase {
builder.addKeysOnTheLeftOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheRightOfRow(3, DELETE_KEY)
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
- .addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_KEY));
+ .addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_ACTION_KEY));
} else {
// Tablet symbols keyboard has extra two keys at the left edge of the 3rd row.
builder.addKeysOnTheLeftOfRow(3, (Object[])joinKeys("\\", "="));
@@ -52,7 +52,7 @@ public class Symbols extends AbstractLayoutBase {
.addKeysOnTheLeftOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheRightOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
- .addKeysOnTheRightOfRow(4, EMOJI_KEY);
+ .addKeysOnTheRightOfRow(4, EMOJI_NORMAL_KEY);
}
return builder.build();
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java b/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
index 3265e10e1..7ed103ba0 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
@@ -39,7 +39,7 @@ public class SymbolsShifted extends AbstractLayoutBase {
builder.addKeysOnTheLeftOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheRightOfRow(3, DELETE_KEY)
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
- .addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_KEY));
+ .addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_ACTION_KEY));
} else {
// Tablet symbols shifted keyboard has extra two keys at the right edge of the 3rd row.
// U+00BF: "¿" INVERTED QUESTION MARK
@@ -50,7 +50,7 @@ public class SymbolsShifted extends AbstractLayoutBase {
.addKeysOnTheLeftOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheRightOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
- .addKeysOnTheRightOfRow(4, EMOJI_KEY);
+ .addKeysOnTheRightOfRow(4, EMOJI_NORMAL_KEY);
}
return builder.build();
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Thai.java b/tests/src/com/android/inputmethod/keyboard/layout/Thai.java
index af4abea93..cfda2947c 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Thai.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Thai.java
@@ -40,6 +40,9 @@ public final class Thai extends LayoutBase {
public ThaiCustomizer(final Locale locale) { super(locale); }
@Override
+ public int getNumberOfRows() { return 5; }
+
+ @Override
public ExpectedKey getAlphabetKey() { return THAI_ALPHABET_KEY; }
@Override
@@ -96,29 +99,6 @@ public final class Thai extends LayoutBase {
return builder.build();
}
- // Helper method to create alphabet layout by adding special function keys.
- @Override
- ExpectedKeyboardBuilder convertCommonLayoutToKeyboard(final ExpectedKeyboardBuilder builder,
- final boolean isPhone) {
- final LayoutCustomizer customizer = getCustomizer();
- builder.setKeysOfRow(5, (Object[])customizer.getSpaceKeys(isPhone));
- builder.addKeysOnTheLeftOfRow(5, (Object[])customizer.getKeysLeftToSpacebar(isPhone));
- builder.addKeysOnTheRightOfRow(5, (Object[])customizer.getKeysRightToSpacebar(isPhone));
- if (isPhone) {
- builder.addKeysOnTheRightOfRow(4, DELETE_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, key(ENTER_KEY, EMOJI_KEY));
- } else {
- builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(3, ENTER_KEY)
- .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(5, EMOJI_KEY);
- }
- builder.addKeysOnTheLeftOfRow(4, (Object[])customizer.getLeftShiftKeys(isPhone))
- .addKeysOnTheRightOfRow(4, (Object[])customizer.getRightShiftKeys(isPhone));
- return builder;
- }
-
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
// U+0E45: "ๅ" THAI CHARACTER LAKKHANGYAO
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
index 9e0039d84..0f7bef2a3 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
@@ -120,8 +120,10 @@ public abstract class AbstractLayoutBase {
KeyboardIconsSet.NAME_LANGUAGE_SWITCH_KEY);
private static final int ICON_ENTER = KeyboardIconsSet.getIconId(
KeyboardIconsSet.NAME_ENTER_KEY);
- private static final int ICON_EMOJI = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_EMOJI_KEY);
+ private static final int ICON_EMOJI_ACTION = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_EMOJI_ACTION_KEY);
+ private static final int ICON_EMOJI_NORMAL = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_EMOJI_NORMAL_KEY);
// Functional keys.
public static final ExpectedKey DELETE_KEY = key(ICON_DELETE, Constants.CODE_DELETE);
@@ -131,6 +133,7 @@ public abstract class AbstractLayoutBase {
public static final ExpectedKey LANGUAGE_SWITCH_KEY = key(
ICON_LANGUAGE_SWITCH, Constants.CODE_LANGUAGE_SWITCH);
public static final ExpectedKey ENTER_KEY = key(ICON_ENTER, Constants.CODE_ENTER);
- public static final ExpectedKey EMOJI_KEY = key(ICON_EMOJI, Constants.CODE_EMOJI);
+ public static final ExpectedKey EMOJI_ACTION_KEY = key(ICON_EMOJI_ACTION, Constants.CODE_EMOJI);
+ public static final ExpectedKey EMOJI_NORMAL_KEY = key(ICON_EMOJI_NORMAL, Constants.CODE_EMOJI);
public static final ExpectedKey SPACE_KEY = key(ICON_SPACE, Constants.CODE_SPACE);
}
diff --git a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
index 66b4a9c71..a5f20b565 100644
--- a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
+++ b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
@@ -48,7 +48,8 @@ public class SuggestedWordsTests extends AndroidTestCase {
false /* typedWordValid */,
false /* willAutoCorrect */,
false /* isObsoleteSuggestions */,
- false /* isPrediction*/);
+ false /* isPrediction*/,
+ SuggestedWords.INPUT_STYLE_NONE);
assertEquals(NUMBER_OF_ADDED_SUGGESTIONS + 1, words.size());
assertEquals("typed", words.getWord(0));
assertTrue(words.getInfo(0).isKindOf(SuggestedWordInfo.KIND_TYPED));
@@ -57,7 +58,8 @@ public class SuggestedWordsTests extends AndroidTestCase {
assertEquals("4", words.getWord(5));
assertTrue(words.getInfo(5).isKindOf(SuggestedWordInfo.KIND_CORRECTION));
- final SuggestedWords wordsWithoutTyped = words.getSuggestedWordsExcludingTypedWord();
+ final SuggestedWords wordsWithoutTyped = words.getSuggestedWordsExcludingTypedWord(
+ SuggestedWords.INPUT_STYLE_NONE);
assertEquals(words.size() - 1, wordsWithoutTyped.size());
assertEquals("0", wordsWithoutTyped.getWord(0));
assertTrue(wordsWithoutTyped.getInfo(0).isKindOf(SuggestedWordInfo.KIND_CORRECTION));
diff --git a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
index 8755e573c..14c9da08a 100644
--- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
+++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java
@@ -28,6 +28,7 @@ import com.android.inputmethod.latin.utils.DistracterFilter;
import com.android.inputmethod.latin.utils.FileUtils;
import java.io.File;
+import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -42,6 +43,7 @@ import java.util.concurrent.TimeUnit;
public class UserHistoryDictionaryTests extends AndroidTestCase {
private static final String TAG = UserHistoryDictionaryTests.class.getSimpleName();
private static final int WAIT_FOR_WRITING_FILE_IN_MILLISECONDS = 3000;
+ private static final String TEST_LOCALE_PREFIX = "test_";
private static final String[] CHARACTERS = {
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
@@ -50,14 +52,38 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
private int mCurrentTime = 0;
+ private void removeAllTestDictFiles() {
+ final Locale dummyLocale = new Locale(TEST_LOCALE_PREFIX);
+ final String dictName = ExpandableBinaryDictionary.getDictName(
+ UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */);
+ final File dictFile = ExpandableBinaryDictionary.getDictFile(
+ mContext, dictName, null /* dictFile */);
+ final FilenameFilter filenameFilter = new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String filename) {
+ return filename.startsWith(UserHistoryDictionary.NAME + "." + TEST_LOCALE_PREFIX);
+ }
+ };
+ FileUtils.deleteFilteredFiles(dictFile.getParentFile(), filenameFilter);
+ }
+
+ private void printAllFiles(final File dir) {
+ Log.d(TAG, dir.getAbsolutePath());
+ for (final File file : dir.listFiles()) {
+ Log.d(TAG, " " + file.getName());
+ }
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();
resetCurrentTimeForTestMode();
+ removeAllTestDictFiles();
}
@Override
protected void tearDown() throws Exception {
+ removeAllTestDictFiles();
stopTestModeInNativeCode();
super.tearDown();
}
@@ -169,7 +195,8 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
public void testRandomWords() {
Log.d(TAG, "This test can be used for profiling.");
Log.d(TAG, "Usage: please set UserHistoryDictionary.PROFILE_SAVE_RESTORE to true.");
- final Locale dummyLocale = new Locale("test_random_words" + System.currentTimeMillis());
+ final Locale dummyLocale =
+ new Locale(TEST_LOCALE_PREFIX + "random_words" + System.currentTimeMillis());
final String dictName = ExpandableBinaryDictionary.getDictName(
UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */);
final File dictFile = ExpandableBinaryDictionary.getDictFile(
@@ -202,7 +229,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
// Create filename suffixes for this test.
for (int i = 0; i < numberOfLanguages; i++) {
- dummyLocales[i] = new Locale("test_switching_languages" + i);
+ dummyLocales[i] = new Locale(TEST_LOCALE_PREFIX + "switching_languages" + i);
final String dictName = ExpandableBinaryDictionary.getDictName(
UserHistoryDictionary.NAME, dummyLocales[i], null /* dictFile */);
dictFiles[i] = ExpandableBinaryDictionary.getDictFile(
@@ -236,7 +263,8 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
}
public void testAddManyWords() {
- final Locale dummyLocale = new Locale("test_random_words" + System.currentTimeMillis());
+ final Locale dummyLocale =
+ new Locale(TEST_LOCALE_PREFIX + "random_words" + System.currentTimeMillis());
final String dictName = ExpandableBinaryDictionary.getDictName(
UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */);
final File dictFile = ExpandableBinaryDictionary.getDictFile(
@@ -253,6 +281,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
try {
Log.d(TAG, dictFile +" is not existing. Wait "
+ WAIT_FOR_WRITING_FILE_IN_MILLISECONDS + " ms for writing.");
+ printAllFiles(dictFile.getParentFile());
Thread.sleep(WAIT_FOR_WRITING_FILE_IN_MILLISECONDS);
} catch (final InterruptedException e) {
Log.e(TAG, "Interrupted during waiting for writing the dict file.");
@@ -264,7 +293,8 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
}
public void testDecaying() {
- final Locale dummyLocale = new Locale("test_decaying" + System.currentTimeMillis());
+ final Locale dummyLocale =
+ new Locale(TEST_LOCALE_PREFIX + "decaying" + System.currentTimeMillis());
final int numberOfWords = 5000;
final Random random = new Random(123456);
resetCurrentTimeForTestMode();