use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowNotificationBuilderTest method build_whenShowWhenNotSet_setsShowWhenOnNotificationToTrue.
@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void build_whenShowWhenNotSet_setsShowWhenOnNotificationToTrue() {
Notification notification = builder.setWhen(100).setShowWhen(true).build();
assertThat(shadowOf(notification).isWhenShown()).isTrue();
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowNotificationBuilderTest method build_setsUsesChronometerOnNotification_false.
@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void build_setsUsesChronometerOnNotification_false() throws Exception {
Notification notification = builder.setUsesChronometer(false).setWhen(10).setShowWhen(true).build();
assertThat(shadowOf(notification).usesChronometer()).isFalse();
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowNotificationBuilderTest method withBigPictureStyle.
@Test
@Config(minSdk = M)
public void withBigPictureStyle() {
Bitmap bigPicture = BitmapFactory.decodeResource(RuntimeEnvironment.application.getResources(), R.drawable.an_image);
Icon bigLargeIcon = Icon.createWithBitmap(bigPicture);
Notification notification = builder.setStyle(new Notification.BigPictureStyle(builder).bigPicture(bigPicture).bigLargeIcon(bigLargeIcon)).build();
assertThat(shadowOf(notification).getBigPicture()).isEqualTo(bigPicture);
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class LoadWeirdClassesTest method shouldLoadDisplay.
@Test
@Config(sdk = KITKAT)
public void shouldLoadDisplay() throws Exception {
WindowManager windowManager = (WindowManager) RuntimeEnvironment.application.getSystemService(Context.WINDOW_SERVICE);
ReflectionHelpers.callInstanceMethod(Display.class, windowManager.getDefaultDisplay(), "getDisplayAdjustments");
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowAlertDialogTest method shouldSetView_withLayoutId.
@Test
@Config(minSdk = LOLLIPOP)
public void shouldSetView_withLayoutId() throws Exception {
AlertDialog.Builder builder = new AlertDialog.Builder(application);
builder.setView(R.layout.custom_layout);
AlertDialog alert = builder.create();
View view = shadowOf(alert).getView();
assertThat(view.getClass()).isEqualTo(CustomView.class);
}
Aggregations