use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenNonFLexAppearanceIsUsedWithOneColumn_shouldDividersBeAdded.
@Test
public void whenNonFLexAppearanceIsUsedWithOneColumn_shouldDividersBeAdded() {
List<SelectChoice> items = getTestChoices();
setUpFormEntryPrompt(items, "");
SelectOneListAdapter adapter = new SelectOneListAdapter(null, null, activityController.get(), items, formEntryPrompt, null, null, 0, 1, false, mock(MediaUtils.class));
initRecyclerView(adapter, false);
assertThat(recyclerView.getItemDecorationCount(), is(1));
assertThat(recyclerView.getItemDecorationAt(0), is(instanceOf(DividerItemDecoration.class)));
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenClickOneOption_shouldPreviouslySelectedOptionBeUnselectedInSelectOneNoButtonsMode.
@Test
public void whenClickOneOption_shouldPreviouslySelectedOptionBeUnselectedInSelectOneNoButtonsMode() {
List<SelectChoice> items = getTestChoices();
setUpFormEntryPrompt(items, "no-buttons");
SelectItemClickListener listener = mock(SelectItemClickListener.class);
SelectOneListAdapter adapter = new SelectOneListAdapter(null, listener, activityController.get(), items, formEntryPrompt, null, audioHelper, 0, 1, true, mock(MediaUtils.class));
initRecyclerView(adapter, false);
// Select AAA
clickChoice(0);
assertThat(isItemSelected(0), is(true));
assertThat(isItemSelected(1), is(false));
// Select BBB
clickChoice(1);
assertThat(isItemSelected(0), is(false));
assertThat(isItemSelected(1), is(true));
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenChoicesFiltered_shouldProperValuesBeReturnedInSelectOneNoButtonsMode.
@Test
public void whenChoicesFiltered_shouldProperValuesBeReturnedInSelectOneNoButtonsMode() {
List<SelectChoice> items = getTestChoices();
setUpFormEntryPrompt(items, "no-buttons");
SelectOneListAdapter adapter = new SelectOneListAdapter(null, null, activityController.get(), items, formEntryPrompt, null, null, 0, 1, true, mock(MediaUtils.class));
initRecyclerView(adapter, false);
assertVisibleItemsInNoButtonsMode("AAA", "BBB");
filterList(adapter, "b");
assertVisibleItemsInNoButtonsMode("BBB");
filterList(adapter, "bc");
assertVisibleItemsInNoButtonsMode();
filterList(adapter, "b");
assertVisibleItemsInNoButtonsMode("BBB");
filterList(adapter, "");
assertVisibleItemsInNoButtonsMode("AAA", "BBB");
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenChoiceSelectedInSelectOneNoButtonsMode_shouldTryToPlayAudio.
@Test
public void whenChoiceSelectedInSelectOneNoButtonsMode_shouldTryToPlayAudio() {
List<SelectChoice> items = getTestChoices();
setUpFormEntryPrompt(items, "no-buttons");
SelectItemClickListener listener = mock(SelectItemClickListener.class);
AudioHelper audioHelper = mock(AudioHelper.class);
SelectOneListAdapter adapter = spy(new SelectOneListAdapter(null, listener, activityController.get(), items, formEntryPrompt, null, audioHelper, 0, 1, true, mock(MediaUtils.class)));
initRecyclerView(adapter, false);
// Select AAA
clickChoice(0);
verify(adapter).playAudio(any());
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenFLexAppearanceIsUsed_shouldNotDividersBeAdded.
@Test
public void whenFLexAppearanceIsUsed_shouldNotDividersBeAdded() {
List<SelectChoice> items = getTestChoices();
setUpFormEntryPrompt(items, "");
SelectOneListAdapter adapter = new SelectOneListAdapter(null, null, activityController.get(), items, formEntryPrompt, null, null, 0, 2, false, mock(MediaUtils.class));
initRecyclerView(adapter, true);
assertThat(recyclerView.getItemDecorationCount(), is(0));
}
Aggregations