Search in sources :

Example 1 with CustomStateView

use of org.robolectric.android.CustomStateView in project robolectric by robolectric.

the class ShadowLayoutInflaterTest method shouldConstructCustomViewsWithCustomState.

@Test
public void shouldConstructCustomViewsWithCustomState() throws Exception {
    int layoutResId = context.getResources().getIdentifier("custom_layout6", "layout", TEST_PACKAGE);
    CustomStateView view = (CustomStateView) LayoutInflater.from(context).inflate(layoutResId, null);
    assertThat(view.getDrawableState()).doesNotContain(R.attr.stateFoo);
    view.isFoo = true;
    view.refreshDrawableState();
    assertThat(view.getDrawableState()).contains(R.attr.stateFoo);
}
Also used : CustomStateView(org.robolectric.android.CustomStateView) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CustomStateView (org.robolectric.android.CustomStateView)1