TallTextAboveButtonTestpublic class TallTextAboveButtonTest extends android.test.ActivityInstrumentationTestCase
Fields Summary |
---|
private android.widget.ScrollView | mScrollView | private android.widget.TextView | mTopText | private android.widget.TextView | mBottomButton |
Constructors Summary |
---|
public TallTextAboveButtonTest()
super("com.android.frameworktest", TallTextAboveButton.class);
|
Methods Summary |
---|
protected void | setUp()
super.setUp();
mScrollView = getActivity().getScrollView();
mTopText = getActivity().getContentChildAt(0);
mBottomButton = getActivity().getContentChildAt(1);
| public void | testGainFocusAsScrolledOntoScreen()
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
assertTrue("button should have scrolled onto screen",
mBottomButton.getBottom() >= mScrollView.getBottom());
assertTrue("button should have gained focus as it was scrolled completely "
+ "into view", mBottomButton.isFocused());
sendKeys(KeyEvent.KEYCODE_DPAD_UP);
assertTrue("scroll view should have focus, but " + getActivity().getScrollView().findFocus() + " does instead",
getActivity().getScrollView().isFocused());
| public void | testPreconditions()
assertTrue("top text should be larger than screen",
mTopText.getHeight() > mScrollView.getHeight());
assertTrue("scroll view should have focus (because nothing else focusable "
+ "is on screen), but " + getActivity().getScrollView().findFocus() + " does instead",
getActivity().getScrollView().isFocused());
| public void | testScrollingButtonOffScreenLosesFocus()
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
assertTrue("button should have focus", mBottomButton.isFocused());
sendKeys(KeyEvent.KEYCODE_DPAD_UP);
assertTrue("scroll view should have focus, but " + getActivity().getScrollView().findFocus() + " does instead",
getActivity().getScrollView().isFocused());
|
|