Code example for Button

Methods: isFocused

0
    } 
 
    @MediumTest 
    public void testPreconditions() { 
        assertFalse("we should not be in touch mode", mActivity.isInTouchMode());
        assertTrue("top button should have focus", mFirstButton.isFocused());
    } 
 
    @MediumTest 
    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());