Search in sources :

Example 41 with Config

use of org.robolectric.annotation.Config in project robolectric by robolectric.

the class ShadowNotificationBuilderTest method build_setsIconOnNotification.

@Test
@Config(minSdk = M)
public void build_setsIconOnNotification() throws Exception {
    Notification notification = builder.setSmallIcon(R.drawable.an_image).build();
    assertThat(notification.getSmallIcon().getResId()).isEqualTo(R.drawable.an_image);
}
Also used : Notification(android.app.Notification) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 42 with Config

use of org.robolectric.annotation.Config in project robolectric by robolectric.

the class ShadowNotificationBuilderTest method build_setsUsesChronometerOnNotification_true.

@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void build_setsUsesChronometerOnNotification_true() throws Exception {
    Notification notification = builder.setUsesChronometer(true).setWhen(10).setShowWhen(true).build();
    assertThat(shadowOf(notification).usesChronometer()).isTrue();
}
Also used : Notification(android.app.Notification) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 43 with Config

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();
}
Also used : Notification(android.app.Notification) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 44 with Config

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();
}
Also used : Notification(android.app.Notification) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 45 with Config

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);
}
Also used : Bitmap(android.graphics.Bitmap) Icon(android.graphics.drawable.Icon) Notification(android.app.Notification) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

Config (org.robolectric.annotation.Config)158 Test (org.junit.Test)153 Intent (android.content.Intent)21 ComponentName (android.content.ComponentName)16 Bundle (android.os.Bundle)10 Activity (android.app.Activity)7 Bitmap (android.graphics.Bitmap)7 Notification (android.app.Notification)6 Button (android.widget.Button)6 TextView (android.widget.TextView)6 BuildConfig (com.firebase.ui.auth.BuildConfig)6 BuildConfig (com.onesignal.BuildConfig)6 ShadowRecyclerView (io.github.hidroh.materialistic.test.shadow.ShadowRecyclerView)6 SlowTest (io.github.hidroh.materialistic.test.suite.SlowTest)6 Properties (java.util.Properties)6 Account (android.accounts.Account)5 Network (android.net.Network)5 NetworkInfo (android.net.NetworkInfo)5 RecyclerView (android.support.v7.widget.RecyclerView)5 BitmapDrawable (android.graphics.drawable.BitmapDrawable)4