Methods Summary |
---|
public void | setUp()
super.setUp();
final FocusAfterRemoval a = getActivity();
mLeftLayout = (LinearLayout) a.findViewById(R.id.leftLayout);
mTopLeftButton = (Button) a.findViewById(R.id.topLeftButton);
mBottomLeftButton = (Button) a.findViewById(R.id.bottomLeftButton);
mTopRightButton = (Button) a.findViewById(R.id.topRightButton);
mBottomRightButton = (Button) a.findViewById(R.id.bottomRightButton);
|
public void | testFocusLeavesWhenFocusedViewBecomesGone()
// move to top right
sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);
assertTrue(mTopRightButton.hasFocus());
// click making it GONE
sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
assertEquals(View.GONE, mTopRightButton.getVisibility());
assertTrue("focus should jump to visible button",
mTopLeftButton.hasFocus());
|
public void | testFocusLeavesWhenFocusedViewBecomesInvisible()
// move to bottom right
sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
assertTrue(mBottomRightButton.hasFocus());
// click making it INVISIBLE
sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
assertEquals(View.INVISIBLE, mBottomRightButton.getVisibility());
assertTrue("focus should jump to visible button",
mTopLeftButton.hasFocus());
|
public void | testFocusLeavesWhenParentLayoutInvisible()
// move down to bottom left button
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
assertTrue(mBottomLeftButton.hasFocus());
// clicking on this button makes its parent linear layout INVISIBLE
sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
assertEquals(View.INVISIBLE,
getActivity().findViewById(R.id.leftLayout).getVisibility());
assertTrue("focus should jump to visible button",
mTopRightButton.hasFocus());
|
public void | testFocusLeavesWhenParentLayoutIsGone()
// clicking on this button makes its parent linear layout GONE
sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
assertEquals(View.GONE, mLeftLayout.getVisibility());
assertTrue("focus should jump to visible button",
mTopRightButton.hasFocus());
|
public void | testSetUpConditions()
assertNotNull(mLeftLayout);
assertNotNull(mTopLeftButton);
assertNotNull(mTopRightButton);
assertNotNull(mBottomLeftButton);
assertNotNull(mBottomRightButton);
assertTrue(mTopLeftButton.hasFocus());
|