FileDocCategorySizeDatePackage
AccountSetupNamesTests.javaAPI DocAndroid 1.5 API2521Wed May 06 22:42:46 BST 2009com.android.email.activity.setup

AccountSetupNamesTests

public class AccountSetupNamesTests extends android.test.ActivityInstrumentationTestCase2
Tests of basic UI logic in the AccountSetupNamesTest screen.

Fields Summary
private AccountSetupNames
mActivity
private android.widget.Button
mDoneButton
Constructors Summary
public AccountSetupNamesTests()

        super("com.android.email", AccountSetupNames.class);
    
Methods Summary
private voidgetActivityAndFields()
Get the activity (which causes it to be started, using our intent) and get the UI fields

        mActivity = getActivity();
        mDoneButton = (Button) mActivity.findViewById(R.id.done);
    
private android.content.IntentgetTestIntent(java.lang.String name)
Create an intent with the Account in it

        Account account = new Account(this.getInstrumentation().getTargetContext());
        account.setName(name);
        Intent i = new Intent(Intent.ACTION_MAIN);
        i.putExtra("account", account);     // AccountSetupNames.EXTRA_ACCOUNT == "account"
        return i;
    
public voidtestBadAccountName()
Test a "bad" account name (disables the button)

        Intent i = getTestIntent("");
        this.setActivityIntent(i);
        
        getActivityAndFields();
        
        assertFalse(mDoneButton.isEnabled());
    
public voidtestGoodAccountName()
Test a "good" account name (enables the button)

        Intent i = getTestIntent("GoodName");
        this.setActivityIntent(i);
        
        getActivityAndFields();
        
        assertTrue(mDoneButton.isEnabled());