FileDocCategorySizeDatePackage
DisabledTest.javaAPI DocAndroid 5.1 API2879Thu Mar 12 22:22:12 GMT 2015android.view

DisabledTest

public class DisabledTest extends android.test.ActivityInstrumentationTestCase
Exercises {@link android.view.View}'s disabled property.

Fields Summary
private android.widget.Button
mDisabled
private android.view.View
mDisabledParent
private boolean
mClicked
private boolean
mParentClicked
Constructors Summary
public DisabledTest()

        super("com.android.frameworks.coretests", Disabled.class);
    
Methods Summary
public voidsetUp()

        super.setUp();

        final Disabled a = getActivity();
        mDisabled = (Button) a.findViewById(R.id.disabledButton);
        mDisabled.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                mClicked = true;
            }
        });

        mDisabledParent = a.findViewById(R.id.clickableParent);
        mDisabledParent.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                mParentClicked = true;
            }
        });
    
protected voidtearDown()

        super.tearDown();

        mClicked = false;
        mParentClicked = false;
    
public voidtestKeypadClick()

        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
        getInstrumentation().waitForIdleSync();
        assertFalse(mClicked);
        assertFalse(mParentClicked);
    
public voidtestSetUpConditions()

        assertNotNull(mDisabled);
        assertNotNull(mDisabledParent);
        assertFalse(mDisabled.isEnabled());
        assertTrue(mDisabledParent.isEnabled());
        assertTrue(mDisabled.hasFocus());
    
public voidtestTouchClick()

        TouchUtils.clickView(this, mDisabled);
        getInstrumentation().waitForIdleSync();
        assertFalse(mClicked);
        assertFalse(mParentClicked);