Search in sources :

Example 56 with Notification

use of android.app.Notification 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 57 with Notification

use of android.app.Notification in project robolectric by robolectric.

the class ShadowNotificationBuilderTest method build_setsWhenOnNotification.

@Test
public void build_setsWhenOnNotification() throws Exception {
    Notification notification = builder.setWhen(11L).build();
    assertThat(notification.when).isEqualTo(11L);
}
Also used : Notification(android.app.Notification) Test(org.junit.Test)

Example 58 with Notification

use of android.app.Notification in project robolectric by robolectric.

the class ShadowNotificationBuilderTest method build_setsTickerOnNotification.

@Test
public void build_setsTickerOnNotification() throws Exception {
    Notification notification = builder.setTicker("My ticker").build();
    assertThat(notification.tickerText).isEqualTo("My ticker");
}
Also used : Notification(android.app.Notification) Test(org.junit.Test)

Example 59 with Notification

use of android.app.Notification 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 60 with Notification

use of android.app.Notification in project robolectric by robolectric.

the class ShadowNotificationBuilderTest method build_handlesNullTicker.

@Test
public void build_handlesNullTicker() {
    Notification notification = builder.setTicker(null).build();
    assertThat(notification.tickerText).isNull();
}
Also used : Notification(android.app.Notification) Test(org.junit.Test)

Aggregations

Notification (android.app.Notification)568 PendingIntent (android.app.PendingIntent)276 Intent (android.content.Intent)253 NotificationManager (android.app.NotificationManager)128 StatusBarNotification (android.service.notification.StatusBarNotification)96 NotificationCompat (android.support.v4.app.NotificationCompat)64 Resources (android.content.res.Resources)56 Bitmap (android.graphics.Bitmap)48 Test (org.junit.Test)48 Context (android.content.Context)47 ITransientNotification (android.app.ITransientNotification)32 RemoteViews (android.widget.RemoteViews)30 RemoteException (android.os.RemoteException)24 ApplicationInfo (android.content.pm.ApplicationInfo)17 UserHandle (android.os.UserHandle)17 Date (java.util.Date)16 Uri (android.net.Uri)15 Bundle (android.os.Bundle)15 ComponentName (android.content.ComponentName)13 File (java.io.File)13