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

ViewStubTest

public class ViewStubTest extends android.test.ActivityInstrumentationTestCase

Fields Summary
Constructors Summary
public ViewStubTest()

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

        super.setUp();
    
public voidtestInflated()

        final StubbedView activity = getActivity();

        final ViewStub stub = (ViewStub) activity.findViewById(R.id.viewStub);
        final View swapped = stub.inflate();

        assertNotNull("The inflated view is null", swapped);
    
public voidtestInflatedId()

        final StubbedView activity = getActivity();

        final ViewStub stub = (ViewStub) activity.findViewById(R.id.viewStubWithId);
        final View swapped = stub.inflate();

        assertNotNull("The inflated view is null", swapped);
        assertTrue("The inflated view has no id", swapped.getId() != View.NO_ID);
        assertTrue("The inflated view has the wrong id", swapped.getId() == R.id.stub_inflated);
    
public voidtestInflatedLayoutParams()

        final StubbedView activity = getActivity();

        final ViewStub stub = (ViewStub) activity.findViewById(R.id.viewStubWithId);
        final View swapped = stub.inflate();

        assertNotNull("The inflated view is null", swapped);

        assertEquals("Both stub and inflated should same width",
                stub.getLayoutParams().width, swapped.getLayoutParams().width);
        assertEquals("Both stub and inflated should same height",
                stub.getLayoutParams().height, swapped.getLayoutParams().height);
    
public voidtestStubbed()

        final StubbedView activity = getActivity();

        final View stub = activity.findViewById(R.id.viewStub);
        assertNotNull("The ViewStub does not exist", stub);