use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class QuestionWidgetTest method whenQuestionHasAudio_audioButtonUsesIndexAsClipID.
@Test
public void whenQuestionHasAudio_audioButtonUsesIndexAsClipID() throws Exception {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withIndex("i am index").withAudioURI("ref").build();
WidgetTestActivity activity = CollectHelpers.createThemedActivity(WidgetTestActivity.class);
TestWidget widget = new TestWidget(activity, new QuestionDetails(prompt));
AudioButton audioButton = widget.getAudioVideoImageTextLabel().findViewById(R.id.audioButton);
verify(audioHelper).setAudio(audioButton, new Clip("i am index", "blah.mp3"));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class TimeWidgetTest method clickingButton_callsDisplayTimePickerDialogWithCurrentTime_whenPromptDoesNotHaveAnswer.
@Test
public void clickingButton_callsDisplayTimePickerDialogWithCurrentTime_whenPromptDoesNotHaveAnswer() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, null);
TimeWidget widget = createWidget(prompt);
widget.binding.timeButton.performClick();
verify(widgetUtils).showTimePickerDialog(widgetActivity, DateTimeUtils.getCurrentDateTime());
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectMultipleListNoLabelWidget.
@Test
public void testCreatingSelectMultipleListNoLabelWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_MULTI).withAppearance("something LisT-nOLabeL something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(ListMultiWidget.class));
assertThat(((ListMultiWidget) widget).shouldDisplayLabel(), is(false));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectMultipleWidget.
@Test
public void testCreatingSelectMultipleWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_MULTI).withAppearance("").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectMultiWidget.class));
prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_MULTI).withAppearance("lorem ipsum").build();
widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectMultiWidget.class));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneListNoLabelWidget.
@Test
public void testCreatingSelectOneListNoLabelWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("something LisT-nOLabeL something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(ListWidget.class));
assertThat(((ListWidget) widget).shouldDisplayLabel(), is(false));
}
Aggregations