diff options
Diffstat (limited to 'tests/src')
9 files changed, 303 insertions, 39 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java index eb67bc134..302f3b9fe 100644 --- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java +++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetSubtypesCountTests.java @@ -25,8 +25,8 @@ import java.util.ArrayList; @SmallTest public class KeyboardLayoutSetSubtypesCountTests extends KeyboardLayoutSetTestsBase { - private static final int NUMBER_OF_SUBTYPES = 77; - private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 45; + private static final int NUMBER_OF_SUBTYPES = 78; + private static final int NUMBER_OF_ASCII_CAPABLE_SUBTYPES = 46; private static final int NUMBER_OF_PREDEFINED_ADDITIONAL_SUBTYPES = 2; @Override diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHinglish.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHinglish.java new file mode 100644 index 000000000..2a6e46f96 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHinglish.java @@ -0,0 +1,56 @@ +/* + * 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.layout.tests; + +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.inputmethod.keyboard.layout.LayoutBase; +import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer; +import com.android.inputmethod.keyboard.layout.Qwerty; +import com.android.inputmethod.keyboard.layout.Symbols; +import com.android.inputmethod.keyboard.layout.SymbolsShifted; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; + +import java.util.Locale; + +/* + * hi_ZZ: Hinglish/qwerty + */ +@SmallTest +public final class TestsHinglish extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("hi", "ZZ"); + private static final LayoutBase LAYOUT = new Qwerty(new HinglishCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } + + private static class HinglishCustomizer extends LayoutCustomizer { + public HinglishCustomizer(final Locale locale) { super(locale); } + + @Override + public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; } + + @Override + public ExpectedKey[] getOtherCurrencyKeys() { + return SymbolsShifted.CURRENCIES_OTHER_GENERIC; + } + + // U+20B9: "₹" INDIAN RUPEE SIGN + private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9", + Symbols.CURRENCY_GENERIC_MORE_KEYS); + } +} diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java index eabd8d722..2b3fd892a 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java +++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java @@ -548,28 +548,6 @@ public class BinaryDictEncoderUtils { } /** - * Helper method to write a signed children position to a file. - * - * @param buffer the buffer to write to. - * @param index the index in the buffer to write the address to. - * @param position the position to write. - * @return the size in bytes the address actually took. - */ - /* package */ static int writeSignedChildrenPosition(final byte[] buffer, int index, - final int position) { - if (!BinaryDictIOUtils.hasChildrenAddress(position)) { - buffer[index] = buffer[index + 1] = buffer[index + 2] = 0; - } else { - final int absPosition = Math.abs(position); - buffer[index++] = - (byte)((position < 0 ? FormatSpec.MSB8 : 0) | (0xFF & (absPosition >> 16))); - buffer[index++] = (byte)(0xFF & (absPosition >> 8)); - buffer[index++] = (byte)(0xFF & absPosition); - } - return 3; - } - - /** * Makes the flag value for a PtNode. * * @param hasMultipleChars whether the PtNode has multiple chars. @@ -734,10 +712,6 @@ public class BinaryDictEncoderUtils { final int ptNodeCount = ptNodeArray.mData.size(); dictEncoder.writePtNodeCount(ptNodeCount); - final int parentPosition = - (ptNodeArray.mCachedParentAddress == FormatSpec.NO_PARENT_ADDRESS) - ? FormatSpec.NO_PARENT_ADDRESS - : ptNodeArray.mCachedParentAddress + ptNodeArray.mCachedAddressAfterUpdate; for (int i = 0; i < ptNodeCount; ++i) { final PtNode ptNode = ptNodeArray.mData.get(i); if (dictEncoder.getPosition() != ptNode.mCachedAddressAfterUpdate) { diff --git a/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java index 678c5ca6b..645fd5c02 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java +++ b/tests/src/com/android/inputmethod/latin/makedict/DictEncoder.java @@ -33,6 +33,5 @@ public interface DictEncoder { public void setPosition(final int position); public int getPosition(); public void writePtNodeCount(final int ptNodeCount); - public void writeForwardLinkAddress(final int forwardLinkAddress); public void writePtNode(final PtNode ptNode, final FusionDictionary dict); } diff --git a/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java index a286190cb..a7693d5ab 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java +++ b/tests/src/com/android/inputmethod/latin/makedict/Ver2DictEncoder.java @@ -223,12 +223,6 @@ public class Ver2DictEncoder implements DictEncoder { } @Override - public void writeForwardLinkAddress(final int forwardLinkAddress) { - mPosition = BinaryDictEncoderUtils.writeUIntToBuffer(mBuffer, mPosition, forwardLinkAddress, - FormatSpec.FORWARD_LINK_ADDRESS_SIZE); - } - - @Override public void writePtNode(final PtNode ptNode, final FusionDictionary dict) { writePtNodeFlags(ptNode); writeCharacters(ptNode.mChars, ptNode.hasSeveralChars()); diff --git a/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java b/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java index 76eaef431..2e5435159 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java +++ b/tests/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java @@ -141,10 +141,6 @@ public class Ver4DictEncoder implements DictEncoder { } @Override - public void writeForwardLinkAddress(int forwardLinkAddress) { - } - - @Override public void writePtNode(PtNode ptNode, FusionDictionary dict) { } } diff --git a/tests/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelperTests.java b/tests/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelperTests.java new file mode 100644 index 000000000..f3273a2d1 --- /dev/null +++ b/tests/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelperTests.java @@ -0,0 +1,221 @@ +/* + * 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.latin.suggestions; + +import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.inputmethod.latin.SuggestedWords; + +@SmallTest +public class SuggestionStripLayoutHelperTests extends AndroidTestCase { + private static void confirmShowTypedWord(final String message, final int inputType) { + assertFalse(message, SuggestionStripLayoutHelper.shouldOmitTypedWord( + inputType, + false /* gestureFloatingPreviewTextEnabled */, + false /* shouldShowUiToAcceptTypedWord */)); + assertFalse(message, SuggestionStripLayoutHelper.shouldOmitTypedWord( + inputType, + true /* gestureFloatingPreviewTextEnabled */, + false /* shouldShowUiToAcceptTypedWord */)); + assertFalse(message, SuggestionStripLayoutHelper.shouldOmitTypedWord( + inputType, + false /* gestureFloatingPreviewTextEnabled */, + true /* shouldShowUiToAcceptTypedWord */)); + assertFalse(message, SuggestionStripLayoutHelper.shouldOmitTypedWord( + inputType, + true /* gestureFloatingPreviewTextEnabled */, + true /* shouldShowUiToAcceptTypedWord */)); + } + + public void testShouldShowTypedWord() { + confirmShowTypedWord("no input style", + SuggestedWords.INPUT_STYLE_NONE); + confirmShowTypedWord("application specifed", + SuggestedWords.INPUT_STYLE_APPLICATION_SPECIFIED); + confirmShowTypedWord("recorrection", + SuggestedWords.INPUT_STYLE_RECORRECTION); + } + + public void testshouldOmitTypedWordWhileTyping() { + assertFalse("typing", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_TYPING, + false /* gestureFloatingPreviewTextEnabled */, + false /* shouldShowUiToAcceptTypedWord */)); + assertFalse("typing", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_TYPING, + true /* gestureFloatingPreviewTextEnabled */, + false /* shouldShowUiToAcceptTypedWord */)); + assertTrue("typing", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_TYPING, + false /* gestureFloatingPreviewTextEnabled */, + true /* shouldShowUiToAcceptTypedWord */)); + assertTrue("typing", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_TYPING, + true /* gestureFloatingPreviewTextEnabled */, + true /* shouldShowUiToAcceptTypedWord */)); + } + + public void testshouldOmitTypedWordWhileGesturing() { + assertFalse("gesturing", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_UPDATE_BATCH, + false /* gestureFloatingPreviewTextEnabled */, + false /* shouldShowUiToAcceptTypedWord */)); + assertFalse("gesturing", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_UPDATE_BATCH, + true /* gestureFloatingPreviewTextEnabled */, + false /* shouldShowUiToAcceptTypedWord */)); + assertFalse("gesturing", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_UPDATE_BATCH, + false /* gestureFloatingPreviewTextEnabled */, + true /* shouldShowUiToAcceptTypedWord */)); + assertTrue("gesturing", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_UPDATE_BATCH, + true /* gestureFloatingPreviewTextEnabled */, + true /* shouldShowUiToAcceptTypedWord */)); + } + + public void testshouldOmitTypedWordWhenGestured() { + assertFalse("gestured", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_TAIL_BATCH, + false /* gestureFloatingPreviewTextEnabled */, + false /* shouldShowUiToAcceptTypedWord */)); + assertFalse("gestured", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_TAIL_BATCH, + true /* gestureFloatingPreviewTextEnabled */, + false /* shouldShowUiToAcceptTypedWord */)); + assertTrue("gestured", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_TAIL_BATCH, + false /* gestureFloatingPreviewTextEnabled */, + true /* shouldShowUiToAcceptTypedWord */)); + assertTrue("gestured", SuggestionStripLayoutHelper.shouldOmitTypedWord( + SuggestedWords.INPUT_STYLE_TAIL_BATCH, + true /* gestureFloatingPreviewTextEnabled */, + true /* shouldShowUiToAcceptTypedWord */)); + } + + // Note that this unit test assumes that the number of suggested words in the suggestion strip + // is 3. + private static final int POSITION_OMIT = -1; + private static final int POSITION_LEFT = 0; + private static final int POSITION_CENTER = 1; + private static final int POSITION_RIGHT = 2; + + public void testGetPositionInSuggestionStrip() { + assertEquals("1st word without auto correction", POSITION_CENTER, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + SuggestedWords.INDEX_OF_TYPED_WORD /* indexInSuggestedWords */, + false /* willAutoCorrect */, + false /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("2nd word without auto correction", POSITION_LEFT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + SuggestedWords.INDEX_OF_AUTO_CORRECTION /* indexInSuggestedWords */, + false /* willAutoCorrect */, + false /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("3rd word without auto correction", POSITION_RIGHT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + 2 /* indexInSuggestedWords */, + false /* willAutoCorrect */, + false /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + + assertEquals("typed word with auto correction", POSITION_LEFT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + SuggestedWords.INDEX_OF_TYPED_WORD /* indexInSuggestedWords */, + true /* willAutoCorrect */, + false /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("2nd word with auto correction", POSITION_CENTER, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + SuggestedWords.INDEX_OF_AUTO_CORRECTION /* indexInSuggestedWords */, + true /* willAutoCorrect */, + false /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("3rd word with auto correction", POSITION_RIGHT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + 2 /* indexInSuggestedWords */, + true /* willAutoCorrect */, + false /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + + assertEquals("1st word without auto correction", POSITION_OMIT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + SuggestedWords.INDEX_OF_TYPED_WORD /* indexInSuggestedWords */, + false /* willAutoCorrect */, + true /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("2nd word without auto correction", POSITION_CENTER, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + SuggestedWords.INDEX_OF_AUTO_CORRECTION /* indexInSuggestedWords */, + false /* willAutoCorrect */, + true /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("3rd word without auto correction", POSITION_LEFT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + 2 /* indexInSuggestedWords */, + false /* willAutoCorrect */, + true /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("4th word without auto correction", POSITION_RIGHT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + 3 /* indexInSuggestedWords */, + false /* willAutoCorrect */, + true /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + + assertEquals("typed word with auto correction", POSITION_OMIT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + SuggestedWords.INDEX_OF_TYPED_WORD /* indexInSuggestedWords */, + true /* willAutoCorrect */, + true /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("2nd word with auto correction", POSITION_CENTER, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + SuggestedWords.INDEX_OF_AUTO_CORRECTION /* indexInSuggestedWords */, + true /* willAutoCorrect */, + true /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("3rd word with auto correction", POSITION_LEFT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + 2 /* indexInSuggestedWords */, + true /* willAutoCorrect */, + true /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + assertEquals("4th word with auto correction", POSITION_RIGHT, + SuggestionStripLayoutHelper.getPositionInSuggestionStrip( + 3 /* indexInSuggestedWords */, + true /* willAutoCorrect */, + true /* omitTypedWord */, + POSITION_CENTER /* centerPositionInStrip */, + POSITION_LEFT /* typedWordPositionWhenAutoCorrect */)); + } +} diff --git a/tests/src/com/android/inputmethod/latin/utils/SpacebarLanguageUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/SpacebarLanguageUtilsTests.java index 17247e7bb..aef517ca8 100644 --- a/tests/src/com/android/inputmethod/latin/utils/SpacebarLanguageUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/SpacebarLanguageUtilsTests.java @@ -44,6 +44,7 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { InputMethodSubtype FR_CH; InputMethodSubtype DE; InputMethodSubtype DE_CH; + InputMethodSubtype HI_ZZ; InputMethodSubtype ZZ; InputMethodSubtype DE_QWERTY; InputMethodSubtype FR_QWERTZ; @@ -85,6 +86,8 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { Locale.GERMAN.toString(), "qwertz"); DE_CH = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet( "de_CH", "swiss"); + HI_ZZ = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet( + "hi_ZZ", "qwerty"); ZZ = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet( SubtypeLocaleUtils.NO_LANGUAGE, "qwerty"); DE_QWERTY = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype( @@ -122,6 +125,12 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { for (final InputMethodSubtype subtype : mSubtypesList) { final String subtypeName = SubtypeLocaleUtils .getSubtypeDisplayNameInSystemLocale(subtype); + if (SubtypeLocaleUtils.sExceptionalLocaleDisplayedInRootLocale.contains( + subtype.getLocale())) { + // Skip test because the language part of this locale string doesn't represent + // the locale to be displayed on the spacebar (for example hi_ZZ and Hinglish). + continue; + } final String spacebarText = SpacebarLanguageUtils.getMiddleDisplayName(subtype); if (SubtypeLocaleUtils.isNoLanguage(subtype)) { assertEquals(subtypeName, @@ -147,6 +156,7 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { // fr_CH swiss F Français Français (Suisse) // de qwertz F Deutsch Deutsch // de_CH swiss F Deutsch Deutsch (Schweiz) + // hi_ZZ qwerty F Hinglish Hinglish // zz qwerty F QWERTY QWERTY // fr qwertz T Français Français // de qwerty T Deutsch Deutsch @@ -172,6 +182,8 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { SpacebarLanguageUtils.getFullDisplayName(DE)); assertEquals("de_CH", "Deutsch (Schweiz)", SpacebarLanguageUtils.getFullDisplayName(DE_CH)); + assertEquals("hi_ZZ", "Hinglish", + SpacebarLanguageUtils.getFullDisplayName(HI_ZZ)); assertEquals("zz", "QWERTY", SpacebarLanguageUtils.getFullDisplayName(ZZ)); @@ -191,6 +203,8 @@ public class SpacebarLanguageUtilsTests extends AndroidTestCase { SpacebarLanguageUtils.getMiddleDisplayName(DE)); assertEquals("de_CH", "Deutsch", SpacebarLanguageUtils.getMiddleDisplayName(DE_CH)); + assertEquals("hi_ZZ", "Hinglish", + SpacebarLanguageUtils.getMiddleDisplayName(HI_ZZ)); assertEquals("zz", "QWERTY", SpacebarLanguageUtils.getMiddleDisplayName(ZZ)); return null; diff --git a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java index ce3df7dd6..4f0b3ccdc 100644 --- a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java @@ -44,6 +44,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { InputMethodSubtype FR_CH; InputMethodSubtype DE; InputMethodSubtype DE_CH; + InputMethodSubtype HI_ZZ; InputMethodSubtype ZZ; InputMethodSubtype DE_QWERTY; InputMethodSubtype FR_QWERTZ; @@ -85,6 +86,8 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { Locale.GERMAN.toString(), "qwertz"); DE_CH = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet( "de_CH", "swiss"); + HI_ZZ = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet( + "hi_ZZ", "qwerty"); ZZ = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet( SubtypeLocaleUtils.NO_LANGUAGE, "qwerty"); DE_QWERTY = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype( @@ -128,6 +131,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { assertEquals("fr_CH", "swiss", SubtypeLocaleUtils.getKeyboardLayoutSetName(FR_CH)); assertEquals("de", "qwertz", SubtypeLocaleUtils.getKeyboardLayoutSetName(DE)); assertEquals("de_CH", "swiss", SubtypeLocaleUtils.getKeyboardLayoutSetName(DE_CH)); + assertEquals("hi_ZZ", "qwerty", SubtypeLocaleUtils.getKeyboardLayoutSetName(HI_ZZ)); assertEquals("zz", "qwerty", SubtypeLocaleUtils.getKeyboardLayoutSetName(ZZ)); assertEquals("de qwerty", "qwerty", SubtypeLocaleUtils.getKeyboardLayoutSetName(DE_QWERTY)); @@ -154,6 +158,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { // fr_CH swiss F French (Switzerland) // de qwertz F German // de_CH swiss F German (Switzerland) + // hi_ZZ qwerty F Hinglish // zz qwerty F Alphabet (QWERTY) // fr qwertz T French (QWERTZ) // de qwerty T German (QWERTY) @@ -182,6 +187,8 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(DE)); assertEquals("de_CH", "German (Switzerland)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(DE_CH)); + assertEquals("hi_ZZ", "Hinglish", + SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(HI_ZZ)); assertEquals("zz", "Alphabet (QWERTY)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(ZZ)); return null; @@ -226,6 +233,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { // fr_CH swiss F Français (Suisse) // de qwertz F Allemand // de_CH swiss F Allemand (Suisse) + // hi_ZZ qwerty F Hinglish // zz qwerty F Alphabet latin (QWERTY) // fr qwertz T Français (QWERTZ) // de qwerty T Allemand (QWERTY) @@ -254,6 +262,8 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(DE)); assertEquals("de_CH", "Allemand (Suisse)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(DE_CH)); + assertEquals("hi_ZZ", "Hinglish", + SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(HI_ZZ)); assertEquals("zz", "Alphabet latin (QWERTY)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(ZZ)); return null; |