use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class DateTimeWidgetTest method clickingSetTimeButton_callsDisplayTimePickerDialogWithSelectedTime_whenPromptHasAnswer.
@Test
public void clickingSetTimeButton_callsDisplayTimePickerDialogWithSelectedTime_whenPromptHasAnswer() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, new TimeData(localDateTime.toDateTime().toDate()));
DateTimeWidget widget = createWidget(prompt);
widget.binding.timeWidget.timeButton.performClick();
verify(widgetUtils).showTimePickerDialog(widgetActivity, localDateTime);
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class DateTimeWidgetTest method clickingSetDateButton_callsDisplayDatePickerDialogWithCurrentDate_whenPromptDoesNotHaveAnswer.
@Test
public void clickingSetDateButton_callsDisplayDatePickerDialogWithCurrentDate_whenPromptDoesNotHaveAnswer() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, null);
DateTimeWidget widget = createWidget(prompt);
widget.binding.dateWidget.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 DateTimeWidgetTest method setDateData_updatesValueShownInDateAnswerTextView.
@Test
public void setDateData_updatesValueShownInDateAnswerTextView() {
FormEntryPrompt prompt = promptWithQuestionDefAndAnswer(questionDef, null);
DatePickerDetails datePickerDetails = DateTimeWidgetUtils.getDatePickerDetails(prompt.getQuestion().getAppearanceAttr());
DateTimeWidget widget = createWidget(prompt);
widget.setData(new LocalDateTime().withDate(2010, 5, 12));
assertEquals(widget.binding.dateWidget.dateAnswerText.getText(), DateTimeWidgetUtils.getDateTimeLabel(localDateTime.toDate(), datePickerDetails, false, widget.getContext()));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class AudioWidgetTest method whenRecordingFinished_showsButtons.
@Test
public void whenRecordingFinished_showsButtons() {
FormEntryPrompt prompt = promptWithAnswer(null);
AudioWidget widget = createWidget(prompt);
recordingRequester.setDuration(prompt.getIndex().toString(), 5);
recordingRequester.reset();
assertThat(widget.binding.audioPlayer.audioController.getVisibility(), is(GONE));
assertThat(widget.binding.audioPlayer.recordingDuration.getVisibility(), is(GONE));
assertThat(widget.binding.audioPlayer.waveform.getVisibility(), is(GONE));
assertThat(widget.binding.captureButton.getVisibility(), is(VISIBLE));
assertThat(widget.binding.chooseButton.getVisibility(), is(VISIBLE));
}
use of org.javarosa.form.api.FormEntryPrompt in project collect by opendatakit.
the class AudioWidgetTest method afterSetBinaryData_showsDurationOfAudio.
@Test
public void afterSetBinaryData_showsDurationOfAudio() throws Exception {
FormEntryPrompt prompt = promptWithAnswer(null);
File answerFile = questionMediaManager.addAnswerFile(File.createTempFile("blah", ".mp3"));
Clip expectedClip = getExpectedClip(prompt, answerFile.getName());
setupMediaPlayerDataSource(expectedClip.getURI(), 322450);
AudioWidget widget = createWidget(prompt);
widget.setData(answerFile);
AudioControllerView audioController = widget.binding.audioPlayer.audioController;
assertThat(audioController.binding.totalDuration.getText().toString(), is("05:22"));
}
Aggregations