Search in sources :

Example 46 with FormEntryPrompt

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);
}
Also used : FormEntryPrompt(org.javarosa.form.api.FormEntryPrompt) StringData(org.javarosa.core.model.data.StringData) Test(org.junit.Test)

Example 47 with FormEntryPrompt

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());
}
Also used : FormEntryPrompt(org.javarosa.form.api.FormEntryPrompt) Test(org.junit.Test)

Example 48 with FormEntryPrompt

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);
}
Also used : FormEntryPrompt(org.javarosa.form.api.FormEntryPrompt) TimeData(org.javarosa.core.model.data.TimeData) Test(org.junit.Test)

Example 49 with FormEntryPrompt

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));
}
Also used : FormEntryPrompt(org.javarosa.form.api.FormEntryPrompt) MockFormEntryPromptBuilder(org.odk.collect.android.support.MockFormEntryPromptBuilder) SelectOneImageMapWidget(org.odk.collect.android.widgets.items.SelectOneImageMapWidget) Test(org.junit.Test)

Example 50 with FormEntryPrompt

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));
}
Also used : FormEntryPrompt(org.javarosa.form.api.FormEntryPrompt) SelectMultiImageMapWidget(org.odk.collect.android.widgets.items.SelectMultiImageMapWidget) MockFormEntryPromptBuilder(org.odk.collect.android.support.MockFormEntryPromptBuilder) Test(org.junit.Test)

Aggregations

FormEntryPrompt (org.javarosa.form.api.FormEntryPrompt)114 Test (org.junit.Test)92 MockFormEntryPromptBuilder (org.odk.collect.android.support.MockFormEntryPromptBuilder)45 Clip (org.odk.collect.audioclips.Clip)13 FormIndex (org.javarosa.core.model.FormIndex)10 File (java.io.File)9 SelectChoice (org.javarosa.core.model.SelectChoice)7 StringData (org.javarosa.core.model.data.StringData)7 IFormElement (org.javarosa.core.model.IFormElement)5 QuestionDef (org.javarosa.core.model.QuestionDef)5 FormController (org.odk.collect.android.javarosawrapper.FormController)5 GroupDef (org.javarosa.core.model.GroupDef)4 QuestionDetails (org.odk.collect.android.formentry.questions.QuestionDetails)4 DatePickerDetails (org.odk.collect.android.logic.DatePickerDetails)4 ArrayList (java.util.ArrayList)3 DateData (org.javarosa.core.model.data.DateData)3 IAnswerData (org.javarosa.core.model.data.IAnswerData)3 TreeReference (org.javarosa.core.model.instance.TreeReference)3 LocalDateTime (org.joda.time.LocalDateTime)3 AudioControllerView (org.odk.collect.android.audio.AudioControllerView)3