Merge "IME test fixes." into froyo
This commit is contained in:
@@ -55,7 +55,11 @@ public class OneEditTextActivitySelected extends Activity
|
|||||||
|
|
||||||
((ScrollView) mRootView).addView(layout);
|
((ScrollView) mRootView).addView(layout);
|
||||||
setContentView(mRootView);
|
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() {
|
public View getRootView() {
|
||||||
return mRootView;
|
return mRootView;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.imftest.samples;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.test.InstrumentationTestCase;
|
import android.test.InstrumentationTestCase;
|
||||||
import android.view.KeyEvent;
|
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_MIN_HEIGHT = 150;
|
||||||
public final int IME_MAX_HEIGHT = 300;
|
public final int IME_MAX_HEIGHT = 300;
|
||||||
|
|
||||||
public final String TARGET_PACKAGE_NAME = "com.android.imftest";
|
|
||||||
protected InputMethodManager mImm;
|
protected InputMethodManager mImm;
|
||||||
protected T mTargetActivity;
|
protected T mTargetActivity;
|
||||||
protected boolean mExpectAutoPop;
|
protected boolean mExpectAutoPop;
|
||||||
@@ -56,9 +56,12 @@ public abstract class ImfBaseTestCase<T extends Activity> extends Instrumentatio
|
|||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
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);
|
mImm = InputMethodManager.getInstance(mTargetActivity);
|
||||||
|
|
||||||
KeyguardManager keyguardManager =
|
KeyguardManager keyguardManager =
|
||||||
@@ -104,9 +107,9 @@ public abstract class ImfBaseTestCase<T extends Activity> extends Instrumentatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void destructiveCheckImeInitialState(View rootView, View servedView) {
|
public void destructiveCheckImeInitialState(View rootView, View servedView) {
|
||||||
if (mExpectAutoPop && (mTargetActivity.getWindow().getAttributes().
|
int windowSoftInputMode = mTargetActivity.getWindow().getAttributes().softInputMode;
|
||||||
softInputMode&WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST)
|
int adjustMode = windowSoftInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
|
||||||
== WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) {
|
if (mExpectAutoPop && adjustMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) {
|
||||||
assertTrue(destructiveCheckImeUp(rootView, servedView));
|
assertTrue(destructiveCheckImeUp(rootView, servedView));
|
||||||
} else {
|
} else {
|
||||||
assertFalse(destructiveCheckImeUp(rootView, servedView));
|
assertFalse(destructiveCheckImeUp(rootView, servedView));
|
||||||
|
|||||||
Reference in New Issue
Block a user