Search in sources :

Example 1 with ErrorIntentLauncher

use of org.odk.collect.testshared.ErrorIntentLauncher in project collect by opendatakit.

the class QRCodeMenuDelegateTest method clickingOnImportQRCode_whenPickerActivityNotAvailable_showsToast.

@Test
public void clickingOnImportQRCode_whenPickerActivityNotAvailable_showsToast() {
    intentLauncher = new ErrorIntentLauncher();
    setupMenuDelegate();
    menuDelegate.onOptionsItemSelected(new RoboMenuItem(R.id.menu_item_scan_sd_card));
    assertThat(shadowOf(activity).getNextStartedActivityForResult(), is(nullValue()));
    assertThat(ShadowToast.getLatestToast(), notNullValue());
}
Also used : RoboMenuItem(org.robolectric.fakes.RoboMenuItem) ErrorIntentLauncher(org.odk.collect.testshared.ErrorIntentLauncher) Test(org.junit.Test)

Example 2 with ErrorIntentLauncher

use of org.odk.collect.testshared.ErrorIntentLauncher in project collect by opendatakit.

the class OSMWidgetTest method clickingButton_whenActivityIsNotAvailable_CancelsWaitingForData.

@Test
public void clickingButton_whenActivityIsNotAvailable_CancelsWaitingForData() {
    intentLauncher = new ErrorIntentLauncher();
    OSMWidget widget = createWidget(promptWithAnswer(null));
    widget.binding.launchOpenMapKitButton.performClick();
    assertThat(fakeWaitingForDataRegistry.waiting.isEmpty(), is(true));
}
Also used : ErrorIntentLauncher(org.odk.collect.testshared.ErrorIntentLauncher) Test(org.junit.Test)

Example 3 with ErrorIntentLauncher

use of org.odk.collect.testshared.ErrorIntentLauncher in project collect by opendatakit.

the class OSMWidgetTest method clickingButton_whenActivityIsNotAvailable_showsErrorTextView.

@Test
public void clickingButton_whenActivityIsNotAvailable_showsErrorTextView() {
    intentLauncher = new ErrorIntentLauncher();
    OSMWidget widget = createWidget(promptWithAnswer(null));
    widget.binding.launchOpenMapKitButton.performClick();
    assertThat(widget.binding.errorText.getVisibility(), is(View.VISIBLE));
}
Also used : ErrorIntentLauncher(org.odk.collect.testshared.ErrorIntentLauncher) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 ErrorIntentLauncher (org.odk.collect.testshared.ErrorIntentLauncher)3 RoboMenuItem (org.robolectric.fakes.RoboMenuItem)1