use of com.armueller.fluxytodo.actions.ViewAction in project FluxyAndroidTodo by armueller.
the class TodosActivityStoreTest method setEditModeActiveForTodoIdTest.
@Test(timeout = 100)
public void setEditModeActiveForTodoIdTest() {
final AtomicBoolean testDone = new AtomicBoolean(false);
DataBundle<ViewAction.DataKeys> bundle = new DataBundle<>();
bundle.put(ViewAction.DataKeys.ID, 2);
dataBus.post(new ViewAction(ViewAction.ActionTypes.MARK_EDITABLE, bundle));
dataBus.register(new Object() {
@Subscribe
public void onListUpdated(Long todoId) {
assertThat(todoId).isEqualTo(2);
testDone.set(true);
}
});
// Wait for test to finish or timeout
while (!testDone.get()) ;
}
use of com.armueller.fluxytodo.actions.ViewAction in project FluxyAndroidTodo by armueller.
the class TodosActivityStoreTest method changeActiveFilterToAllTest.
@Test(timeout = 100)
public void changeActiveFilterToAllTest() {
final AtomicBoolean testDone = new AtomicBoolean(false);
ArrayList<TodoItem> list = new ArrayList<TodoItem>();
list.add(new TodoItem(1, "Test", false));
list.add(new TodoItem(2, "Test", true));
list.add(new TodoItem(3, "Test", false));
RawTodoList rawTodoList = new RawTodoList(list);
dataBus.post(rawTodoList);
dataBus.register(new Object() {
@Subscribe
public void onListUpdated(FilteredTodoList filteredTodoList) {
assertThat(filteredTodoList.list.size()).isEqualTo(3);
assertThat(filteredTodoList.filter).isEqualTo(FilteredTodoList.Filter.ALL);
testDone.set(true);
}
});
dataBus.post(new ViewAction(ViewAction.ActionTypes.VIEW_ALL));
// Wait for test to finish or timeout
while (!testDone.get()) ;
}
use of com.armueller.fluxytodo.actions.ViewAction in project FluxyAndroidTodo by armueller.
the class TodosActivityStoreTest method changeActiveFilterToActiveTest.
@Test(timeout = 100)
public void changeActiveFilterToActiveTest() {
final AtomicBoolean testDone = new AtomicBoolean(false);
ArrayList<TodoItem> list = new ArrayList<TodoItem>();
list.add(new TodoItem(1, "Test", false));
list.add(new TodoItem(2, "Test", true));
list.add(new TodoItem(3, "Test", false));
RawTodoList rawTodoList = new RawTodoList(list);
dataBus.post(rawTodoList);
dataBus.register(new Object() {
@Subscribe
public void onListUpdated(FilteredTodoList filteredTodoList) {
assertThat(filteredTodoList.list.size()).isEqualTo(2);
assertThat(filteredTodoList.filter).isEqualTo(FilteredTodoList.Filter.ACTIVE);
testDone.set(true);
}
});
dataBus.post(new ViewAction(ViewAction.ActionTypes.VIEW_ACTIVE));
// Wait for test to finish or timeout
while (!testDone.get()) ;
}
use of com.armueller.fluxytodo.actions.ViewAction in project FluxyAndroidTodo by armueller.
the class TodosActivityStoreTest method changeActiveFilterToCompleteTest.
@Test(timeout = 100)
public void changeActiveFilterToCompleteTest() {
final AtomicBoolean testDone = new AtomicBoolean(false);
ArrayList<TodoItem> list = new ArrayList<TodoItem>();
list.add(new TodoItem(1, "Test", false));
list.add(new TodoItem(2, "Test", true));
list.add(new TodoItem(3, "Test", false));
RawTodoList rawTodoList = new RawTodoList(list);
dataBus.post(rawTodoList);
dataBus.register(new Object() {
@Subscribe
public void onListUpdated(FilteredTodoList filteredTodoList) {
assertThat(filteredTodoList.list.size()).isEqualTo(1);
assertThat(filteredTodoList.filter).isEqualTo(FilteredTodoList.Filter.COMPLETE);
testDone.set(true);
}
});
dataBus.post(new ViewAction(ViewAction.ActionTypes.VIEW_COMPLETE));
// Wait for test to finish or timeout
while (!testDone.get()) ;
}
Aggregations