use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneListNoLabelWidget.
@Test
public void testCreatingSelectOneListNoLabelWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("something LisT-nOLabeL something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(ListWidget.class));
assertThat(((ListWidget) widget).shouldDisplayLabel(), is(false));
}
use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneWidget.
@Test
public void testCreatingSelectOneWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectOneWidget.class));
prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("lorem ipsum").build();
widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectOneWidget.class));
}
use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectOneLabelWidget.
@Test
public void testCreatingSelectOneLabelWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_ONE).withAppearance("something lAbeL something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(LabelWidget.class));
}
use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class WidgetFactoryTest method testCreatingSelectMultipleMinimalWidget.
@Test
public void testCreatingSelectMultipleMinimalWidget() {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withControlType(Constants.CONTROL_SELECT_MULTI).withAppearance("something miNimal something").build();
QuestionWidget widget = widgetFactory.createWidgetFromPrompt(prompt, null);
assertThat(widget, instanceOf(SelectMultiMinimalWidget.class));
}
use of org.odk.collect.android.support.MockFormEntryPromptBuilder in project collect by opendatakit.
the class QuestionWidgetTest method whenQuestionHasAudio_audioButtonUsesIndexAsClipID.
@Test
public void whenQuestionHasAudio_audioButtonUsesIndexAsClipID() throws Exception {
FormEntryPrompt prompt = new MockFormEntryPromptBuilder().withIndex("i am index").withAudioURI("ref").build();
WidgetTestActivity activity = CollectHelpers.createThemedActivity(WidgetTestActivity.class);
TestWidget widget = new TestWidget(activity, new QuestionDetails(prompt));
AudioButton audioButton = widget.getAudioVideoImageTextLabel().findViewById(R.id.audioButton);
verify(audioHelper).setAudio(audioButton, new Clip("i am index", "blah.mp3"));
}
Aggregations