diff options
author | Brett Chabot <brettchabot@android.com> | 2010-04-08 14:55:24 -0700 |
---|---|---|
committer | Brett Chabot <brettchabot@android.com> | 2010-04-08 14:55:24 -0700 |
commit | 1d679147d508b4c5d0a2ae1cc85bd030eb2f8761 (patch) | |
tree | 33ad50c9799bad905a2a509c422d48056cc611e4 /tests/ImfTest | |
parent | d1a95f975b03371a937da87735359c286a6de7f3 (diff) | |
download | frameworks_base-1d679147d508b4c5d0a2ae1cc85bd030eb2f8761.zip frameworks_base-1d679147d508b4c5d0a2ae1cc85bd030eb2f8761.tar.gz frameworks_base-1d679147d508b4c5d0a2ae1cc85bd030eb2f8761.tar.bz2 |
IME test fixes.
Tweak OneEditTextActivitySelectedTests:testSoftKeyboardAutoPop so it always
expects IME to be shown for devices with no hard keyboard.
Bug 2267311 2318969
Change-Id: Ica31e8f1153cf3e7dbc838d263ea0ae805161610
Diffstat (limited to 'tests/ImfTest')
-rw-r--r-- | tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java | 6 | ||||
-rwxr-xr-x | tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java | 15 |
2 files changed, 14 insertions, 7 deletions
diff --git a/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java b/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java index f313a90..64882aa 100644 --- a/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java +++ b/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java @@ -55,7 +55,11 @@ public class OneEditTextActivitySelected extends Activity ((ScrollView) mRootView).addView(layout); setContentView(mRootView); - } + + // set to resize so IME is always shown (and also so + // ImfBaseTestCase#destructiveCheckImeInitialState thinks it should always be shown + this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + } public View getRootView() { return mRootView; diff --git a/tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java b/tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java index 1957640..50e2009 100755 --- a/tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java +++ b/tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java @@ -19,6 +19,7 @@ package com.android.imftest.samples; import android.app.Activity; import android.app.KeyguardManager; import android.content.Context; +import android.content.res.Configuration; import android.os.SystemClock; import android.test.InstrumentationTestCase; import android.view.KeyEvent; @@ -43,7 +44,6 @@ public abstract class ImfBaseTestCase<T extends Activity> extends Instrumentatio public final int IME_MIN_HEIGHT = 150; public final int IME_MAX_HEIGHT = 300; - public final String TARGET_PACKAGE_NAME = "com.android.imftest"; protected InputMethodManager mImm; protected T mTargetActivity; protected boolean mExpectAutoPop; @@ -56,9 +56,12 @@ public abstract class ImfBaseTestCase<T extends Activity> extends Instrumentatio @Override public void setUp() throws Exception { super.setUp(); + final String packageName = getInstrumentation().getTargetContext().getPackageName(); + mTargetActivity = launchActivity(packageName, mTargetActivityClass, null); + // expect ime to auto pop up if device has no hard keyboard + mExpectAutoPop = mTargetActivity.getResources().getConfiguration().hardKeyboardHidden == + Configuration.HARDKEYBOARDHIDDEN_YES; - mTargetActivity = launchActivity(TARGET_PACKAGE_NAME, mTargetActivityClass, null); - mExpectAutoPop = mTargetActivity.getResources().getBoolean(R.bool.def_expect_ime_autopop); mImm = InputMethodManager.getInstance(mTargetActivity); KeyguardManager keyguardManager = @@ -104,9 +107,9 @@ public abstract class ImfBaseTestCase<T extends Activity> extends Instrumentatio } public void destructiveCheckImeInitialState(View rootView, View servedView) { - if (mExpectAutoPop && (mTargetActivity.getWindow().getAttributes(). - softInputMode&WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) - == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) { + int windowSoftInputMode = mTargetActivity.getWindow().getAttributes().softInputMode; + int adjustMode = windowSoftInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST; + if (mExpectAutoPop && adjustMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) { assertTrue(destructiveCheckImeUp(rootView, servedView)); } else { assertFalse(destructiveCheckImeUp(rootView, servedView)); |