FileDocCategorySizeDatePackage
SetTagsTest.javaAPI DocAndroid 5.1 API3379Thu Mar 12 22:22:12 GMT 2015android.view

SetTagsTest

public class SetTagsTest extends android.test.ActivityInstrumentationTestCase2
Exercises {@link android.view.View}'s tags property.

Fields Summary
private android.widget.Button
mView
Constructors Summary
public SetTagsTest()

        super("com.android.frameworks.coretests", Disabled.class);
    
Methods Summary
public voidsetUp()

        super.setUp();

        mView = (Button) getActivity().findViewById(R.id.disabledButton);
    
public voidtestGetTag()

        Object o = new Object();
        mView.setTag(o);

        final Object stored = mView.getTag();
        assertNotNull(stored);
        assertSame("The stored tag is inccorect", o, stored);
    
public voidtestGetTagWithKey()

        Object o = new Object();
        mView.setTag(R.id.a, o);

        final Object stored = mView.getTag(R.id.a);
        assertNotNull(stored);
        assertSame("The stored tag is inccorect", o, stored);
    
public voidtestSetTag()

        mView.setTag("1");
    
public voidtestSetTagInternalWithApplicationId()

        boolean result = false;
        try {
            mView.setTagInternal(R.id.a, "2");
        } catch (IllegalArgumentException e) {
            result = true;
        }
        assertTrue("Setting a tag with an id with app package did not throw an exception", result);
    
public voidtestSetTagInternalWithFrameworkId()

        mView.setTagInternal(android.R.id.list, "2");
    
public voidtestSetTagWithFrameworkId()

        boolean result = false;
        try {
            mView.setTag(android.R.id.list, "2");
        } catch (IllegalArgumentException e) {
            result = true;
        }
        assertTrue("Setting a tag with a framework id did not throw an exception", result);
    
public voidtestSetTagWithKey()

        mView.setTag(R.id.a, "2");
    
public voidtestSetTagWithNoPackageId()

        boolean result = false;
        try {
            mView.setTag(0x000000AA, "2");
        } catch (IllegalArgumentException e) {
            result = true;
        }
        assertTrue("Setting a tag with an id with no package did not throw an exception", result);
    
public voidtestSetUpConditions()

        assertNotNull(mView);