Search in sources :

Example 1 with LazyApplication

use of org.robolectric.annotation.experimental.LazyApplication in project robolectric by robolectric.

the class AndroidTestEnvironmentTest method systemResources_getDisplayMetrics_correctValues.

@LazyApplication(LazyLoad.ON)
@Test
@Config(qualifiers = "w480dp-h640dp-land-hdpi")
public void systemResources_getDisplayMetrics_correctValues() {
    bootstrapWrapper.callSetUpApplicationState();
    DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
    assertThat(displayMetrics.densityDpi).isEqualTo(DisplayMetrics.DENSITY_HIGH);
    assertThat(RuntimeEnvironment.getQualifiers()).contains("w640dp-h480dp");
    assertThat(RuntimeEnvironment.getQualifiers()).contains("land");
}
Also used : DisplayMetrics(android.util.DisplayMetrics) Test(org.junit.Test) Config(org.robolectric.annotation.Config) DeviceConfig(org.robolectric.android.DeviceConfig) LazyApplication(org.robolectric.annotation.experimental.LazyApplication)

Aggregations

DisplayMetrics (android.util.DisplayMetrics)1 Test (org.junit.Test)1 DeviceConfig (org.robolectric.android.DeviceConfig)1 Config (org.robolectric.annotation.Config)1 LazyApplication (org.robolectric.annotation.experimental.LazyApplication)1