aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/AndroidManifest.xml4
-rw-r--r--java/src/com/android/inputmethod/keyboard/MainKeyboardView.java6
-rw-r--r--java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java11
-rw-r--r--java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java3
-rw-r--r--java/src/com/android/inputmethod/latin/settings/CustomInputStyleSettingsFragment.java18
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java4
-rw-r--r--java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java6
-rw-r--r--tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelLxxTests.java82
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/ActionTestsBase.java (renamed from tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelBase.java)54
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionCustomTests.java37
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionDoneTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionGoTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionLabelTests.java (renamed from tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelKlpTests.java)86
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionNextTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionNoneTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionPreviousTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionSearchTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionSendTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionTestsBase.java55
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/KlpActionUnspecifiedTests.java37
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionCustomTests.java37
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionDoneTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionGoTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionNextTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionNoneTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionPreviousTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionSearchTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionSendTests.java36
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionTestsBase.java26
-rw-r--r--tests/src/com/android/inputmethod/keyboard/action/LxxActionUnspecifiedTests.java37
-rw-r--r--tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java15
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java36
32 files changed, 821 insertions, 237 deletions
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index 2249be7f4..25fa0f9e3 100644
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -25,10 +25,14 @@
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
+ <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
+ <uses-permission android:name="android.permission.READ_SYNC_STATS" />
<uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
<application android:label="@string/english_ime_name"
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 2ed4ea98e..cded2cb8c 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -755,7 +755,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
public void onHideWindow() {
onDismissMoreKeysPanel();
final MainKeyboardAccessibilityDelegate accessibilityDelegate = mAccessibilityDelegate;
- if (accessibilityDelegate != null) {
+ if (accessibilityDelegate != null
+ && AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
accessibilityDelegate.onHideWindow();
}
}
@@ -766,7 +767,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
@Override
public boolean onHoverEvent(final MotionEvent event) {
final MainKeyboardAccessibilityDelegate accessibilityDelegate = mAccessibilityDelegate;
- if (accessibilityDelegate != null) {
+ if (accessibilityDelegate != null
+ && AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
return accessibilityDelegate.onHoverEvent(event);
}
return super.onHoverEvent(event);
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
index a9d1239ed..841283b7f 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
@@ -105,7 +105,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
super.setKeyboard(keyboard);
mKeyDetector.setKeyboard(
keyboard, -getPaddingLeft(), -getPaddingTop() + getVerticalCorrection());
- if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
+ if (AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
if (mAccessibilityDelegate == null) {
mAccessibilityDelegate = new MoreKeysKeyboardAccessibilityDelegate(
this, mKeyDetector);
@@ -142,7 +142,8 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
mOriginY = y + container.getPaddingTop();
controller.onShowMoreKeysPanel(this);
final MoreKeysKeyboardAccessibilityDelegate accessibilityDelegate = mAccessibilityDelegate;
- if (accessibilityDelegate != null) {
+ if (accessibilityDelegate != null
+ && AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
accessibilityDelegate.onShowMoreKeysKeyboard();
}
}
@@ -239,7 +240,8 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
return;
}
final MoreKeysKeyboardAccessibilityDelegate accessibilityDelegate = mAccessibilityDelegate;
- if (accessibilityDelegate != null) {
+ if (accessibilityDelegate != null
+ && AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
accessibilityDelegate.onDismissMoreKeysKeyboard();
}
mController.onDismissMoreKeysPanel();
@@ -285,7 +287,8 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
@Override
public boolean onHoverEvent(final MotionEvent event) {
final MoreKeysKeyboardAccessibilityDelegate accessibilityDelegate = mAccessibilityDelegate;
- if (accessibilityDelegate != null) {
+ if (accessibilityDelegate != null
+ && AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
return accessibilityDelegate.onHoverEvent(event);
}
return super.onHoverEvent(event);
diff --git a/java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java b/java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java
index 17dfc9cce..925ec6bfb 100644
--- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java
@@ -104,7 +104,8 @@ final class EmojiPageKeyboardView extends KeyboardView implements
public boolean onHoverEvent(final MotionEvent event) {
final KeyboardAccessibilityDelegate<EmojiPageKeyboardView> accessibilityDelegate =
mAccessibilityDelegate;
- if (accessibilityDelegate != null) {
+ if (accessibilityDelegate != null
+ && AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
return accessibilityDelegate.onHoverEvent(event);
}
return super.onHoverEvent(event);
diff --git a/java/src/com/android/inputmethod/latin/settings/CustomInputStyleSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/CustomInputStyleSettingsFragment.java
index 9bc398654..2174f5224 100644
--- a/java/src/com/android/inputmethod/latin/settings/CustomInputStyleSettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/CustomInputStyleSettingsFragment.java
@@ -32,6 +32,7 @@ import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
import android.support.v4.view.ViewCompat;
import android.text.TextUtils;
+import android.util.Log;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -59,6 +60,12 @@ import java.util.ArrayList;
import java.util.TreeSet;
public final class CustomInputStyleSettingsFragment extends PreferenceFragment {
+ private static final String TAG = CustomInputStyleSettingsFragment.class.getSimpleName();
+ private static final boolean DEBUG_SUBTYPE_ID = false;
+ // Note: We would like to turn this debug flag true in order to see what input styles are
+ // defined in a bug-report.
+ private static final boolean DEBUG_CUSTOM_INPUT_STYLES = true;
+
private RichInputMethodManager mRichImm;
private SharedPreferences mPrefs;
private SubtypeLocaleAdapter mSubtypeLocaleAdapter;
@@ -96,8 +103,7 @@ public final class CustomInputStyleSettingsFragment extends PreferenceFragment {
}
static final class SubtypeLocaleAdapter extends ArrayAdapter<SubtypeLocaleItem> {
- private static final String TAG = SubtypeLocaleAdapter.class.getSimpleName();
- private static final boolean DEBUG_SUBTYPE_ID = false;
+ private static final String TAG_SUBTYPE = SubtypeLocaleAdapter.class.getSimpleName();
public SubtypeLocaleAdapter(final Context context) {
super(context, android.R.layout.simple_spinner_item);
@@ -110,7 +116,7 @@ public final class CustomInputStyleSettingsFragment extends PreferenceFragment {
for (int i = 0; i < count; i++) {
final InputMethodSubtype subtype = imi.getSubtypeAt(i);
if (DEBUG_SUBTYPE_ID) {
- android.util.Log.d(TAG, String.format("%-6s 0x%08x %11d %s",
+ Log.d(TAG_SUBTYPE, String.format("%-6s 0x%08x %11d %s",
subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)));
}
@@ -445,6 +451,9 @@ public final class CustomInputStyleSettingsFragment extends PreferenceFragment {
final String prefSubtypes =
Settings.readPrefAdditionalSubtypes(mPrefs, getResources());
+ if (DEBUG_CUSTOM_INPUT_STYLES) {
+ Log.i(TAG, "Load custom input styles: " + prefSubtypes);
+ }
setPrefSubtypes(prefSubtypes, context);
mIsAddingNewSubtype = (savedInstanceState != null)
@@ -611,6 +620,9 @@ public final class CustomInputStyleSettingsFragment extends PreferenceFragment {
final String oldSubtypes = Settings.readPrefAdditionalSubtypes(mPrefs, getResources());
final InputMethodSubtype[] subtypes = getSubtypes();
final String prefSubtypes = AdditionalSubtypeUtils.createPrefSubtypes(subtypes);
+ if (DEBUG_CUSTOM_INPUT_STYLES) {
+ Log.i(TAG, "Save custom input styles: " + prefSubtypes);
+ }
if (prefSubtypes.equals(oldSubtypes)) {
return;
}
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index 43f6175ca..b421a7eb5 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -418,8 +418,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
// Decided to be in the sliding suggestion mode only when the touch point has been moved
// upward. Further {@link MotionEvent}s will be delivered to
// {@link #onTouchEvent(MotionEvent)}.
- mNeedsToTransformTouchEventToHoverEvent = AccessibilityUtils.getInstance()
- .isTouchExplorationEnabled();
+ mNeedsToTransformTouchEventToHoverEvent =
+ AccessibilityUtils.getInstance().isTouchExplorationEnabled();
mIsDispatchingHoverEventToMoreSuggestions = false;
return true;
}
diff --git a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
index ea406fa75..142548b25 100644
--- a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
@@ -53,7 +53,8 @@ public final class ImportantNoticeUtils {
// This utility class is not publicly instantiable.
}
- private static boolean isInSystemSetupWizard(final Context context) {
+ @UsedForTesting
+ static boolean isInSystemSetupWizard(final Context context) {
try {
final int userSetupComplete = Settings.Secure.getInt(
context.getContentResolver(), Settings_Secure_USER_SETUP_COMPLETE);
@@ -84,7 +85,8 @@ public final class ImportantNoticeUtils {
return getLastImportantNoticeVersion(context) + 1;
}
- private static boolean hasNewImportantNotice(final Context context) {
+ @UsedForTesting
+ static boolean hasNewImportantNotice(final Context context) {
final int lastVersion = getLastImportantNoticeVersion(context);
return getCurrentImportantNoticeVersion(context) > lastVersion;
}
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelLxxTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelLxxTests.java
deleted file mode 100644
index fec501db1..000000000
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelLxxTests.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2014 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.keyboard;
-
-import android.test.suitebuilder.annotation.MediumTest;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodSubtype;
-
-import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
-import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
-
-@MediumTest
-public class KeyboardLayoutSetActionLabelLxxTests extends KeyboardLayoutSetActionLabelBase {
- @Override
- protected int getKeyboardThemeForTests() {
- return KeyboardTheme.THEME_ID_LXX_LIGHT;
- }
-
- @Override
- public void testActionGo() {
- final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
- KeyboardIconsSet.NAME_GO_KEY);
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "go " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_GO, expectedKey);
- }
- }
-
- @Override
- public void testActionSend() {
- final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
- KeyboardIconsSet.NAME_SEND_KEY);
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "send " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_SEND, expectedKey);
- }
- }
-
- @Override
- public void testActionNext() {
- final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
- KeyboardIconsSet.NAME_NEXT_KEY);
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "next " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_NEXT, expectedKey);
- }
- }
-
- @Override
- public void testActionDone() {
- final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
- KeyboardIconsSet.NAME_DONE_KEY);
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "done " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_DONE, expectedKey);
- }
- }
-
- @Override
- public void testActionPrevious() {
- final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
- KeyboardIconsSet.NAME_PREVIOUS_KEY);
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "previous " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_PREVIOUS, expectedKey);
- }
- }
-}
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelBase.java b/tests/src/com/android/inputmethod/keyboard/action/ActionTestsBase.java
index 22c22a00a..41b545aa8 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/action/ActionTestsBase.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard;
+package com.android.inputmethod.keyboard.action;
import android.content.Context;
import android.content.res.Resources;
@@ -22,6 +22,11 @@ import android.text.InputType;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.inputmethod.keyboard.Key;
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
+import com.android.inputmethod.keyboard.KeyboardLayoutSetTestsBase;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyVisual;
import com.android.inputmethod.latin.Constants;
@@ -31,7 +36,7 @@ import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
import java.util.Locale;
-abstract class KeyboardLayoutSetActionLabelBase extends KeyboardLayoutSetTestsBase {
+abstract class ActionTestsBase extends KeyboardLayoutSetTestsBase {
static class ExpectedActionKey {
static ExpectedActionKey newIconKey(final String iconName) {
final int iconId = KeyboardIconsSet.getIconId(iconName);
@@ -72,51 +77,6 @@ abstract class KeyboardLayoutSetActionLabelBase extends KeyboardLayoutSetTestsBa
return LocaleUtils.constructLocaleFromString(localeString);
}
- public void testActionUnspecified() {
- final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
- KeyboardIconsSet.NAME_ENTER_KEY);
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "unspecifiled "
- + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_UNSPECIFIED, expectedKey);
- }
- }
-
- public void testActionNone() {
- final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
- KeyboardIconsSet.NAME_ENTER_KEY);
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "none " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_NONE, expectedKey);
- }
- }
-
- public void testActionSearch() {
- final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
- KeyboardIconsSet.NAME_SEARCH_KEY);
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "search " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_SEARCH, expectedKey);
- }
- }
-
- public abstract void testActionGo();
- public abstract void testActionSend();
- public abstract void testActionNext();
- public abstract void testActionDone();
- public abstract void testActionPrevious();
-
- public void testActionCustom() {
- for (final InputMethodSubtype subtype : getAllSubtypesList()) {
- final String tag = "custom " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- final EditorInfo editorInfo = new EditorInfo();
- editorInfo.imeOptions = EditorInfo.IME_ACTION_UNSPECIFIED;
- editorInfo.actionLabel = "customLabel";
- final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey("customLabel");
- doTestActionKey(tag, subtype, editorInfo, expectedKey);
- }
- }
-
private static void assertActionKey(final String tag, final KeyboardLayoutSet layoutSet,
final int elementId, final ExpectedActionKey expectedKey) {
final Keyboard keyboard = layoutSet.getKeyboard(elementId);
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionCustomTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionCustomTests.java
new file mode 100644
index 000000000..cb1c6ad1f
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionCustomTests.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionCustomTests extends KlpActionTestsBase {
+ public void testActionCustom() {
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "custom " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ final EditorInfo editorInfo = new EditorInfo();
+ editorInfo.imeOptions = EditorInfo.IME_ACTION_UNSPECIFIED;
+ editorInfo.actionLabel = "customLabel";
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey("customLabel");
+ doTestActionKey(tag, subtype, editorInfo, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionDoneTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionDoneTests.java
new file mode 100644
index 000000000..e0a87a70d
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionDoneTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionDoneTests extends KlpActionTestsBase {
+ public void testActionDone() {
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "done " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
+ R.string.label_done_key, getLabelLocale(subtype), getContext());
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_DONE, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionGoTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionGoTests.java
new file mode 100644
index 000000000..865b598d6
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionGoTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionGoTests extends KlpActionTestsBase {
+ public void testActionGo() {
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "go " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
+ R.string.label_go_key, getLabelLocale(subtype), getContext());
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_GO, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelKlpTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionLabelTests.java
index 36b9c9cfc..3fd3a36fc 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetActionLabelKlpTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionLabelTests.java
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-package com.android.inputmethod.keyboard;
+package com.android.inputmethod.keyboard.action;
import android.content.res.Resources;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.internal.KeyboardTextsSet;
import com.android.inputmethod.latin.R;
@@ -28,90 +29,11 @@ import com.android.inputmethod.latin.RichInputMethodManager;
import com.android.inputmethod.latin.utils.RunInLocale;
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
-import java.util.ArrayList;
import java.util.Locale;
@MediumTest
-public class KeyboardLayoutSetActionLabelKlpTests extends KeyboardLayoutSetActionLabelBase {
- // Filter a subtype whose name should be displayed using {@link Locale#ROOT}, such like
- // Hinglish (hi_ZZ) and Serbian-Latn (sr_ZZ).
- static final SubtypeFilter SUBTYPE_FILTER_NAME_IN_BASE_LOCALE = new SubtypeFilter() {
- @Override
- public boolean accept(final InputMethodSubtype subtype) {
- return Locale.ROOT.equals(
- SubtypeLocaleUtils.getDisplayLocaleOfSubtypeLocale(subtype.getLocale()));
- }
- };
-
- private ArrayList<InputMethodSubtype> mSubtypesWhoseNameIsDisplayedInItsLocale;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mSubtypesWhoseNameIsDisplayedInItsLocale = getSubtypesFilteredBy(new SubtypeFilter() {
- @Override
- public boolean accept(final InputMethodSubtype subtype) {
- return !SUBTYPE_FILTER_NAME_IN_BASE_LOCALE.accept(subtype);
- }
- });
- }
-
- @Override
- protected int getKeyboardThemeForTests() {
- return KeyboardTheme.THEME_ID_KLP;
- }
-
- @Override
- public void testActionGo() {
- for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
- final String tag = "go " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
- R.string.label_go_key, getLabelLocale(subtype), getContext());
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_GO, expectedKey);
- }
- }
-
- @Override
- public void testActionSend() {
- for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
- final String tag = "send " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
- R.string.label_send_key, getLabelLocale(subtype), getContext());
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_SEND, expectedKey);
- }
- }
-
- @Override
- public void testActionNext() {
- for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
- final String tag = "next " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
- R.string.label_next_key, getLabelLocale(subtype), getContext());
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_NEXT, expectedKey);
- }
- }
-
- @Override
- public void testActionDone() {
- for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
- final String tag = "done " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
- R.string.label_done_key, getLabelLocale(subtype), getContext());
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_DONE, expectedKey);
- }
- }
-
- @Override
- public void testActionPrevious() {
- for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
- final String tag = "previous " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
- final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
- R.string.label_previous_key, getLabelLocale(subtype), getContext());
- doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_PREVIOUS, expectedKey);
- }
- }
-
- private void doTestActionKeys(final InputMethodSubtype subtype, final String tag,
+public class KlpActionLabelTests extends KlpActionTestsBase {
+ void doTestActionKeys(final InputMethodSubtype subtype, final String tag,
final ExpectedActionKey unspecifiedKey, final ExpectedActionKey noneKey,
final ExpectedActionKey goKey, final ExpectedActionKey searchKey,
final ExpectedActionKey sendKey, final ExpectedActionKey nextKey,
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionNextTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionNextTests.java
new file mode 100644
index 000000000..c67740cac
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionNextTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionNextTests extends KlpActionTestsBase {
+ public void testActionNext() {
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "next " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
+ R.string.label_next_key, getLabelLocale(subtype), getContext());
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_NEXT, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionNoneTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionNoneTests.java
new file mode 100644
index 000000000..0be2ecb93
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionNoneTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionNoneTests extends KlpActionTestsBase {
+ public void testActionNone() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_ENTER_KEY);
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "none " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_NONE, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionPreviousTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionPreviousTests.java
new file mode 100644
index 000000000..af6a15400
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionPreviousTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionPreviousTests extends KlpActionTestsBase {
+ public void testActionPrevious() {
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "previous " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
+ R.string.label_previous_key, getLabelLocale(subtype), getContext());
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_PREVIOUS, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionSearchTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionSearchTests.java
new file mode 100644
index 000000000..adc3feee7
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionSearchTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionSearchTests extends KlpActionTestsBase {
+ public void testActionSearch() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_SEARCH_KEY);
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "search " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_SEARCH, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionSendTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionSendTests.java
new file mode 100644
index 000000000..82f97a2ae
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionSendTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionSendTests extends KlpActionTestsBase {
+ public void testActionSend() {
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "send " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey(
+ R.string.label_send_key, getLabelLocale(subtype), getContext());
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_SEND, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionTestsBase.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionTestsBase.java
new file mode 100644
index 000000000..511f9950b
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionTestsBase.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.KeyboardTheme;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+abstract class KlpActionTestsBase extends ActionTestsBase {
+ // Filter a subtype whose name should be displayed using {@link Locale#ROOT}, such like
+ // Hinglish (hi_ZZ) and Serbian-Latn (sr_ZZ).
+ static final SubtypeFilter SUBTYPE_FILTER_NAME_IN_BASE_LOCALE = new SubtypeFilter() {
+ @Override
+ public boolean accept(final InputMethodSubtype subtype) {
+ return Locale.ROOT.equals(
+ SubtypeLocaleUtils.getDisplayLocaleOfSubtypeLocale(subtype.getLocale()));
+ }
+ };
+
+ protected ArrayList<InputMethodSubtype> mSubtypesWhoseNameIsDisplayedInItsLocale;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mSubtypesWhoseNameIsDisplayedInItsLocale = getSubtypesFilteredBy(new SubtypeFilter() {
+ @Override
+ public boolean accept(final InputMethodSubtype subtype) {
+ return !SUBTYPE_FILTER_NAME_IN_BASE_LOCALE.accept(subtype);
+ }
+ });
+ }
+
+ @Override
+ protected int getKeyboardThemeForTests() {
+ return KeyboardTheme.THEME_ID_KLP;
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/KlpActionUnspecifiedTests.java b/tests/src/com/android/inputmethod/keyboard/action/KlpActionUnspecifiedTests.java
new file mode 100644
index 000000000..307e273e8
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/KlpActionUnspecifiedTests.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class KlpActionUnspecifiedTests extends KlpActionTestsBase {
+ public void testActionUnspecified() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_ENTER_KEY);
+ for (final InputMethodSubtype subtype : mSubtypesWhoseNameIsDisplayedInItsLocale) {
+ final String tag = "unspecifiled "
+ + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_UNSPECIFIED, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionCustomTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionCustomTests.java
new file mode 100644
index 000000000..d561f457d
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionCustomTests.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionCustomTests extends LxxActionTestsBase {
+ public void testActionCustom() {
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "custom " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ final EditorInfo editorInfo = new EditorInfo();
+ editorInfo.imeOptions = EditorInfo.IME_ACTION_UNSPECIFIED;
+ editorInfo.actionLabel = "customLabel";
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newLabelKey("customLabel");
+ doTestActionKey(tag, subtype, editorInfo, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionDoneTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionDoneTests.java
new file mode 100644
index 000000000..b818bb1ce
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionDoneTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionDoneTests extends LxxActionTestsBase {
+ public void testActionDone() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_DONE_KEY);
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "done " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_DONE, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionGoTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionGoTests.java
new file mode 100644
index 000000000..8001f7105
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionGoTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionGoTests extends LxxActionTestsBase {
+ public void testActionGo() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_GO_KEY);
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "go " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_GO, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionNextTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionNextTests.java
new file mode 100644
index 000000000..09a8c87ec
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionNextTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionNextTests extends LxxActionTestsBase {
+ public void testActionNext() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_NEXT_KEY);
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "next " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_NEXT, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionNoneTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionNoneTests.java
new file mode 100644
index 000000000..98595e976
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionNoneTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionNoneTests extends LxxActionTestsBase {
+ public void testActionNone() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_ENTER_KEY);
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "none " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_NONE, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionPreviousTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionPreviousTests.java
new file mode 100644
index 000000000..2327889ae
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionPreviousTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionPreviousTests extends LxxActionTestsBase {
+ public void testActionPrevious() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_PREVIOUS_KEY);
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "previous " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_PREVIOUS, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionSearchTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionSearchTests.java
new file mode 100644
index 000000000..7e1d86b2e
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionSearchTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionSearchTests extends LxxActionTestsBase {
+ public void testActionSearch() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_SEARCH_KEY);
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "search " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_SEARCH, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionSendTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionSendTests.java
new file mode 100644
index 000000000..fa0134f0d
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionSendTests.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionSendTests extends LxxActionTestsBase {
+ public void testActionSend() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_SEND_KEY);
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "send " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_SEND, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionTestsBase.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionTestsBase.java
new file mode 100644
index 000000000..70de9a6b8
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionTestsBase.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import com.android.inputmethod.keyboard.KeyboardTheme;
+
+abstract class LxxActionTestsBase extends ActionTestsBase {
+ @Override
+ protected int getKeyboardThemeForTests() {
+ return KeyboardTheme.THEME_ID_LXX_LIGHT;
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/action/LxxActionUnspecifiedTests.java b/tests/src/com/android/inputmethod/keyboard/action/LxxActionUnspecifiedTests.java
new file mode 100644
index 000000000..711ca2614
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/action/LxxActionUnspecifiedTests.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.keyboard.action;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
+import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
+
+@LargeTest
+public class LxxActionUnspecifiedTests extends LxxActionTestsBase {
+ public void testActionUnspecified() {
+ final ExpectedActionKey expectedKey = ExpectedActionKey.newIconKey(
+ KeyboardIconsSet.NAME_ENTER_KEY);
+ for (final InputMethodSubtype subtype : getAllSubtypesList()) {
+ final String tag = "unspecifiled "
+ + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype);
+ doTestActionKey(tag, subtype, EditorInfo.IME_ACTION_UNSPECIFIED, expectedKey);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java b/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java
index 3319eec3b..00857e54e 100644
--- a/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java
+++ b/tests/src/com/android/inputmethod/latin/accounts/AccountsChangedReceiverTests.java
@@ -33,18 +33,21 @@ public class AccountsChangedReceiverTests extends AndroidTestCase {
private static final String ACCOUNT_2 = "account2@example.com";
private SharedPreferences mPrefs;
+ private String mLastKnownAccount = null;
@Override
protected void setUp() throws Exception {
super.setUp();
mPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
+ // Keep track of the current account so that we restore it when the test finishes.
+ mLastKnownAccount = mPrefs.getString(Settings.PREF_ACCOUNT_NAME, null);
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
- // Remove all preferences before the next test.
- mPrefs.edit().clear();
+ // Restore the account that was present before running the test.
+ updateAccountName(mLastKnownAccount);
}
public void testUnknownIntent() {
@@ -95,9 +98,11 @@ public class AccountsChangedReceiverTests extends AndroidTestCase {
}
private void updateAccountName(String accountName) {
- mPrefs.edit()
- .putString(Settings.PREF_ACCOUNT_NAME, accountName)
- .commit();
+ if (accountName == null) {
+ mPrefs.edit().remove(Settings.PREF_ACCOUNT_NAME).apply();
+ } else {
+ mPrefs.edit().putString(Settings.PREF_ACCOUNT_NAME, accountName).apply();
+ }
}
private void assertAccountName(String expectedAccountName) {
diff --git a/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java
index 819d76328..cbabf7e8d 100644
--- a/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/ImportantNoticeUtilsTests.java
@@ -16,18 +16,18 @@
package com.android.inputmethod.latin.utils;
-import static com.android.inputmethod.latin.utils.ImportantNoticeUtils.KEY_TIMESTAMP_OF_FIRST_IMPORTANT_NOTICE;
import static com.android.inputmethod.latin.utils.ImportantNoticeUtils.KEY_IMPORTANT_NOTICE_VERSION;
+import static com.android.inputmethod.latin.utils.ImportantNoticeUtils.KEY_TIMESTAMP_OF_FIRST_IMPORTANT_NOTICE;
import android.content.Context;
import android.content.SharedPreferences;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.test.suitebuilder.annotation.MediumTest;
import android.text.TextUtils;
import java.util.concurrent.TimeUnit;
-@SmallTest
+@MediumTest
public class ImportantNoticeUtilsTests extends AndroidTestCase {
// This should be aligned with R.integer.config_important_notice_version.
private static final int CURRENT_IMPORTANT_NOTICE_VERSION = 1;
@@ -112,6 +112,28 @@ public class ImportantNoticeUtilsTests extends AndroidTestCase {
ImportantNoticeUtils.getCurrentImportantNoticeVersion(getContext()));
}
+ public void testStateAfterFreshInstall() {
+ mImportantNoticePreferences.clear();
+
+ // Check internal state of {@link ImportantNoticeUtils.shouldShowImportantNotice(Context)}
+ // after fresh install.
+ assertEquals("Has new imortant notice after fresh install", true,
+ ImportantNoticeUtils.hasNewImportantNotice(getContext()));
+ assertEquals("Next important norice title after fresh install", false, TextUtils.isEmpty(
+ ImportantNoticeUtils.getNextImportantNoticeTitle(getContext())));
+ assertEquals("Is in system setup wizard after fresh install", false,
+ ImportantNoticeUtils.isInSystemSetupWizard(getContext()));
+ final long currentTimeMillis = System.currentTimeMillis();
+ assertEquals("Has timeout passed after fresh install", false,
+ ImportantNoticeUtils.hasTimeoutPassed(getContext(), currentTimeMillis));
+ assertEquals("Timestamp of first important notice after fresh install",
+ (Long)currentTimeMillis,
+ mImportantNoticePreferences.getLong(KEY_TIMESTAMP_OF_FIRST_IMPORTANT_NOTICE));
+
+ assertEquals("Current boolean before update", true,
+ ImportantNoticeUtils.shouldShowImportantNotice(getContext()));
+ }
+
public void testUpdateVersion() {
mImportantNoticePreferences.clear();
@@ -163,7 +185,7 @@ public class ImportantNoticeUtilsTests extends AndroidTestCase {
ImportantNoticeUtils.getLastImportantNoticeVersion(getContext()));
assertEquals("Next version before timeout 1", 1,
ImportantNoticeUtils.getNextImportantNoticeVersion(getContext()));
- assertEquals("Last time before timeout 1", (Long)lastTime,
+ assertEquals("Timestamp of first important notice before timeout 1", (Long)lastTime,
mImportantNoticePreferences.getLong(KEY_TIMESTAMP_OF_FIRST_IMPORTANT_NOTICE));
assertEquals("Current title before timeout 1", false, TextUtils.isEmpty(
ImportantNoticeUtils.getNextImportantNoticeTitle(getContext())));
@@ -180,7 +202,7 @@ public class ImportantNoticeUtilsTests extends AndroidTestCase {
ImportantNoticeUtils.getLastImportantNoticeVersion(getContext()));
assertEquals("Next version before timeout 2", 1,
ImportantNoticeUtils.getNextImportantNoticeVersion(getContext()));
- assertEquals("Last time before timeout 2", (Long)lastTime,
+ assertEquals("Timestamp of first important notice before timeout 2", (Long)lastTime,
mImportantNoticePreferences.getLong(KEY_TIMESTAMP_OF_FIRST_IMPORTANT_NOTICE));
assertEquals("Current title before timeout 2", false, TextUtils.isEmpty(
ImportantNoticeUtils.getNextImportantNoticeTitle(getContext())));
@@ -196,7 +218,7 @@ public class ImportantNoticeUtilsTests extends AndroidTestCase {
ImportantNoticeUtils.getLastImportantNoticeVersion(getContext()));
assertEquals("Next version after timeout 1", 2,
ImportantNoticeUtils.getNextImportantNoticeVersion(getContext()));
- assertEquals("Last time aflter timeout 1", null,
+ assertEquals("Timestamp of first important notice after timeout 1", null,
mImportantNoticePreferences.getLong(KEY_TIMESTAMP_OF_FIRST_IMPORTANT_NOTICE));
assertEquals("Current title after timeout 1", true, TextUtils.isEmpty(
ImportantNoticeUtils.getNextImportantNoticeTitle(getContext())));
@@ -212,7 +234,7 @@ public class ImportantNoticeUtilsTests extends AndroidTestCase {
ImportantNoticeUtils.getLastImportantNoticeVersion(getContext()));
assertEquals("Next version after timeout 2", 2,
ImportantNoticeUtils.getNextImportantNoticeVersion(getContext()));
- assertEquals("Last time aflter timeout 2", null,
+ assertEquals("Timestamp of first important notice after timeout 2", null,
mImportantNoticePreferences.getLong(KEY_TIMESTAMP_OF_FIRST_IMPORTANT_NOTICE));
assertEquals("Current title after timeout 2", true, TextUtils.isEmpty(
ImportantNoticeUtils.getNextImportantNoticeTitle(getContext())));