FileDocCategorySizeDatePackage
ListViewHeightTest.javaAPI DocAndroid 5.1 API2887Thu Mar 12 22:22:12 GMT 2015android.widget.listview

ListViewHeightTest

public class ListViewHeightTest extends android.test.ActivityInstrumentationTestCase

Fields Summary
private android.widget.listview.ListViewHeight
mActivity
Constructors Summary
public ListViewHeightTest()

        super("com.android.frameworks.coretests", ListViewHeight.class);
    
Methods Summary
protected voidsetUp()

        super.setUp();

        mActivity = getActivity();
    
public voidtestButtons()

        Instrumentation inst = getInstrumentation();
        final Button button1 = (Button) mActivity.findViewById(R.id.button1);
        final Button button2 = (Button) mActivity.findViewById(R.id.button2);
        final Button button3 = (Button) mActivity.findViewById(R.id.button3);
        

        ListView list = (ListView) mActivity.findViewById(R.id.inner_list);
        assertEquals("Unexpected items in adapter", 0, list.getCount());
        assertEquals("Unexpected children in list view", 0, list.getChildCount());
        
        mActivity.runOnUiThread(new Runnable() {
            public void run() {
                button1.performClick();
            }
        });
        inst.waitForIdleSync();
        assertTrue("List not be visible after clicking button1", list.isShown());
        assertTrue("List incorrect height", list.getHeight() == 200);
        
        mActivity.runOnUiThread(new Runnable() {
            public void run() {
                button2.performClick();
            }
        });
        inst.waitForIdleSync();
        assertTrue("List not be visible after clicking button2", list.isShown());

        mActivity.runOnUiThread(new Runnable() {
            public void run() {
                button3.performClick();
            }
        });
        inst.waitForIdleSync();
        assertFalse("List should not be visible clicking button3", list.isShown());
    
public voidtestPreconditions()

        assertNotNull(mActivity);