use of org.robolectric.android.controller.ActivityController in project collect by opendatakit.
the class FormMapActivityTest method locationChange_zoomsToCurrentLocation_ifTheViewportWasNotPreviouslyUpdated.
@Test
public void locationChange_zoomsToCurrentLocation_ifTheViewportWasNotPreviouslyUpdated() {
// The @Before block set up a map with points. Reset everything for this test.
map.resetState();
instancesRepository.deleteAll();
Intent intent = new Intent();
intent.putExtra(FormMapActivity.EXTRA_FORM_ID, form.getDbId());
ActivityController controller = CollectHelpers.buildThemedActivity(FormMapActivity.class, intent);
controller.setup();
assertThat(map.getZoomCount(), is(0));
map.onLocationChanged(currentLocation);
assertThat(map.getZoomCount(), is(1));
assertThat(map.getLatestZoomPoint(), is(currentLocation));
assertThat(map.wasLatestZoomCallAnimated(), is(true));
}
use of org.robolectric.android.controller.ActivityController in project collect by opendatakit.
the class FormMapActivityTest method startingFormMap_doesNotZoom_ifThereAreNoInstanceMarkers_andLocationIsUnavailable.
@Test
public void startingFormMap_doesNotZoom_ifThereAreNoInstanceMarkers_andLocationIsUnavailable() {
// The @Before block set up a map with points. Reset everything for this test.
map.resetState();
instancesRepository.deleteAll();
Intent intent = new Intent();
intent.putExtra(FormMapActivity.EXTRA_FORM_ID, form.getDbId());
ActivityController controller = CollectHelpers.buildThemedActivity(FormMapActivity.class, intent);
controller.setup();
assertThat(map.getZoomCount(), is(0));
}
use of org.robolectric.android.controller.ActivityController in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FallbackHomeActivityTest method wallpaperColorsChangedListener_ensured_removed.
@Test
@Config(shadows = ShadowWallpaperManager.class)
public void wallpaperColorsChangedListener_ensured_removed() {
// onCreate adds the first color listener by WallpaperManager returning null colors
ActivityController controller = mController.setup();
ShadowWallpaperManager shadowManager = Shadow.extract(RuntimeEnvironment.application.getSystemService(WallpaperManager.class));
assertThat(shadowManager.size()).isEqualTo(1);
// Assert onDestroy will remove the original listener
controller.destroy();
assertThat(shadowManager.size()).isEqualTo(0);
}
use of org.robolectric.android.controller.ActivityController in project iterable-android-sdk by Iterable.
the class IterableInAppManagerTest method testIfDialogFragmentExistAfterRotation.
@Test
public void testIfDialogFragmentExistAfterRotation() throws Exception {
ActivityController controller = Robolectric.buildActivity(FragmentActivity.class).create().start().resume();
FragmentActivity activity = (FragmentActivity) controller.get();
assertTrue(IterableInAppDisplayer.showIterableFragmentNotificationHTML(activity, "", "", null, 0.0, new Rect(), true, new IterableInAppMessage.InAppBgColor(null, 0.0f), false, IterableInAppLocation.IN_APP));
shadowOf(getMainLooper()).idle();
controller.configurationChange();
assertEquals(1, activity.getSupportFragmentManager().getFragments().size());
ShadowDialog.getLatestDialog().dismiss();
controller.pause().stop().destroy();
}
use of org.robolectric.android.controller.ActivityController in project android_packages_apps_Settings by omnirom.
the class FallbackHomeActivityTest method wallpaperColorsChangedListener_ensured_removed.
@Test
@Config(shadows = ShadowWallpaperManager.class)
public void wallpaperColorsChangedListener_ensured_removed() {
// onCreate adds the first color listener by WallpaperManager returning null colors
ActivityController controller = mController.setup();
ShadowWallpaperManager shadowManager = Shadow.extract(RuntimeEnvironment.application.getSystemService(WallpaperManager.class));
assertThat(shadowManager.size()).isEqualTo(1);
// Assert onDestroy will remove the original listener
controller.destroy();
assertThat(shadowManager.size()).isEqualTo(0);
}
Aggregations