use of org.odk.collect.android.activities.viewmodels.FormMapViewModel in project collect by opendatakit.
the class FormMapViewModelTest method instanceThatFailedToSend_thatCantBeEdited_returnsNotViewableStatus.
// E.g. encrypted forms
@Test
public void instanceThatFailedToSend_thatCantBeEdited_returnsNotViewableStatus() {
FormMapViewModel viewModel = new FormMapViewModel(TEST_FORM_1, testInstancesRepository);
List<FormMapViewModel.MappableFormInstance> instances = viewModel.getMappableFormInstances();
assertThat(instances.get(5).getClickAction(), is(FormMapViewModel.ClickAction.NOT_VIEWABLE_TOAST));
}
use of org.odk.collect.android.activities.viewmodels.FormMapViewModel in project collect by opendatakit.
the class FormMapViewModelTest method finalizedInstance_thatCanBeEdited_hasEditableClickAction.
@Test
public void finalizedInstance_thatCanBeEdited_hasEditableClickAction() {
FormMapViewModel viewModel = new FormMapViewModel(TEST_FORM_1, testInstancesRepository);
List<FormMapViewModel.MappableFormInstance> instances = viewModel.getMappableFormInstances();
assertThat(instances.get(1).getClickAction(), is(FormMapViewModel.ClickAction.OPEN_EDIT));
}
use of org.odk.collect.android.activities.viewmodels.FormMapViewModel in project collect by opendatakit.
the class FormMapViewModelTest method submittedInstance_thatCanBeEdited_returnsViewableStatus.
// Sent instances should never be editable.
@Test
public void submittedInstance_thatCanBeEdited_returnsViewableStatus() {
FormMapViewModel viewModel = new FormMapViewModel(TEST_FORM_1, testInstancesRepository);
List<FormMapViewModel.MappableFormInstance> instances = viewModel.getMappableFormInstances();
assertThat(instances.get(4).getClickAction(), is(FormMapViewModel.ClickAction.OPEN_READ_ONLY));
}
use of org.odk.collect.android.activities.viewmodels.FormMapViewModel in project collect by opendatakit.
the class FormMapViewModelTest method getMappableInstances_excludesInstancesWithoutGeometry.
@Test
public void getMappableInstances_excludesInstancesWithoutGeometry() {
FormMapViewModel viewModel = new FormMapViewModel(TEST_FORM_1, testInstancesRepository);
List<FormMapViewModel.MappableFormInstance> mappableFormInstances = viewModel.getMappableFormInstances();
assertThat(mappableFormInstances.size(), is(6));
assertThat(mappableFormInstances, not(contains(hasProperty("databaseId"), is(3L))));
}
use of org.odk.collect.android.activities.viewmodels.FormMapViewModel in project collect by opendatakit.
the class FormMapViewModelTest method getMappableInstances_excludesInstancesWithCorruptGeometry.
@Test
public void getMappableInstances_excludesInstancesWithCorruptGeometry() {
FormMapViewModel viewModel = new FormMapViewModel(TEST_FORM_2, testInstancesRepository);
List<FormMapViewModel.MappableFormInstance> mappableFormInstances = viewModel.getMappableFormInstances();
assertThat(mappableFormInstances.size(), is(0));
}
Aggregations