diff options
author | 2024-12-16 21:45:41 -0500 | |
---|---|---|
committer | 2025-01-11 14:17:35 -0500 | |
commit | e9a0e66716dab4dd3184d009d8920de1961efdfa (patch) | |
tree | 02dcc096643d74645bf28459c2834c3d4a2ad7f2 /tests/src/org/kelar/inputmethod/keyboard/action | |
parent | fb3b9360d70596d7e921de8bf7d3ca99564a077e (diff) | |
download | latinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.tar.gz latinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.tar.xz latinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.zip |
Rename to Kelar Keyboard (org.kelar.inputmethod.latin)
Diffstat (limited to 'tests/src/org/kelar/inputmethod/keyboard/action')
22 files changed, 1047 insertions, 0 deletions
diff --git a/tests/src/org/kelar/inputmethod/keyboard/action/ActionTestsBase.java b/tests/src/org/kelar/inputmethod/keyboard/action/ActionTestsBase.java new file mode 100644 index 000000000..77ec4cee3 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/ActionTestsBase.java @@ -0,0 +1,115 @@ +/* + * 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 org.kelar.inputmethod.keyboard.action; + +import android.content.Context; +import android.content.res.Resources; +import android.text.InputType; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import org.kelar.inputmethod.keyboard.Key; +import org.kelar.inputmethod.keyboard.Keyboard; +import org.kelar.inputmethod.keyboard.KeyboardId; +import org.kelar.inputmethod.keyboard.KeyboardLayoutSet; +import org.kelar.inputmethod.keyboard.KeyboardLayoutSetTestsBase; +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.inputmethod.keyboard.layout.expected.ExpectedKeyVisual; +import org.kelar.inputmethod.latin.common.Constants; +import org.kelar.inputmethod.latin.common.LocaleUtils; +import org.kelar.inputmethod.latin.utils.RunInLocale; +import org.kelar.inputmethod.latin.utils.SubtypeLocaleUtils; + +import java.util.Locale; + +abstract class ActionTestsBase extends KeyboardLayoutSetTestsBase { + static class ExpectedActionKey { + static ExpectedActionKey newIconKey(final String iconName) { + final int iconId = KeyboardIconsSet.getIconId(iconName); + return new ExpectedActionKey(ExpectedKeyVisual.newInstance(iconId)); + } + + static ExpectedActionKey newLabelKey(final String label) { + return new ExpectedActionKey(ExpectedKeyVisual.newInstance(label)); + } + + static ExpectedActionKey newLabelKey(final int labelResId, + final Locale labelLocale, final Context context) { + final RunInLocale<String> getString = new RunInLocale<String>() { + @Override + protected String job(final Resources res) { + return res.getString(labelResId); + } + }; + return newLabelKey(getString.runInLocale(context.getResources(), labelLocale)); + } + + private final ExpectedKeyVisual mVisual; + + private ExpectedActionKey(final ExpectedKeyVisual visual) { + mVisual = visual; + } + + public int getIconId() { return mVisual.getIconId(); } + + public String getLabel() { return mVisual.getLabel(); } + } + + protected static Locale getLabelLocale(final InputMethodSubtype subtype) { + final String localeString = subtype.getLocale(); + if (localeString.equals(SubtypeLocaleUtils.NO_LANGUAGE)) { + return null; + } + return LocaleUtils.constructLocaleFromString(localeString); + } + + private static void assertActionKey(final String tag, final KeyboardLayoutSet layoutSet, + final int elementId, final ExpectedActionKey expectedKey) { + final Keyboard keyboard = layoutSet.getKeyboard(elementId); + final Key actualKey = keyboard.getKey(Constants.CODE_ENTER); + assertNotNull(tag + " enter key on " + keyboard.mId, actualKey); + assertEquals(tag + " label " + expectedKey, expectedKey.getLabel(), actualKey.getLabel()); + assertEquals(tag + " icon " + expectedKey, expectedKey.getIconId(), actualKey.getIconId()); + } + + protected void doTestActionKey(final String tag, final InputMethodSubtype subtype, + final int actionId, final ExpectedActionKey expectedKey) { + final EditorInfo editorInfo = new EditorInfo(); + editorInfo.imeOptions = actionId; + doTestActionKey(tag, subtype, editorInfo, expectedKey); + } + + protected void doTestActionKey(final String tag, final InputMethodSubtype subtype, + final EditorInfo editorInfo, final ExpectedActionKey expectedKey) { + // Test text layouts. + editorInfo.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL; + final KeyboardLayoutSet layoutSet = createKeyboardLayoutSet(subtype, editorInfo); + assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_ALPHABET, expectedKey); + assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS, expectedKey); + assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS_SHIFTED, expectedKey); + // Test phone number layouts. + assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE, expectedKey); + assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE_SYMBOLS, expectedKey); + // Test normal number layout. + assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_NUMBER, expectedKey); + // Test number password layout. + editorInfo.inputType = + InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD; + final KeyboardLayoutSet passwordSet = createKeyboardLayoutSet(subtype, editorInfo); + assertActionKey(tag, passwordSet, KeyboardId.ELEMENT_NUMBER, expectedKey); + } +} diff --git a/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionCustomTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionCustomTests.java new file mode 100644 index 000000000..e8257cc9f --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionCustomTests.java @@ -0,0 +1,38 @@ +/* + * 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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionDoneTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionDoneTests.java new file mode 100644 index 000000000..557590041 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionDoneTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.latin.R; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionGoTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionGoTests.java new file mode 100644 index 000000000..f77a4d38f --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionGoTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.latin.R; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionLabelTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionLabelTests.java new file mode 100644 index 000000000..8297764c2 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionLabelTests.java @@ -0,0 +1,181 @@ +/* + * 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 org.kelar.inputmethod.keyboard.action; + +import android.content.res.Resources; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.MediumTest; + +import org.kelar.inputmethod.keyboard.KeyboardLayoutSet; +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.inputmethod.keyboard.internal.KeyboardTextsSet; +import org.kelar.inputmethod.latin.R; +import org.kelar.inputmethod.latin.RichInputMethodManager; +import org.kelar.inputmethod.latin.utils.RunInLocale; +import org.kelar.inputmethod.latin.utils.SubtypeLocaleUtils; + +import java.util.Locale; + +@MediumTest +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, + final ExpectedActionKey doneKey, final ExpectedActionKey previousKey) { + doTestActionKey( + tag + " unspecified", subtype, EditorInfo.IME_ACTION_UNSPECIFIED, unspecifiedKey); + doTestActionKey(tag + " none", subtype, EditorInfo.IME_ACTION_NONE, noneKey); + doTestActionKey(tag + " go", subtype, EditorInfo.IME_ACTION_GO, goKey); + doTestActionKey(tag + " search", subtype, EditorInfo.IME_ACTION_SEARCH, searchKey); + doTestActionKey(tag + " send", subtype, EditorInfo.IME_ACTION_SEND, sendKey); + doTestActionKey(tag + " next", subtype, EditorInfo.IME_ACTION_NEXT, nextKey); + doTestActionKey(tag + " done", subtype, EditorInfo.IME_ACTION_DONE, doneKey); + doTestActionKey(tag + " previous", subtype, EditorInfo.IME_ACTION_PREVIOUS, previousKey); + } + + // Working variable to simulate system locale changing. + private Locale mSystemLocale = Locale.getDefault(); + + private void doTestActionKeysInLocaleWithStringResources(final InputMethodSubtype subtype, + final Locale labelLocale, final Locale systemLocale) { + // Simulate system locale changing, see {@link SystemBroadcastReceiver}. + if (!systemLocale.equals(mSystemLocale)) { + KeyboardLayoutSet.onSystemLocaleChanged(); + mSystemLocale = systemLocale; + } + final ExpectedActionKey enterKey = ExpectedActionKey.newIconKey( + KeyboardIconsSet.NAME_ENTER_KEY); + final ExpectedActionKey goKey = ExpectedActionKey.newLabelKey( + R.string.label_go_key, labelLocale, getContext()); + final ExpectedActionKey searchKey = ExpectedActionKey.newIconKey( + KeyboardIconsSet.NAME_SEARCH_KEY); + final ExpectedActionKey sendKey = ExpectedActionKey.newLabelKey( + R.string.label_send_key, labelLocale, getContext()); + final ExpectedActionKey nextKey = ExpectedActionKey.newLabelKey( + R.string.label_next_key, labelLocale, getContext()); + final ExpectedActionKey doneKey = ExpectedActionKey.newLabelKey( + R.string.label_done_key, labelLocale, getContext()); + final ExpectedActionKey previousKey = ExpectedActionKey.newLabelKey( + R.string.label_previous_key, labelLocale, getContext()); + final String tag = "label=" + labelLocale + " system=" + systemLocale + + " " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype); + final RunInLocale<Void> job = new RunInLocale<Void>() { + @Override + public Void job(final Resources res) { + doTestActionKeys(subtype, tag, enterKey, enterKey, goKey, searchKey, sendKey, + nextKey, doneKey, previousKey); + return null; + } + }; + job.runInLocale(getContext().getResources(), systemLocale); + } + + public void testActionLabelInOtherLocale() { + final RichInputMethodManager richImm = RichInputMethodManager.getInstance(); + final InputMethodSubtype italian = richImm.findSubtypeByLocaleAndKeyboardLayoutSet( + Locale.ITALIAN.toString(), SubtypeLocaleUtils.QWERTY); + // An action label should be displayed in subtype's locale regardless of the system locale. + doTestActionKeysInLocaleWithStringResources(italian, Locale.ITALIAN, Locale.US); + doTestActionKeysInLocaleWithStringResources(italian, Locale.ITALIAN, Locale.FRENCH); + doTestActionKeysInLocaleWithStringResources(italian, Locale.ITALIAN, Locale.ITALIAN); + doTestActionKeysInLocaleWithStringResources(italian, Locale.ITALIAN, Locale.JAPANESE); + } + + public void testNoLanguageSubtypeActionLabel() { + final RichInputMethodManager richImm = RichInputMethodManager.getInstance(); + final InputMethodSubtype noLanguage = richImm.findSubtypeByLocaleAndKeyboardLayoutSet( + SubtypeLocaleUtils.NO_LANGUAGE, SubtypeLocaleUtils.QWERTY); + // An action label of no language keyboard should be displayed in the system locale. + doTestActionKeysInLocaleWithStringResources(noLanguage, Locale.US, Locale.US); + doTestActionKeysInLocaleWithStringResources(noLanguage, Locale.FRENCH, Locale.FRENCH); + doTestActionKeysInLocaleWithStringResources(noLanguage, Locale.ITALIAN, Locale.ITALIAN); + doTestActionKeysInLocaleWithStringResources(noLanguage, Locale.JAPANESE, Locale.JAPANESE); + } + + private void doTestActionKeysInLocaleWithKeyboardTextsSet(final InputMethodSubtype subtype, + final Locale labelLocale, final Locale systemLocale) { + // Simulate system locale changing, see {@link SystemBroadcastReceiver}. + if (!systemLocale.equals(mSystemLocale)) { + KeyboardLayoutSet.onSystemLocaleChanged(); + mSystemLocale = systemLocale; + } + final KeyboardTextsSet textsSet = new KeyboardTextsSet(); + textsSet.setLocale(labelLocale, getContext()); + final ExpectedActionKey enterKey = ExpectedActionKey.newIconKey( + KeyboardIconsSet.NAME_ENTER_KEY); + final ExpectedActionKey goKey = ExpectedActionKey.newLabelKey( + textsSet.getText("label_go_key")); + final ExpectedActionKey searchKey = ExpectedActionKey.newIconKey( + KeyboardIconsSet.NAME_SEARCH_KEY); + final ExpectedActionKey sendKey = ExpectedActionKey.newLabelKey( + textsSet.getText("label_send_key")); + final ExpectedActionKey nextKey = ExpectedActionKey.newLabelKey( + textsSet.getText("label_next_key")); + final ExpectedActionKey doneKey = ExpectedActionKey.newLabelKey( + textsSet.getText("label_done_key")); + final ExpectedActionKey previousKey = ExpectedActionKey.newLabelKey( + textsSet.getText("label_previous_key")); + final String tag = "label=" + subtype.getLocale() + " system=" + systemLocale + + " " + SubtypeLocaleUtils.getSubtypeNameForLogging(subtype); + final RunInLocale<Void> job = new RunInLocale<Void>() { + @Override + public Void job(final Resources res) { + doTestActionKeys(subtype, tag, enterKey, enterKey, goKey, searchKey, sendKey, + nextKey, doneKey, previousKey); + return null; + } + }; + job.runInLocale(getContext().getResources(), systemLocale); + } + + public void testHinglishActionLabel() { + final RichInputMethodManager richImm = RichInputMethodManager.getInstance(); + final Locale hi_ZZ = new Locale("hi", "ZZ"); + final InputMethodSubtype hiLatn = richImm.findSubtypeByLocaleAndKeyboardLayoutSet( + hi_ZZ.toString(), SubtypeLocaleUtils.QWERTY); + // This is a preliminary subtype and may not exist. + if (hiLatn == null) { + return; + } + // An action label should be displayed in subtype's locale regardless of the system locale. + doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, new Locale("hi")); + doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, Locale.US); + doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, Locale.FRENCH); + doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, Locale.ITALIAN); + doTestActionKeysInLocaleWithKeyboardTextsSet(hiLatn, hi_ZZ, Locale.JAPANESE); + } + + public void testSerbianLatinActionLabel() { + final RichInputMethodManager richImm = RichInputMethodManager.getInstance(); + final Locale sr_ZZ = new Locale("sr", "ZZ"); + final InputMethodSubtype srLatn = richImm.findSubtypeByLocaleAndKeyboardLayoutSet( + sr_ZZ.toString(), "serbian_qwertz"); + // This is a preliminary subtype and may not exist. + if (srLatn == null) { + return; + } + // An action label should be displayed in subtype's locale regardless of the system locale. + doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, new Locale("sr")); + doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, Locale.US); + doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, Locale.FRENCH); + doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, Locale.ITALIAN); + doTestActionKeysInLocaleWithKeyboardTextsSet(srLatn, sr_ZZ, Locale.JAPANESE); + } +} diff --git a/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionNextTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionNextTests.java new file mode 100644 index 000000000..47170f062 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionNextTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.latin.R; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionNoneTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionNoneTests.java new file mode 100644 index 000000000..09178bea9 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionNoneTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionPreviousTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionPreviousTests.java new file mode 100644 index 000000000..d779b2838 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionPreviousTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.latin.R; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionSearchTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionSearchTests.java new file mode 100644 index 000000000..2a2b6ab44 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionSearchTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionSendTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionSendTests.java new file mode 100644 index 000000000..5a0c7de48 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionSendTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.latin.R; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionTestsBase.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionTestsBase.java new file mode 100644 index 000000000..61156ebce --- /dev/null +++ b/tests/src/org/kelar/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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.InputMethodSubtype; + +import org.kelar.inputmethod.keyboard.KeyboardTheme; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/KlpActionUnspecifiedTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionUnspecifiedTests.java new file mode 100644 index 000000000..11039bb29 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/KlpActionUnspecifiedTests.java @@ -0,0 +1,38 @@ +/* + * 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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionCustomTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionCustomTests.java new file mode 100644 index 000000000..fd958b2c0 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionCustomTests.java @@ -0,0 +1,38 @@ +/* + * 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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionDoneTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionDoneTests.java new file mode 100644 index 000000000..d09a514a4 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionDoneTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionGoTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionGoTests.java new file mode 100644 index 000000000..c000f2154 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionGoTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionNextTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionNextTests.java new file mode 100644 index 000000000..576fcde84 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionNextTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionNoneTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionNoneTests.java new file mode 100644 index 000000000..07b7d01e3 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionNoneTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionPreviousTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionPreviousTests.java new file mode 100644 index 000000000..eb9ecd10a --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionPreviousTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionSearchTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionSearchTests.java new file mode 100644 index 000000000..86b915ff8 --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionSearchTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionSendTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionSendTests.java new file mode 100644 index 000000000..8c57243ea --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionSendTests.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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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/org/kelar/inputmethod/keyboard/action/LxxActionTestsBase.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionTestsBase.java new file mode 100644 index 000000000..4e9fbcb4a --- /dev/null +++ b/tests/src/org/kelar/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 org.kelar.inputmethod.keyboard.action; + +import org.kelar.inputmethod.keyboard.KeyboardTheme; + +abstract class LxxActionTestsBase extends ActionTestsBase { + @Override + protected int getKeyboardThemeForTests() { + return KeyboardTheme.THEME_ID_LXX_LIGHT; + } +} diff --git a/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionUnspecifiedTests.java b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionUnspecifiedTests.java new file mode 100644 index 000000000..264e8951d --- /dev/null +++ b/tests/src/org/kelar/inputmethod/keyboard/action/LxxActionUnspecifiedTests.java @@ -0,0 +1,38 @@ +/* + * 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 org.kelar.inputmethod.keyboard.action; + +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; + +import androidx.test.filters.LargeTest; + +import org.kelar.inputmethod.keyboard.internal.KeyboardIconsSet; +import org.kelar.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); + } + } +} |