FileDocCategorySizeDatePackage
FocusableInTouchModeClickTest.javaAPI DocAndroid 5.1 API2392Thu Mar 12 22:22:12 GMT 2015android.widget.touchmode

FocusableInTouchModeClickTest

public class FocusableInTouchModeClickTest extends android.test.ActivityInstrumentationTestCase2

Fields Summary
Constructors Summary
public FocusableInTouchModeClickTest()

        super("com.android.frameworks.coretests", LLOfTwoFocusableInTouchMode.class);
    
Methods Summary
protected voidsetUp()

        super.setUp();
        setActivityInitialTouchMode(true);
    
public voidtestClickGivesFocusNoClickFired()

        TouchUtils.clickView(this, getActivity().getButton2());
        assertTrue("click should give focusable in touch mode focus",
                getActivity().getButton2().isFocused());
        assertFalse("getting focus should result in no on click",
                getActivity().isB2Fired());

        TouchUtils.clickView(this, getActivity().getButton2());
        assertTrue("subsequent click while focused should fire on click",
                getActivity().isB2Fired());
    
public voidtestPreconditions()

        assertTrue("should start in touch mode", getActivity().getButton1().isInTouchMode());
        assertTrue(getActivity().getButton1().isFocused());
    
public voidtestTapGivesFocusNoClickFired()

        TouchUtils.touchAndCancelView(this, getActivity().getButton2());
        assertFalse("button shouldn't have fired click", getActivity().isB2Fired());
        assertFalse("button shouldn't have focus", getActivity().getButton2().isFocused());