FileDocCategorySizeDatePackage
GlobalFocusChangeTest.javaAPI DocAndroid 1.5 API2638Wed May 06 22:42:02 BST 2009com.android.frameworktest.view

GlobalFocusChangeTest

public class GlobalFocusChangeTest extends android.test.ActivityInstrumentationTestCase

Fields Summary
private GlobalFocusChange
mActivity
private android.view.View
mLeft
private android.view.View
mRight
Constructors Summary
public GlobalFocusChangeTest()

        super("com.android.frameworktest", GlobalFocusChange.class);
    
Methods Summary
public voidsetUp()

        super.setUp();
        mActivity = getActivity();
        mLeft = mActivity.findViewById(R.id.left);
        mRight = mActivity.findViewById(R.id.right);
    
protected voidtearDown()

        mActivity.reset();
        super.tearDown();
    
public voidtestEnterTouchMode()

        assertTrue(mLeft.isFocused());

        TouchUtils.tapView(this, mLeft);

        assertSame(mLeft, mActivity.mOldFocus);
        assertSame(null, mActivity.mNewFocus);        
    
public voidtestFocusChange()

        sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);

        assertFalse(mLeft.isFocused());
        assertTrue(mRight.isFocused());

        assertSame(mLeft, mActivity.mOldFocus);
        assertSame(mRight, mActivity.mNewFocus);        
    
public voidtestLeaveTouchMode()

        assertTrue(mLeft.isFocused());

        TouchUtils.tapView(this, mLeft);
        sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);

        assertTrue(mLeft.isFocused());

        assertSame(null, mActivity.mOldFocus);
        assertSame(mLeft, mActivity.mNewFocus);