FileDocCategorySizeDatePackage
DrawableBgMinSizeTest.javaAPI DocAndroid 5.1 API5512Thu Mar 12 22:22:12 GMT 2015android.view

DrawableBgMinSizeTest

public class DrawableBgMinSizeTest extends android.test.ActivityInstrumentationTestCase
{@link DrawableBgMinSize} exercises Views to obey their background drawable's minimum sizes.

Fields Summary
private android.widget.Button
mChangeBackgroundsButton
private android.graphics.drawable.Drawable
mBackgroundDrawable
private android.graphics.drawable.Drawable
mBigBackgroundDrawable
private android.widget.TextView
mTextView
private android.widget.LinearLayout
mLinearLayout
private android.widget.RelativeLayout
mRelativeLayout
private android.widget.FrameLayout
mFrameLayout
private android.widget.AbsoluteLayout
mAbsoluteLayout
Constructors Summary
public DrawableBgMinSizeTest()

        super("com.android.frameworks.coretests", DrawableBgMinSize.class);
    
Methods Summary
public voiddoDiffBgMinimumSizeTest(android.view.View view)

        // Change to the bigger backgrounds
        TouchUtils.tapView(this, mChangeBackgroundsButton);

        assertTrue(view.getClass().getSimpleName()
                + " should respect the different bigger background Drawable's minimum width", view
                .getWidth() >= mBigBackgroundDrawable.getMinimumWidth());
        assertTrue(view.getClass().getSimpleName()
                + " should respect the different bigger background Drawable's minimum height", view
                .getHeight() >= mBigBackgroundDrawable.getMinimumHeight());
    
public voiddoMinimumSizeTest(android.view.View view)

        assertTrue(view.getClass().getSimpleName() + " should respect the background Drawable's minimum width",
                view.getWidth() >= mBackgroundDrawable.getMinimumWidth());
        assertTrue(view.getClass().getSimpleName() + " should respect the background Drawable's minimum height",
                view.getHeight() >= mBackgroundDrawable.getMinimumHeight());
    
protected voidsetUp()

        super.setUp();

        final DrawableBgMinSize a = getActivity();

        mChangeBackgroundsButton = (Button) a.findViewById(R.id.change_backgrounds);
        mBackgroundDrawable = a.getResources().getDrawable(R.drawable.drawable_background);
        mBigBackgroundDrawable = a.getResources().getDrawable(R.drawable.big_drawable_background);
        mTextView = (TextView) a.findViewById(R.id.text_view);
        mLinearLayout = (LinearLayout) a.findViewById(R.id.linear_layout);
        mRelativeLayout = (RelativeLayout) a.findViewById(R.id.relative_layout);
        mFrameLayout = (FrameLayout) a.findViewById(R.id.frame_layout);
        mAbsoluteLayout = (AbsoluteLayout) a.findViewById(R.id.absolute_layout);
    
public voidtestAbsoluteLayoutDiffBgMinimumSize()

        doDiffBgMinimumSizeTest(mAbsoluteLayout);
    
public voidtestAbsoluteLayoutMinimumSize()

        doMinimumSizeTest(mAbsoluteLayout);
    
public voidtestFrameLayoutDiffBgMinimumSize()

        doDiffBgMinimumSizeTest(mFrameLayout);
    
public voidtestFrameLayoutMinimumSize()

        doMinimumSizeTest(mFrameLayout);
    
public voidtestLinearLayoutDiffBgMinimumSize()

        doDiffBgMinimumSizeTest(mLinearLayout);
    
public voidtestLinearLayoutMinimumSize()

        doMinimumSizeTest(mLinearLayout);
    
public voidtestRelativeLayoutDiffBgMinimumSize()

        doDiffBgMinimumSizeTest(mRelativeLayout);
    
public voidtestRelativeLayoutMinimumSize()

        doMinimumSizeTest(mRelativeLayout);
    
public voidtestSetUpConditions()

        assertNotNull(mChangeBackgroundsButton);
        assertNotNull(mBackgroundDrawable);
        assertNotNull(mBigBackgroundDrawable);
        assertNotNull(mTextView);
        assertNotNull(mLinearLayout);
        assertNotNull(mRelativeLayout);
        assertNotNull(mFrameLayout);
        assertNotNull(mAbsoluteLayout);
    
public voidtestTextViewDiffBgMinimumSize()

        doDiffBgMinimumSizeTest(mTextView);
    
public voidtestTextViewMinimumSize()

        doMinimumSizeTest(mTextView);