use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class DaylightSavingTest method prepareDateTimeWidget.
private DateTimeWidget prepareDateTimeWidget(int year, int month, int day, int hour, int minute) {
QuestionDef questionDefStub = mock(QuestionDef.class);
FormEntryPrompt formEntryPromptStub = new MockFormEntryPromptBuilder().withIndex("index").build();
IFormElement iformElementStub = formEntryPromptStub.getFormElement();
when(iformElementStub.getAdditionalAttribute(anyString(), anyString())).thenReturn(null);
when(formEntryPromptStub.getQuestion()).thenReturn(questionDefStub);
when(formEntryPromptStub.getFormElement()).thenReturn(iformElementStub);
when(formEntryPromptStub.getQuestion().getAppearanceAttr()).thenReturn("no-calendar");
DateTimeWidget dateTimeWidget = new DateTimeWidget(widgetActivity, new QuestionDetails(formEntryPromptStub), widgetUtils);
dateTimeWidget.setData(new LocalDateTime().withDate(year, month, day));
dateTimeWidget.setData(new DateTime().withTime(hour, minute, 0, 0));
return dateTimeWidget;
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class DaylightSavingTest method prepareDateWidget.
private DateWidget prepareDateWidget(int year, int month, int day) {
QuestionDef questionDefStub = mock(QuestionDef.class);
FormEntryPrompt formEntryPromptStub = new MockFormEntryPromptBuilder().withIndex("index").build();
IFormElement iformElementStub = formEntryPromptStub.getFormElement();
when(iformElementStub.getAdditionalAttribute(anyString(), anyString())).thenReturn(null);
when(formEntryPromptStub.getQuestion()).thenReturn(questionDefStub);
when(formEntryPromptStub.getFormElement()).thenReturn(iformElementStub);
when(formEntryPromptStub.getQuestion().getAppearanceAttr()).thenReturn("no-calendar");
DatePickerDialog datePickerDialog = mock(DatePickerDialog.class);
DatePicker datePicker = mock(DatePicker.class);
when(datePickerDialog.getDatePicker()).thenReturn(datePicker);
when(datePickerDialog.getDatePicker().getYear()).thenReturn(year);
when(datePickerDialog.getDatePicker().getMonth()).thenReturn(month);
when(datePickerDialog.getDatePicker().getDayOfMonth()).thenReturn(day);
return new DateWidget(widgetActivity, new QuestionDetails(formEntryPromptStub), widgetUtils);
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class GeoPointMapWidgetTest method buttonClick_requestsGeoPoint.
@Test
public void buttonClick_requestsGeoPoint() {
FormEntryPrompt prompt = promptWithAnswer(answer);
GeoPointMapWidget widget = createWidget(prompt);
widget.binding.simpleButton.performClick();
verify(geoDataRequester).requestGeoPoint(prompt, answer.getDisplayText(), waitingForDataRegistry);
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class GeoShapeWidgetTest method buttonClick_requestsGeoShape.
@Test
public void buttonClick_requestsGeoShape() {
FormEntryPrompt prompt = promptWithAnswer(new StringData(answer));
GeoShapeWidget widget = createWidget(prompt);
widget.binding.simpleButton.performClick();
verify(geoDataRequester).requestGeoShape(prompt, answer, waitingForDataRegistry);
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class GeoShapeWidgetTest method buttonClick_requestsGeoShape_whenAnswerIsCleared.
@Test
public void buttonClick_requestsGeoShape_whenAnswerIsCleared() {
FormEntryPrompt prompt = promptWithAnswer(new StringData(answer));
GeoShapeWidget widget = createWidget(prompt);
widget.clearAnswer();
widget.binding.simpleButton.performClick();
verify(geoDataRequester).requestGeoShape(prompt, "", waitingForDataRegistry);
}
Aggregations