Search in sources :

Example 61 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 62 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 63 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)

Example 64 with Config

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

Example 65 with Config

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);
}
Also used : AlertDialog(android.app.AlertDialog) View(android.view.View) CustomView(org.robolectric.android.CustomView) 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