use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class PromptAutoplayerTest method whenPromptHasNoAutoplay_doesNotLogEvents.
@Test
public void whenPromptHasNoAutoplay_doesNotLogEvents() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withAdditionalAttribute("autoplay", null).build();
autoplayer.autoplayIfNeeded(prompt);
verify(analytics, never()).logEvent(any(), any());
verify(analytics, never()).logEvent(any(), any(), any());
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class PromptAutoplayerTest method whenPromptHasAutoplayAudio_andIsSelectOne_playsAudioInOrder.
@Test
public void whenPromptHasAutoplayAudio_andIsSelectOne_playsAudioInOrder() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAudioURI(REFERENCES.get(0).first).withAdditionalAttribute("autoplay", "audio").withSelectChoices(asList(new SelectChoice("1", "1"), new SelectChoice("2", "2"))).withSpecialFormSelectChoiceText(asList(new Pair<>(FormEntryCaption.TEXT_FORM_AUDIO, REFERENCES.get(1).first), new Pair<>(FormEntryCaption.TEXT_FORM_AUDIO, REFERENCES.get(2).first))).build();
assertThat(autoplayer.autoplayIfNeeded(prompt), equalTo(true));
verify(audioHelper).playInOrder(asList(new Clip(prompt.getIndex().toString(), REFERENCES.get(0).second), new Clip(prompt.getIndex().toString() + " 0", REFERENCES.get(1).second), new Clip(prompt.getIndex().toString() + " 1", REFERENCES.get(2).second)));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class PromptAutoplayerTest method whenPromptHasAutoplayVideo_returnsFalse.
// We only support audio autoplaying with the helper right now
@Test
public void whenPromptHasAutoplayVideo_returnsFalse() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withAdditionalAttribute("autoplay", "video").build();
assertThat(autoplayer.autoplayIfNeeded(prompt), equalTo(false));
verify(audioHelper, never()).playInOrder(any());
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class PromptAutoplayerTest method whenPromptHasAutoplayAudio_andIsSelectOne_butNoSelectChoiceAudio_playsPromptAudio.
@Test
public void whenPromptHasAutoplayAudio_andIsSelectOne_butNoSelectChoiceAudio_playsPromptAudio() throws Exception {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAudioURI(REFERENCES.get(0).first).withAdditionalAttribute("autoplay", "audio").withSelectChoices(asList(new SelectChoice("1", "1"), new SelectChoice("2", "2"))).build();
assertThat(autoplayer.autoplayIfNeeded(prompt), equalTo(true));
verify(audioHelper).playInOrder(asList(new Clip(prompt.getIndex().toString(), REFERENCES.get(0).second)));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class OSMWidgetTest method clickingButton_whenActivityIsAvailable_setsWidgetWaitingForData.
@Test
public void clickingButton_whenActivityIsAvailable_setsWidgetWaitingForData() {
FormIndex formIndex = mock(FormIndex.class);
FormEntryPrompt prompt = promptWithAnswer(null);
when(prompt.getIndex()).thenReturn(formIndex);
OSMWidget widget = createWidget(prompt);
widget.binding.launchOpenMapKitButton.performClick();
assertThat(fakeWaitingForDataRegistry.waiting.contains(formIndex), is(true));
}
Aggregations