use of org.robolectric.shadows.ShadowActivity in project collect by opendatakit.
the class MainActivityTest method sendDataButtonTest.
/**
* {@link Test} to assert sendDataButton's functioning.
*/
@Test
public void sendDataButtonTest() throws Exception {
Button sendDataButton = mainMenuActivity.findViewById(R.id.send_data);
assertNotNull(sendDataButton);
assertEquals(View.VISIBLE, sendDataButton.getVisibility());
assertEquals(mainMenuActivity.getString(R.string.send_data_button), sendDataButton.getText());
sendDataButton.performClick();
ShadowActivity shadowActivity = shadowOf(mainMenuActivity);
Intent startedIntent = shadowActivity.getNextStartedActivity();
ShadowIntent shadowIntent = shadowOf(startedIntent);
assertEquals(InstanceUploaderList.class.getName(), shadowIntent.getIntentClass().getName());
}
use of org.robolectric.shadows.ShadowActivity in project collect by opendatakit.
the class MainActivityTest method dataButtonTest.
/**
* {@link Test} to assert dataButton's functioning.
*/
@Test
public void dataButtonTest() throws Exception {
Button dataButton = mainMenuActivity.findViewById(R.id.enter_data);
assertNotNull(dataButton);
assertEquals(View.VISIBLE, dataButton.getVisibility());
assertEquals(mainMenuActivity.getString(R.string.enter_data_button), dataButton.getText());
dataButton.performClick();
ShadowActivity shadowActivity = shadowOf(mainMenuActivity);
Intent startedIntent = shadowActivity.getNextStartedActivity();
ShadowIntent shadowIntent = shadowOf(startedIntent);
assertEquals(FormChooserList.class.getName(), shadowIntent.getIntentClass().getName());
}
use of org.robolectric.shadows.ShadowActivity in project android_packages_apps_Settings by LineageOS.
the class HelpTrampolineTest method launchHelp_hasExtra_shouldLaunchHelp.
@Test
public void launchHelp_hasExtra_shouldLaunchHelp() {
final Intent intent = new Intent().setClassName(RuntimeEnvironment.application.getPackageName(), HelpTrampoline.class.getName()).putExtra(Intent.EXTRA_TEXT, "help_url_upgrading");
final ShadowActivity shadow = shadowOf(Robolectric.buildActivity(HelpTrampoline.class).withIntent(intent).create().get());
final Intent launchedIntent = shadow.getNextStartedActivity();
assertThat(ShadowHelpUtils.isGetHelpIntentCalled()).isTrue();
assertThat(launchedIntent).isNotNull();
}
use of org.robolectric.shadows.ShadowActivity in project android_packages_apps_Settings by LineageOS.
the class FingerprintEnrollFindSensorTest method clickSkip_shouldReturnResultSkip.
@Test
public void clickSkip_shouldReturnResultSkip() {
Button skipButton = mActivity.findViewById(R.id.skip_button);
skipButton.performClick();
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
assertThat(shadowActivity.getResultCode()).named("result code").isEqualTo(FingerprintEnrollBase.RESULT_SKIP);
}
use of org.robolectric.shadows.ShadowActivity in project android_packages_apps_Settings by LineageOS.
the class SetupFingerprintEnrollIntroductionTest method testBackKeyPress_shouldNotSetIntentDataIfLockScreenPresentBeforeLaunch.
@Test
public void testBackKeyPress_shouldNotSetIntentDataIfLockScreenPresentBeforeLaunch() {
getShadowKeyguardManager().setIsKeyguardSecure(true);
mController.create().resume();
SetupFingerprintEnrollIntroduction activity = mController.get();
activity.onBackPressed();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
assertThat(shadowActivity.getResultIntent()).isNull();
}
Aggregations