Search in sources :

Example 1 with CustomView

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

the class ShadowLayoutInflaterTest method shouldConstructCustomViewsWithAttributesConstructor.

@Test
public void shouldConstructCustomViewsWithAttributesConstructor() throws Exception {
    int layoutResId = context.getResources().getIdentifier("custom_layout", "layout", TEST_PACKAGE);
    CustomView view = (CustomView) LayoutInflater.from(context).inflate(layoutResId, null);
    assertThat(view.attributeResourceValue).isEqualTo(R.string.hello);
}
Also used : CustomView(org.robolectric.android.CustomView) Test(org.junit.Test)

Example 2 with CustomView

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

the class ShadowLayoutInflaterTest method shouldConstructCustomViewsWithAttributesInResAutoNamespace.

@Test
public void shouldConstructCustomViewsWithAttributesInResAutoNamespace() throws Exception {
    int layoutResId = context.getResources().getIdentifier("custom_layout5", "layout", TEST_PACKAGE);
    CustomView view = (CustomView) LayoutInflater.from(context).inflate(layoutResId, null);
    assertThat(view.attributeResourceValue).isEqualTo(R.string.hello);
}
Also used : CustomView(org.robolectric.android.CustomView) Test(org.junit.Test)

Example 3 with CustomView

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

the class ShadowLayoutInflaterTest method shouldConstructCustomViewsWithAttributesWithURLEncodedNamespaces.

@Test
public void shouldConstructCustomViewsWithAttributesWithURLEncodedNamespaces() throws Exception {
    int layoutResId = context.getResources().getIdentifier("custom_layout4", "layout", TEST_PACKAGE);
    CustomView view = (CustomView) LayoutInflater.from(context).inflate(layoutResId, null).findViewById(R.id.custom_view);
    assertThat(view.namespacedResourceValue).isEqualTo(R.layout.text_views);
}
Also used : CustomView(org.robolectric.android.CustomView) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 CustomView (org.robolectric.android.CustomView)3