FileDocCategorySizeDatePackage
LongpressTest.javaAPI DocAndroid 5.1 API2563Thu Mar 12 22:22:12 GMT 2015android.view

LongpressTest

public class LongpressTest extends android.test.ActivityInstrumentationTestCase
Exercises {@link android.view.View}'s longpress plumbing.

Fields Summary
private android.view.View
mSimpleView
private boolean
mLongClicked
Constructors Summary
public LongpressTest()

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

        super.setUp();

        final Longpress a = getActivity();
        mSimpleView = a.findViewById(R.id.simple_view);
        mSimpleView.setOnLongClickListener(new OnLongClickListener() {
            public boolean onLongClick(View v) {
                mLongClicked = true;
                return true;
            }
        });
    
protected voidtearDown()

        super.tearDown();

        mLongClicked = false;
    
public voidtestKeypadLongClick()

        mSimpleView.requestFocus();
        getInstrumentation().waitForIdleSync();
        KeyUtils.longClick(this);
        
        getInstrumentation().waitForIdleSync();
        assertTrue(mLongClicked);
    
public voidtestSetUpConditions()

        assertNotNull(mSimpleView);
        assertTrue(mSimpleView.hasFocus());
        assertFalse(mLongClicked);
    
public voidtestTouchLongClick()

        TouchUtils.longClickView(this, mSimpleView);
        getInstrumentation().waitForIdleSync();
        assertTrue(mLongClicked);