use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class AudioWidgetTest method whenRecordingInProgress_updatesWaveform.
@Test
public void whenRecordingInProgress_updatesWaveform() {
FormEntryPrompt prompt = promptWithAnswer(null);
AudioWidget widget = createWidget(prompt);
recordingRequester.setAmplitude(prompt.getIndex().toString(), 5);
assertThat(widget.binding.audioPlayer.waveform.getLatestAmplitude(), is(5));
recordingRequester.setAmplitude(prompt.getIndex().toString(), 67);
assertThat(widget.binding.audioPlayer.waveform.getLatestAmplitude(), is(67));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class BearingWidgetTest method clickingBearingButton_whenSensorIsAvailable_setsWidgetWaitingForData.
@Test
public void clickingBearingButton_whenSensorIsAvailable_setsWidgetWaitingForData() {
FormEntryPrompt prompt = promptWithAnswer(null);
FormIndex formIndex = mock(FormIndex.class);
when(prompt.getIndex()).thenReturn(formIndex);
BearingWidget widget = createWidget(prompt);
widget.binding.bearingButton.performClick();
assertThat(fakeWaitingForDataRegistry.waiting.contains(formIndex), is(true));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class DateWidgetTest method clickingButton_callsDisplayDatePickerDialogWithCurrentDate_whenPromptDoesNotHaveAnswer.
@Test
public void clickingButton_callsDisplayDatePickerDialogWithCurrentDate_whenPromptDoesNotHaveAnswer() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, null);
DateWidget widget = createWidget(prompt);
widget.binding.dateButton.performClick();
verify(widgetUtils).showDatePickerDialog(widgetActivity, DateTimeWidgetUtils.getDatePickerDetails(prompt.getQuestion().getAppearanceAttr()), DateTimeUtils.getCurrentDateTime());
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class DateWidgetTest method whenPromptHasAnswer_answerTextViewShowsCorrectDate.
@Test
public void whenPromptHasAnswer_answerTextViewShowsCorrectDate() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, new DateData(dateAnswer.toDate()));
DatePickerDetails datePickerDetails = DateTimeWidgetUtils.getDatePickerDetails(prompt.getQuestion().getAppearanceAttr());
DateWidget widget = createWidget(prompt);
assertEquals(widget.binding.dateAnswerText.getText(), DateTimeWidgetUtils.getDateTimeLabel(dateAnswer.toDate(), datePickerDetails, false, widget.getContext()));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class GeoPointWidgetTest method buttonClick_requestsGeoPoint_whenAnswerIsUpdated.
@Test
public void buttonClick_requestsGeoPoint_whenAnswerIsUpdated() {
FormEntryPrompt prompt = promptWithAnswer(null);
GeoPointWidget widget = createWidget(prompt);
widget.setData(answer);
widget.binding.simpleButton.performClick();
verify(geoDataRequester).requestGeoPoint(prompt, answer.getDisplayText(), waitingForDataRegistry);
}
Aggregations