use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowDrawableTest method drawableShouldLoadImageOfCorrectSizeWithHdpiQualifier.
@Test
@Config(qualifiers = "hdpi")
public void drawableShouldLoadImageOfCorrectSizeWithHdpiQualifier() {
final Drawable anImage = RuntimeEnvironment.application.getResources().getDrawable(R.drawable.robolectric);
assertThat(anImage.getIntrinsicHeight()).isEqualTo(251);
assertThat(anImage.getIntrinsicWidth()).isEqualTo(297);
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowEnvironmentTest method isExternalStorageRemovable_shouldReturnSavedValue.
@Test
@Config(minSdk = LOLLIPOP)
public void isExternalStorageRemovable_shouldReturnSavedValue() {
final File file = new File("/mnt/media/file");
assertThat(Environment.isExternalStorageRemovable(file)).isFalse();
ShadowEnvironment.setExternalStorageRemovable(file, true);
assertThat(Environment.isExternalStorageRemovable(file)).isTrue();
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowEnvironmentTest method reset_shouldClearEmulatedFiles.
@Test
@Config(minSdk = LOLLIPOP)
public void reset_shouldClearEmulatedFiles() {
final File file = new File("foo");
ShadowEnvironment.setExternalStorageEmulated(file, true);
assertThat(Environment.isExternalStorageEmulated(file)).isTrue();
ShadowEnvironment.reset();
assertThat(Environment.isExternalStorageEmulated(file)).isFalse();
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowEnvironmentTest method isExternalStorageEmulated_shouldReturnSavedValue.
@Test
@Config(minSdk = LOLLIPOP)
public void isExternalStorageEmulated_shouldReturnSavedValue() {
final File file = new File("/mnt/media/file");
assertThat(Environment.isExternalStorageEmulated(file)).isFalse();
ShadowEnvironment.setExternalStorageEmulated(file, true);
assertThat(Environment.isExternalStorageEmulated(file)).isTrue();
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowIntentTest method resolveActivityInfo_shouldReturnActivityInfoForExistingActivity.
@Test
@Config(manifest = "src/test/resources/TestAndroidManifestForActivities.xml")
public void resolveActivityInfo_shouldReturnActivityInfoForExistingActivity() {
Context context = RuntimeEnvironment.application;
PackageManager packageManager = context.getPackageManager();
Intent intent = new Intent();
intent.setClassName(context, TEST_ACTIVITY_CLASS_NAME);
ActivityInfo activityInfo = intent.resolveActivityInfo(packageManager, PackageManager.GET_ACTIVITIES);
assertThat(activityInfo).isNotNull();
}
Aggregations