use of org.odk.collect.android.support.WidgetTestActivity in project collect by opendatakit.
the class RangeWidgetUtilsTest method clickingPickerButton_showsNumberPickerDialog.
@Test
public void clickingPickerButton_showsNumberPickerDialog() {
WidgetTestActivity activity = CollectHelpers.createThemedActivity(WidgetTestActivity.class);
RangeWidgetUtils.showNumberPickerDialog(activity, new String[] {}, 0, 0);
RobolectricHelpers.runLooper();
NumberPickerDialog numberPickerDialog = (NumberPickerDialog) activity.getSupportFragmentManager().findFragmentByTag(NumberPickerDialog.NUMBER_PICKER_DIALOG_TAG);
assertNotNull(numberPickerDialog);
}
use of org.odk.collect.android.support.WidgetTestActivity in project collect by opendatakit.
the class GeneralStringWidgetTest method widgetShouldBeRegisteredForContextMenu.
/**
* Unlike other widgets, String widgets that contain EditText should not be registered to
* context menu as a whole because the Clipboard menu would be broken.
*
* https://github.com/getodk/collect/pull/4860
*/
@Test
public void widgetShouldBeRegisteredForContextMenu() {
StringWidget widget = createWidget();
List<View> viewsRegisterForContextMenu = ((WidgetTestActivity) activity).viewsRegisterForContextMenu;
assertThat(viewsRegisterForContextMenu.size(), is(3));
assertTrue(viewsRegisterForContextMenu.contains(widget.findViewWithTag(R.id.question_label)));
assertTrue(viewsRegisterForContextMenu.contains(widget.findViewWithTag(R.id.help_text)));
assertTrue(viewsRegisterForContextMenu.contains(widget.findViewWithTag(R.id.space_box)));
assertThat(viewsRegisterForContextMenu.get(0).getId(), is(widget.getId()));
assertThat(viewsRegisterForContextMenu.get(1).getId(), is(widget.getId()));
assertThat(viewsRegisterForContextMenu.get(2).getId(), is(widget.getId()));
}
use of org.odk.collect.android.support.WidgetTestActivity in project collect by opendatakit.
the class GeneralExStringWidgetTest method widgetShouldBeRegisteredForContextMenu.
/**
* Unlike other widgets, String widgets that contain EditText should not be registered to
* context menu as a whole because the Clipboard menu would be broken.
*
* https://github.com/getodk/collect/pull/4860
*/
@Test
public void widgetShouldBeRegisteredForContextMenu() {
StringWidget widget = createWidget();
List<View> viewsRegisterForContextMenu = ((WidgetTestActivity) activity).viewsRegisterForContextMenu;
assertThat(viewsRegisterForContextMenu.size(), is(3));
assertTrue(viewsRegisterForContextMenu.contains(widget.findViewWithTag(R.id.question_label)));
assertTrue(viewsRegisterForContextMenu.contains(widget.findViewWithTag(R.id.help_text)));
assertTrue(viewsRegisterForContextMenu.contains(widget.findViewWithTag(R.id.space_box)));
assertThat(viewsRegisterForContextMenu.get(0).getId(), is(widget.getId()));
assertThat(viewsRegisterForContextMenu.get(1).getId(), is(widget.getId()));
assertThat(viewsRegisterForContextMenu.get(2).getId(), is(widget.getId()));
}
use of org.odk.collect.android.support.WidgetTestActivity in project collect by opendatakit.
the class QuestionWidgetTest method widgetShouldBeRegisteredForContextMenu.
// The whole widget should be registered for context menu to support removing answers/groups
@Test
public void widgetShouldBeRegisteredForContextMenu() {
QuestionWidget widget = (QuestionWidget) createWidget();
List<View> viewsRegisterForContextMenu = ((WidgetTestActivity) activity).viewsRegisterForContextMenu;
assertThat(viewsRegisterForContextMenu.size(), is(1));
assertThat(viewsRegisterForContextMenu.get(0), is(widget));
}
use of org.odk.collect.android.support.WidgetTestActivity 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