ListHorizontalFocusWithinItemWinsTestpublic class ListHorizontalFocusWithinItemWinsTest extends android.test.ActivityInstrumentationTestCase
Fields Summary |
---|
private android.widget.ListView | mListView | private android.widget.Button | mTopLeftButton | private android.widget.Button | mTopRightButton | private android.widget.Button | mBottomMiddleButton |
Constructors Summary |
---|
public ListHorizontalFocusWithinItemWinsTest()
super("com.android.frameworktest", ListHorizontalFocusWithinItemWins.class);
|
Methods Summary |
---|
protected void | setUp()
super.setUp();
mListView = getActivity().getListView();
mTopLeftButton = getActivity().getTopLeftButton();
mTopRightButton = getActivity().getTopRightButton();
mBottomMiddleButton = getActivity().getBottomMiddleButton();
| public void | testOptionWithinItemTrumpsGlobal()
sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);
assertEquals("list position", 0, mListView.getSelectedItemPosition());
assertTrue("mTopRightButton.isFocused()", mTopRightButton.isFocused());
sendKeys(KeyEvent.KEYCODE_DPAD_LEFT);
assertEquals("list position", 0, mListView.getSelectedItemPosition());
assertTrue("mTopLeftButton.isFocused()", mTopLeftButton.isFocused());
| public void | testPreconditions()
assertEquals("list position", 0, mListView.getSelectedItemPosition());
assertTrue("mTopLeftButton.isFocused()", mTopLeftButton.isFocused());
assertEquals("global focus search to right from top left is bottom middle",
mBottomMiddleButton,
FocusFinder.getInstance().findNextFocus(mListView, mTopLeftButton, View.FOCUS_RIGHT));
assertEquals("global focus search to left from top right is bottom middle",
mBottomMiddleButton,
FocusFinder.getInstance().findNextFocus(mListView, mTopRightButton, View.FOCUS_LEFT));
|
|