use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneWidget.
@Test
public void testCreatingSelectOneWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectOneWidget.class));
prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("lorem ipsum").build();
widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectOneWidget.class));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneLabelWidget.
@Test
public void testCreatingSelectOneLabelWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("something lAbeL something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(LabelWidget.class));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectMultipleMinimalWidget.
@Test
public void testCreatingSelectMultipleMinimalWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_MULTI).withAppearance("something miNimal something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectMultiMinimalWidget.class));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class ODKView method autoplayIfNeeded.
private void autoplayIfNeeded(boolean advancingPage) {
// Only execute it during forward swipes through the form
if (advancingPage && widgets.size() == 1) {
FormEntryPrompt firstPrompt = widgets.get(0).getFormEntryPrompt();
Boolean autoplayedAudio = autoplayAudio(firstPrompt);
if (!autoplayedAudio) {
autoplayVideo(firstPrompt);
}
}
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class FormSaveViewModelTest method whenFormSaverFinishes_saved_andFormIsCurrentlyOnQuestion_logsSaveAndQuestionAuditEventsAfterFlush.
@Test
public void whenFormSaverFinishes_saved_andFormIsCurrentlyOnQuestion_logsSaveAndQuestionAuditEventsAfterFlush() throws RepeatsInFieldListException {
when(formController.getEvent()).thenReturn(EVENT_QUESTION);
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withIndex("index1").withAnswerDisplayText("answer").build();
when(formController.getQuestionPrompts()).thenReturn(Arrays.asList(prompt).toArray(new FormEntryPrompt[] {}));
viewModel.saveForm(Uri.parse("file://form"), true, "", false);
whenFormSaverFinishes(SaveFormToDisk.SAVED);
InOrder verifier = inOrder(logger);
verifier.verify(logger).flush();
verifier.verify(logger).logEvent(AuditEvent.AuditEventType.FORM_SAVE, false, CURRENT_TIME);
verifier.verify(logger).logEvent(AuditEvent.AuditEventType.QUESTION, prompt.getIndex(), true, prompt.getAnswerValue().getDisplayText(), CURRENT_TIME, null);
}
Aggregations