use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class GeoTraceWidgetTest method buttonClick_requestsGeoTrace_whenAnswerIsCleared.
@Test
public void buttonClick_requestsGeoTrace_whenAnswerIsCleared() {
FormEntryPrompt prompt = promptWithAnswer(new StringData(answer));
GeoTraceWidget widget = createWidget(prompt);
widget.clearAnswer();
widget.binding.simpleButton.performClick();
verify(geoDataRequester).requestGeoTrace(prompt, "", waitingForDataRegistry);
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class GeoTraceWidgetTest method buttonClick_whenMapConfiguratorIsUnavailable_doesNotRequestGeoTrace.
@Test
public void buttonClick_whenMapConfiguratorIsUnavailable_doesNotRequestGeoTrace() {
FormEntryPrompt prompt = promptWithAnswer(null);
GeoTraceWidget widget = createWidget(prompt);
when(mapConfigurator.isAvailable(widget.getContext())).thenReturn(false);
widget.binding.simpleButton.performClick();
verify(geoDataRequester, never()).requestGeoTrace(prompt, "", waitingForDataRegistry);
verify(mapConfigurator).showUnavailableMessage(widget.getContext());
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class TimeWidgetTest method clickingButton_callsDisplayTimePickerDialogWithSelectedTime_whenPromptHasAnswer.
@Test
public void clickingButton_callsDisplayTimePickerDialogWithSelectedTime_whenPromptHasAnswer() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, new TimeData(timeAnswer.toDateTime().toDate()));
TimeWidget widget = createWidget(prompt);
widget.binding.timeButton.performClick();
verify(widgetUtils).showTimePickerDialog(widgetActivity, timeAnswer);
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneImageMapWidget.
@Test
public void testCreatingSelectOneImageMapWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("something imaGe-Map something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectOneImageMapWidget.class));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectMultipleImageMapWidget.
@Test
public void testCreatingSelectMultipleImageMapWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_MULTI).withAppearance("something imaGe-Map something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectMultiImageMapWidget.class));
}
Aggregations