FileDocCategorySizeDatePackage
ChangeTouchModeTest.javaAPI DocAndroid 1.5 API4539Wed May 06 22:42:02 BST 2009com.android.frameworktest.touchmode

ChangeTouchModeTest

public class ChangeTouchModeTest extends android.test.ActivityInstrumentationTestCase
Tests that the touch mode changes from various events, and that the state persists across activities.

Fields Summary
Constructors Summary
public ChangeTouchModeTest()

        super("com.android.frameworktest", LLOfButtons1.class);
    
Methods Summary
public voidDISABLE_testDpadDirectionLeavesTouchMode()

        assertInTouchModeAfterClick(this, getActivity().getFirstButton());
        sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);
        assertNotInTouchModeAfterKey(this, KeyEvent.KEYCODE_DPAD_RIGHT, getActivity().getFirstButton());
        assertFalse("touch mode", getActivity().isInTouchMode());
    
public voidTODO_touchTrackBallMovementLeavesTouchMode()


    
protected voidsetUp()

        super.setUp();
    
public voidtestPreconditions()

        assertFalse("touch mode", getActivity().isInTouchMode());
    
public voidtestTouchModeChangedInOtherActivity()


        assertFalse("touch mode", getActivity().isInTouchMode());

        LLOfButtons2 otherActivity = null;
        try {
            otherActivity =
                    launchActivity("com.android.frameworktest", LLOfButtons2.class, null);
            assertNotNull(otherActivity);
            assertFalse(otherActivity.isInTouchMode());
            assertInTouchModeAfterClick(this, otherActivity.getFirstButton());
            assertTrue(otherActivity.isInTouchMode());
        } finally {
            if (otherActivity != null) {
                otherActivity.finish();
            }
        }

        // need to wait for async update back to window to occur
        Thread.sleep(200);
        
        assertTrue("touch mode", getActivity().isInTouchMode());
    
public voidtestTouchModeFalseAcrossActivites()


        getInstrumentation().waitForIdleSync();

        LLOfButtons2 otherActivity = null;
        try {
            otherActivity =
                    launchActivity("com.android.frameworktest", LLOfButtons2.class, null);
            assertNotNull(otherActivity);
            assertFalse(otherActivity.isInTouchMode());
        } finally {
            if (otherActivity != null) {
                otherActivity.finish();
            }
        }
    
public voidtestTouchModeTrueAcrossActivites()

        assertInTouchModeAfterClick(this, getActivity().getFirstButton());
        LLOfButtons2 otherActivity = null;
        try {
            otherActivity =
                    launchActivity("com.android.frameworktest", LLOfButtons2.class, null);
            assertNotNull(otherActivity);
            assertTrue(otherActivity.isInTouchMode());
        } finally {
            if (otherActivity != null) {
                otherActivity.finish();
            }
        }
    
public voidtestTouchingScreenEntersTouchMode()

        assertInTouchModeAfterTap(this, getActivity().getFirstButton());
        assertTrue("touch mode", getActivity().isInTouchMode());