Fix unit tests.
Language change has always been strange. That's because we didn't call the right method >.> Also, extra values were not passed in correctly. Change-Id: Ifc345988df944ad691fe22cb71cb519e47a5a223main
parent
d23d1970b0
commit
68730d1c8e
|
@ -220,7 +220,7 @@ public class InputLogicTestsReorderingMyanmar extends InputTestsBase {
|
||||||
|
|
||||||
public void testMyanmarReordering() {
|
public void testMyanmarReordering() {
|
||||||
int testNumber = 0;
|
int testNumber = 0;
|
||||||
changeLanguage("mm_MY");
|
changeLanguage("my_MM", "CombiningRules=MyanmarReordering");
|
||||||
for (final Pair[] test : TESTS) {
|
for (final Pair[] test : TESTS) {
|
||||||
// Small trick to reset LatinIME : setText("") and send updateSelection with values
|
// Small trick to reset LatinIME : setText("") and send updateSelection with values
|
||||||
// LatinIME has never seen, and cursor pos 0,0.
|
// LatinIME has never seen, and cursor pos 0,0.
|
||||||
|
|
|
@ -299,11 +299,15 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void changeLanguage(final String locale) {
|
protected void changeLanguage(final String locale) {
|
||||||
changeLanguageWithoutWait(locale);
|
changeLanguage(locale, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void changeLanguage(final String locale, final String combiningSpec) {
|
||||||
|
changeLanguageWithoutWait(locale, combiningSpec);
|
||||||
waitForDictionariesToBeLoaded();
|
waitForDictionariesToBeLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void changeLanguageWithoutWait(final String locale) {
|
protected void changeLanguageWithoutWait(final String locale, final String combiningSpec) {
|
||||||
mEditText.mCurrentLocale = LocaleUtils.constructLocaleFromString(locale);
|
mEditText.mCurrentLocale = LocaleUtils.constructLocaleFromString(locale);
|
||||||
// TODO: this is forcing a QWERTY keyboard for all locales, which is wrong.
|
// TODO: this is forcing a QWERTY keyboard for all locales, which is wrong.
|
||||||
// It's still better than using whatever keyboard is the current one, but we
|
// It's still better than using whatever keyboard is the current one, but we
|
||||||
|
@ -314,7 +318,8 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
||||||
"KeyboardLayoutSet=" + SubtypeLocaleUtils.QWERTY
|
"KeyboardLayoutSet=" + SubtypeLocaleUtils.QWERTY
|
||||||
+ "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
|
+ "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
|
||||||
+ "," + Constants.Subtype.ExtraValue.ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE
|
+ "," + Constants.Subtype.ExtraValue.ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE
|
||||||
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE
|
||||||
|
+ null == combiningSpec ? "" : ("," + combiningSpec);
|
||||||
final InputMethodSubtype subtype = InputMethodSubtypeCompatUtils.newInputMethodSubtype(
|
final InputMethodSubtype subtype = InputMethodSubtypeCompatUtils.newInputMethodSubtype(
|
||||||
R.string.subtype_no_language_qwerty,
|
R.string.subtype_no_language_qwerty,
|
||||||
R.drawable.ic_ime_switcher_dark,
|
R.drawable.ic_ime_switcher_dark,
|
||||||
|
@ -325,7 +330,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> {
|
||||||
false /* overridesImplicitlyEnabledSubtype */,
|
false /* overridesImplicitlyEnabledSubtype */,
|
||||||
0 /* id */);
|
0 /* id */);
|
||||||
SubtypeSwitcher.getInstance().forceSubtype(subtype);
|
SubtypeSwitcher.getInstance().forceSubtype(subtype);
|
||||||
mLatinIME.loadKeyboard();
|
mLatinIME.onCurrentInputMethodSubtypeChanged(subtype);
|
||||||
runMessages();
|
runMessages();
|
||||||
mKeyboard = mLatinIME.mKeyboardSwitcher.getKeyboard();
|
mKeyboard = mLatinIME.mKeyboardSwitcher.getKeyboard();
|
||||||
mLatinIME.clearPersonalizedDictionariesForTest();
|
mLatinIME.clearPersonalizedDictionariesForTest();
|
||||||
|
|
|
@ -33,7 +33,8 @@ public class LatinImeStressTests extends InputTestsBase {
|
||||||
final int codePointSetSize = 30;
|
final int codePointSetSize = 30;
|
||||||
final int[] codePointSet = CodePointUtils.LATIN_ALPHABETS_LOWER;
|
final int[] codePointSet = CodePointUtils.LATIN_ALPHABETS_LOWER;
|
||||||
for (int i = 0; i < switchCount; ++i) {
|
for (int i = 0; i < switchCount; ++i) {
|
||||||
changeLanguageWithoutWait(locales[random.nextInt(locales.length)]);
|
changeLanguageWithoutWait(locales[random.nextInt(locales.length)],
|
||||||
|
null /* combiningSpec */);
|
||||||
final int wordCount = random.nextInt(maxWordCountToTypeInEachIteration);
|
final int wordCount = random.nextInt(maxWordCountToTypeInEachIteration);
|
||||||
for (int j = 0; j < wordCount; ++j) {
|
for (int j = 0; j < wordCount; ++j) {
|
||||||
final String word = CodePointUtils.generateWord(random, codePointSet);
|
final String word = CodePointUtils.generateWord(random, codePointSet);
|
||||||
|
@ -50,7 +51,8 @@ public class LatinImeStressTests extends InputTestsBase {
|
||||||
final int codePointSetSize = 30;
|
final int codePointSetSize = 30;
|
||||||
final int[] codePointSet = CodePointUtils.generateCodePointSet(codePointSetSize, random);
|
final int[] codePointSet = CodePointUtils.generateCodePointSet(codePointSetSize, random);
|
||||||
for (int i = 0; i < switchCount; ++i) {
|
for (int i = 0; i < switchCount; ++i) {
|
||||||
changeLanguageWithoutWait(locales[random.nextInt(locales.length)]);
|
changeLanguageWithoutWait(locales[random.nextInt(locales.length)],
|
||||||
|
null /* combiningSpec */);
|
||||||
final int wordCount = random.nextInt(maxWordCountToTypeInEachIteration);
|
final int wordCount = random.nextInt(maxWordCountToTypeInEachIteration);
|
||||||
for (int j = 0; j < wordCount; ++j) {
|
for (int j = 0; j < wordCount; ++j) {
|
||||||
final String word = CodePointUtils.generateWord(random, codePointSet);
|
final String word = CodePointUtils.generateWord(random, codePointSet);
|
||||||
|
|
Loading…
Reference in New Issue