Fix subtasks moving tests

pull/820/head
Alex Baker 6 years ago
parent 5d3b72c54b
commit 697951a7e4

@ -66,8 +66,6 @@ public class SubtasksHelperTest extends SubtasksTestCase {
@Override @Override
protected void inject(TestComponent component) { protected void inject(TestComponent component) {
super.inject(component);
component.inject(this); component.inject(this);
} }
} }

@ -4,10 +4,10 @@ import androidx.test.runner.AndroidJUnit4;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import javax.inject.Inject; import javax.inject.Inject;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.tasks.data.TaskListMetadata; import org.tasks.data.TaskListMetadata;
import org.tasks.injection.TestComponent;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class SubtasksMovingTest extends SubtasksTestCase { public class SubtasksMovingTest extends SubtasksTestCase {
@ -16,8 +16,8 @@ public class SubtasksMovingTest extends SubtasksTestCase {
private Task A, B, C, D, E, F; private Task A, B, C, D, E, F;
// @Override @Override
protected void disabled_setUp() { public void setUp() {
super.setUp(); super.setUp();
createTasks(); createTasks();
TaskListMetadata m = new TaskListMetadata(); TaskListMetadata m = new TaskListMetadata();
@ -34,6 +34,11 @@ public class SubtasksMovingTest extends SubtasksTestCase {
expectParentAndPosition(F, null, 2); expectParentAndPosition(F, null, 2);
} }
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
private void createTasks() { private void createTasks() {
A = createTask("A"); A = createTask("A");
B = createTask("B"); B = createTask("B");
@ -65,7 +70,6 @@ public class SubtasksMovingTest extends SubtasksTestCase {
* F * F
*/ */
@Ignore
@Test @Test
public void testMoveBeforeIntoSelf() { // Should have no effect public void testMoveBeforeIntoSelf() { // Should have no effect
whenTriggerMoveBefore(A, B); whenTriggerMoveBefore(A, B);
@ -78,7 +82,6 @@ public class SubtasksMovingTest extends SubtasksTestCase {
expectParentAndPosition(F, null, 2); expectParentAndPosition(F, null, 2);
} }
@Ignore
@Test @Test
public void testMoveIntoDescendant() { // Should have no effect public void testMoveIntoDescendant() { // Should have no effect
whenTriggerMoveBefore(A, C); whenTriggerMoveBefore(A, C);
@ -91,7 +94,6 @@ public class SubtasksMovingTest extends SubtasksTestCase {
expectParentAndPosition(F, null, 2); expectParentAndPosition(F, null, 2);
} }
@Ignore
@Test @Test
public void testMoveToEndOfChildren() { // Should have no effect public void testMoveToEndOfChildren() { // Should have no effect
whenTriggerMoveBefore(A, E); whenTriggerMoveBefore(A, E);
@ -104,7 +106,6 @@ public class SubtasksMovingTest extends SubtasksTestCase {
expectParentAndPosition(F, null, 2); expectParentAndPosition(F, null, 2);
} }
@Ignore
@Test @Test
public void testStandardMove() { public void testStandardMove() {
whenTriggerMoveBefore(A, F); whenTriggerMoveBefore(A, F);
@ -117,7 +118,6 @@ public class SubtasksMovingTest extends SubtasksTestCase {
expectParentAndPosition(F, null, 2); expectParentAndPosition(F, null, 2);
} }
@Ignore
@Test @Test
public void testMoveToEndOfList() { public void testMoveToEndOfList() {
whenTriggerMoveBefore(A, null); whenTriggerMoveBefore(A, null);

@ -12,7 +12,6 @@ import com.todoroo.astrid.subtasks.SubtasksFilterUpdater.Node;
import javax.inject.Inject; import javax.inject.Inject;
import org.tasks.data.TaskListMetadataDao; import org.tasks.data.TaskListMetadataDao;
import org.tasks.injection.InjectingTestCase; import org.tasks.injection.InjectingTestCase;
import org.tasks.injection.TestComponent;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
/** /**
@ -20,7 +19,7 @@ import org.tasks.preferences.Preferences;
* *
* @author Sam * @author Sam
*/ */
public class SubtasksTestCase extends InjectingTestCase { public abstract class SubtasksTestCase extends InjectingTestCase {
/* Starting State: /* Starting State:
* *
@ -46,11 +45,6 @@ public class SubtasksTestCase extends InjectingTestCase {
updater = new SubtasksFilterUpdater(taskListMetadataDao, taskDao); updater = new SubtasksFilterUpdater(taskListMetadataDao, taskDao);
} }
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
void expectParentAndPosition(Task task, Task parent, int positionInParent) { void expectParentAndPosition(Task task, Task parent, int positionInParent) {
String parentId = (parent == null ? "-1" : parent.getUuid()); String parentId = (parent == null ? "-1" : parent.getUuid());
Node n = updater.findNodeForTask(task.getUuid()); Node n = updater.findNodeForTask(task.getUuid());

@ -13,7 +13,7 @@ import com.todoroo.astrid.repeats.RepeatTaskHelperTest;
import com.todoroo.astrid.service.QuickAddMarkupTest; import com.todoroo.astrid.service.QuickAddMarkupTest;
import com.todoroo.astrid.service.TitleParserTest; import com.todoroo.astrid.service.TitleParserTest;
import com.todoroo.astrid.subtasks.SubtasksHelperTest; import com.todoroo.astrid.subtasks.SubtasksHelperTest;
import com.todoroo.astrid.subtasks.SubtasksTestCase; import com.todoroo.astrid.subtasks.SubtasksMovingTest;
import com.todoroo.astrid.sync.NewSyncTestCase; import com.todoroo.astrid.sync.NewSyncTestCase;
import dagger.Component; import dagger.Component;
import org.tasks.data.DeletionDaoTests; import org.tasks.data.DeletionDaoTests;
@ -39,7 +39,7 @@ public interface TestComponent extends ApplicationComponent {
void inject(NewSyncTestCase newSyncTestCase); void inject(NewSyncTestCase newSyncTestCase);
void inject(SubtasksTestCase subtasksTestCase); void inject(SubtasksMovingTest subtasksTestCase);
void inject(SubtasksHelperTest subtasksHelperTest); void inject(SubtasksHelperTest subtasksHelperTest);

Loading…
Cancel
Save