TouchModeFocusChangeTestpublic class TouchModeFocusChangeTest extends android.test.ActivityInstrumentationTestCase Make sure focus isn't kept by buttons when entering touch mode.
When in touch mode and hitting the d-pad, we should leave touch mode and the
top most focusable gets focus. |
Fields Summary |
---|
private com.android.frameworktest.layout.linear.LLOfButtons1 | mActivity | private android.widget.Button | mFirstButton |
Constructors Summary |
---|
public TouchModeFocusChangeTest()
super("com.android.frameworktest", LLOfButtons1.class);
|
Methods Summary |
---|
public void | DISABLE_testLeaveTouchModeWithDpadEvent()
assertInTouchModeAfterClick(this, mFirstButton);
assertTrue("should be in touch mode", mActivity.isInTouchMode());
assertFalse("button should not have focus when touched",
mFirstButton.isFocused());
assertNotInTouchModeAfterKey(this, KeyEvent.KEYCODE_DPAD_RIGHT, mFirstButton);
assertFalse("should be out of touch mode", mActivity.isInTouchMode());
assertTrue("first button (the top most focusable) should have gained focus",
mFirstButton.isFocused());
| protected void | setUp()
super.setUp();
mActivity = getActivity();
mFirstButton = mActivity.getFirstButton();
| public void | testPreconditions()
assertFalse("we should not be in touch mode", mActivity.isInTouchMode());
assertTrue("top button should have focus", mFirstButton.isFocused());
| public void | testTouchButtonNotTakeFocus()
assertInTouchModeAfterTap(this, mFirstButton);
assertTrue("should be in touch mode", mActivity.isInTouchMode());
assertFalse("button.isFocused",
mFirstButton.isFocused());
assertFalse("button.hasFocus",
mFirstButton.hasFocus());
assertNull("activity shouldn't have focus", mActivity.getCurrentFocus());
assertFalse("linear layout should not have focus",
mActivity.getLayout().hasFocus());
assertTrue("button's onClickListener should have fired",
mActivity.buttonClickListenerFired());
|
|