use of org.robolectric.shadows.testing.TestActivity in project robolectric by robolectric.
the class ShadowThemeTest method whenNotSetOnActivityInManifest_activityGetsThemeFromApplicationInManifest.
@Test
public void whenNotSetOnActivityInManifest_activityGetsThemeFromApplicationInManifest() {
TestActivity activity = buildActivity(TestActivity.class).create().get();
Button theButton = activity.findViewById(R.id.button);
ColorDrawable background = (ColorDrawable) theButton.getBackground();
assertThat(background.getColor()).isEqualTo(0xff00ff00);
}
use of org.robolectric.shadows.testing.TestActivity in project robolectric by robolectric.
the class ShadowThemeTest method whenExplicitlySetOnActivity_afterSetContentView_activityGetsThemeFromActivityInManifest.
@Test
public void whenExplicitlySetOnActivity_afterSetContentView_activityGetsThemeFromActivityInManifest() {
TestActivity activity = buildActivity(TestActivityWithAnotherTheme.class).create().get();
activity.setTheme(R.style.Theme_Robolectric);
Button theButton = activity.findViewById(R.id.button);
ColorDrawable background = (ColorDrawable) theButton.getBackground();
assertThat(background.getColor()).isEqualTo(0xffff0000);
}
use of org.robolectric.shadows.testing.TestActivity in project robolectric by robolectric.
the class ShadowThemeTest method whenExplicitlySetOnActivity_beforeSetContentView_activityUsesNewTheme.
@Test
public void whenExplicitlySetOnActivity_beforeSetContentView_activityUsesNewTheme() {
ActivityController<TestActivityWithAnotherTheme> activityController = buildActivity(TestActivityWithAnotherTheme.class);
TestActivity activity = activityController.get();
activity.setTheme(R.style.Theme_Robolectric);
activityController.create();
Button theButton = activity.findViewById(R.id.button);
ColorDrawable background = (ColorDrawable) theButton.getBackground();
assertThat(background.getColor()).isEqualTo(0xff00ff00);
}
use of org.robolectric.shadows.testing.TestActivity in project robolectric by robolectric.
the class ShadowThemeTest method shouldResolveReferencesThatStartWithAQuestionMark.
@Test
public void shouldResolveReferencesThatStartWithAQuestionMark() {
TestActivity activity = buildActivity(TestActivityWithAnotherTheme.class).create().get();
Button theButton = activity.findViewById(R.id.button);
assertThat(theButton.getMinWidth()).isEqualTo(8);
assertThat(theButton.getMinHeight()).isEqualTo(8);
}
use of org.robolectric.shadows.testing.TestActivity in project robolectric by robolectric.
the class ShadowThemeTest method whenSetOnActivityInManifest_activityGetsThemeFromActivityInManifest.
@Test
public void whenSetOnActivityInManifest_activityGetsThemeFromActivityInManifest() {
TestActivity activity = buildActivity(TestActivityWithAnotherTheme.class).create().get();
Button theButton = activity.findViewById(R.id.button);
ColorDrawable background = (ColorDrawable) theButton.getBackground();
assertThat(background.getColor()).isEqualTo(0xffff0000);
}
Aggregations