use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenClickOneOption_shouldPreviouslySelectedOptionBeUnselectedInSelectOneButtonsMode.
@Test
public void whenClickOneOption_shouldPreviouslySelectedOptionBeUnselectedInSelectOneButtonsMode() {
List<SelectChoice> items = getTestChoices();
setUpFormEntryPrompt(items, "");
SelectItemClickListener listener = mock(SelectItemClickListener.class);
SelectOneListAdapter adapter = new SelectOneListAdapter(null, listener, activityController.get(), items, formEntryPrompt, null, null, 0, 1, false, 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 whenClickOneElementTwice_shouldThatElementRemainSelectedInSelectOneButtonsMode.
@Test
public void whenClickOneElementTwice_shouldThatElementRemainSelectedInSelectOneButtonsMode() {
List<SelectChoice> items = getTestChoices();
setUpFormEntryPrompt(items, "");
SelectItemClickListener listener = mock(SelectItemClickListener.class);
SelectOneListAdapter adapter = new SelectOneListAdapter(null, listener, activityController.get(), items, formEntryPrompt, null, null, 0, 1, false, mock(MediaUtils.class));
initRecyclerView(adapter, false);
// Select AAA
clickChoice(0);
assertThat(isItemSelected(0), is(true));
assertThat(isItemSelected(1), is(false));
// Select AAA again
clickChoice(0);
assertThat(isItemSelected(0), is(true));
assertThat(isItemSelected(1), is(false));
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenClickOneElementTwice_shouldThatElementRemainSelectedInSelectOneNoButtonsMode.
@Test
public void whenClickOneElementTwice_shouldThatElementRemainSelectedInSelectOneNoButtonsMode() {
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 AAA again
clickChoice(0);
assertThat(isItemSelected(0), is(true));
assertThat(isItemSelected(1), is(false));
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenChoicesFiltered_shouldProperValuesBeReturnedInSelectOneButtonsMode.
@Test
public void whenChoicesFiltered_shouldProperValuesBeReturnedInSelectOneButtonsMode() {
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);
assertVisibleItemsInButtonsMode("AAA", "BBB");
filterList(adapter, "b");
assertVisibleItemsInButtonsMode("BBB");
filterList(adapter, "bc");
assertVisibleItemsInButtonsMode();
filterList(adapter, "b");
assertVisibleItemsInButtonsMode("BBB");
filterList(adapter, "");
assertVisibleItemsInButtonsMode("AAA", "BBB");
}
use of org.odk.collect.android.adapters.SelectOneListAdapter in project collect by opendatakit.
the class ChoicesRecyclerViewTest method whenNonFLexAppearanceIsUsed_shouldGridLayoutManagerBeUsed.
@Test
public void whenNonFLexAppearanceIsUsed_shouldGridLayoutManagerBeUsed() {
SelectOneListAdapter adapter = new SelectOneListAdapter(null, null, null, new ArrayList<>(), null, null, null, 0, 1, false, mock(MediaUtils.class));
initRecyclerView(adapter, false);
assertThat(recyclerView.getLayoutManager().getClass().getName(), equalTo(GridLayoutManager.class.getName()));
}
Aggregations