use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class SelectMultiWidgetTest method whenSpacesInUnderlyingValuesExist_shouldAppropriateWarningBeDisplayed.
@Test
public void whenSpacesInUnderlyingValuesExist_shouldAppropriateWarningBeDisplayed() {
formEntryPrompt = new MockFormEntryPromptBuilder().withSelectChoices(asList(new SelectChoice("a", "a a"), new SelectChoice("a", "b b"))).build();
TextView warningTv = getWidget().findViewById(R.id.warning_text);
assertThat(warningTv.getVisibility(), is(View.VISIBLE));
assertThat(warningTv.getText(), is("Warning: underlying values a a, b b have spaces"));
}
use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class SelectMultiWidgetTest method whenChoicesHaveAudio_audioButtonUsesIndexAsClipID.
@Test
public void whenChoicesHaveAudio_audioButtonUsesIndexAsClipID() throws Exception {
formEntryPrompt = new MockFormEntryPromptBuilder().withIndex("i am index").withSelectChoices(asList(new SelectChoice("1", "1"), new SelectChoice("2", "2"))).withSpecialFormSelectChoiceText(asList(new Pair<>(FormEntryCaption.TEXT_FORM_AUDIO, REFERENCES.get(0).first), new Pair<>(FormEntryCaption.TEXT_FORM_AUDIO, REFERENCES.get(1).first))).build();
populateRecyclerView(getWidget());
verify(audioHelper).setAudio(any(AudioButton.class), eq(new Clip("i am index 0", REFERENCES.get(0).second)));
verify(audioHelper).setAudio(any(AudioButton.class), eq(new Clip("i am index 1", REFERENCES.get(1).second)));
}
use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class InternalRecordingRequesterTest method requestRecording_whenPromptQualityIsVoiceOnly_startsWithAMR.
@Test
public void requestRecording_whenPromptQualityIsVoiceOnly_startsWithAMR() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withBindAttribute("odk", "quality", "voice-only").build();
requester.requestRecording(prompt);
verify(audioRecorder).start(prompt.getIndex(), Output.AMR);
}
use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class InternalRecordingRequesterTest method requestRecording_whenPromptQualityIsLow_startsWithAACLow.
@Test
public void requestRecording_whenPromptQualityIsLow_startsWithAACLow() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withBindAttribute("odk", "quality", "low").build();
requester.requestRecording(prompt);
verify(audioRecorder).start(prompt.getIndex(), Output.AAC_LOW);
}
use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class RecordingRequesterProviderTest method whenNoQualitySpecified_andSettingExternalPreferred_createsExternalRecordingRequester.
@Test
public void whenNoQualitySpecified_andSettingExternalPreferred_createsExternalRecordingRequester() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().build();
RecordingRequester recordingRequester = provider.create(prompt, true);
assertThat(recordingRequester, instanceOf(ExternalAppRecordingRequester.class));
}
Aggregations