Run test only on KitKat devices

This won't work on < KK because it needs the armenian locale
to be present on the device. I don't know why, but when under
test, apps don't seem to be able to resolve resources for locales
not supported by the system.

Change-Id: Ie0f4fc30954978061cae751024bab5569a2ab2eb
main
Jean Chalard 2014-05-28 17:18:20 +09:00
parent d3642a2a58
commit fa69784a96
1 changed files with 19 additions and 10 deletions

View File

@ -16,6 +16,7 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import android.os.Build;
import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.LargeTest;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
@ -111,15 +112,23 @@ public class ShiftModeTests extends InputTestsBase {
} }
public void testOtherSentenceSeparators() { public void testOtherSentenceSeparators() {
changeLanguage("hy-AM"); // We only run this test on Kitkat+ because previous versions of Android don't
assertTrue("(Armenian) Auto caps at start", isCapsModeAutoShifted()); // have an Armenian locale. For some reason I don't know, when the requested
type("Hey. "); // locale is not present as a device locale, then the application under test can't
assertFalse("(Armenian) No auto-caps after latin period", isCapsModeAutoShifted()); // access the resources in that locale -- though it works when the app is actually
type("Hey\u0589"); // running on the device and not under test. If we ever figure out what's going
assertFalse("(Armenian) No auto-caps directly after armenian period", // on, remove this test.
isCapsModeAutoShifted()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
type(" "); changeLanguage("hy-AM");
assertTrue("(Armenian) Auto-caps after armenian period-whitespace", assertTrue("(Armenian) Auto caps at start", isCapsModeAutoShifted());
isCapsModeAutoShifted()); type("Hey. ");
assertFalse("(Armenian) No auto-caps after latin period", isCapsModeAutoShifted());
type("Hey\u0589");
assertFalse("(Armenian) No auto-caps directly after armenian period",
isCapsModeAutoShifted());
type(" ");
assertTrue("(Armenian) Auto-caps after armenian period-whitespace",
isCapsModeAutoShifted());
}
} }
} }