Move ListHabits controllers to uhabits-core

This commit is contained in:
2017-05-27 12:11:05 -04:00
parent 94c70485b7
commit 70423ddb0a
60 changed files with 799 additions and 367 deletions

View File

@@ -23,10 +23,10 @@ import android.view.*;
import org.isoron.androidbase.activities.*;
import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.*;
import org.isoron.uhabits.activities.habits.list.model.*;
import org.isoron.uhabits.models.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.ui.*;
import org.junit.*;
import org.mockito.*;
@@ -63,7 +63,7 @@ public class ListHabitsMenuTest extends BaseAndroidTest
when(preferences.getShowCompleted()).thenReturn(false);
when(themeSwitcher.isNightMode()).thenReturn(false);
menu = new ListHabitsMenu(activity, screen, adapter, preferences,
menu = new ListHabitsMenu(activity, preferences,
themeSwitcher);
matcherCaptor = ArgumentCaptor.forClass(HabitMatcher.class);

View File

@@ -24,7 +24,6 @@ import android.content.*;
import org.isoron.androidbase.activities.*;
import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.*;
import org.isoron.uhabits.activities.common.dialogs.*;
import org.isoron.uhabits.activities.common.dialogs.ColorPickerDialog.*;
import org.isoron.uhabits.activities.habits.edit.*;
@@ -32,6 +31,7 @@ import org.isoron.uhabits.commands.*;
import org.isoron.uhabits.intents.*;
import org.isoron.uhabits.models.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.ui.*;
import org.junit.*;
import org.junit.runner.*;
import org.junit.runners.*;
@@ -89,7 +89,7 @@ public class ListHabitsScreenTest extends BaseAndroidTest
screen = spy(new ListHabitsScreen(activity, commandRunner, rootView,
intentFactory, themeSwitcher, confirmDeleteDialogFactory,
colorPickerDialogFactory, dialogFactory, prefs, commandParser));
colorPickerDialogFactory, dialogFactory, prefs));
doNothing().when(screen).showMessage(anyInt());
@@ -122,7 +122,7 @@ public class ListHabitsScreenTest extends BaseAndroidTest
public void testOnCommand()
{
Command c = mock(Command.class);
when(commandParser.getExecuteString(c)).thenReturn(
when(getExecuteString(c)).thenReturn(
R.string.toast_habit_deleted);
screen.onCommandExecuted(c, null);
verify(screen).showMessage(R.string.toast_habit_deleted);
@@ -251,10 +251,9 @@ public class ListHabitsScreenTest extends BaseAndroidTest
}
@Test
public void testToggleNightMode()
public void testApplyTheme()
{
screen.toggleNightMode();
verify(themeSwitcher).toggleNightMode();
screen.applyTheme();
verify(activity).restartWithFade(ListHabitsActivity.class);
}
}

View File

@@ -20,8 +20,8 @@
package org.isoron.uhabits.activities.habits.list.controllers;
import org.isoron.uhabits.*;
import org.isoron.uhabits.models.*;
import org.isoron.uhabits.activities.habits.list.model.*;
import org.isoron.uhabits.models.*;
import org.isoron.uhabits.activities.habits.list.views.*;
import org.junit.*;

View File

@@ -23,6 +23,7 @@ import org.isoron.uhabits.*;
import org.isoron.uhabits.commands.*;
import org.isoron.uhabits.models.*;
import org.isoron.uhabits.tasks.*;
import org.isoron.uhabits.ui.screens.habits.list.*;
import org.isoron.uhabits.utils.*;
import org.junit.*;

View File

@@ -23,7 +23,7 @@ import android.support.test.runner.*;
import android.test.suitebuilder.annotation.*;
import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.habits.list.model.*;
import org.isoron.uhabits.ui.screens.habits.list.*;
import org.junit.*;
import org.junit.runner.*;

View File

@@ -35,7 +35,7 @@ public class ReminderControllerTest extends BaseAndroidTest
private ReminderScheduler reminderScheduler;
private NotificationTray notificationTray;
private AndroidNotificationTray notificationTray;
private AndroidPreferences preferences;
@@ -45,7 +45,7 @@ public class ReminderControllerTest extends BaseAndroidTest
super.setUp();
reminderScheduler = mock(ReminderScheduler.class);
notificationTray = mock(NotificationTray.class);
notificationTray = mock(AndroidNotificationTray.class);
preferences = mock(AndroidPreferences.class);
controller = new ReminderController(reminderScheduler,

View File

@@ -23,6 +23,7 @@ import org.isoron.uhabits.*;
import org.isoron.uhabits.commands.*;
import org.isoron.uhabits.models.*;
import org.isoron.uhabits.notifications.*;
import org.isoron.uhabits.ui.widgets.*;
import org.isoron.uhabits.utils.*;
import org.junit.*;
@@ -33,7 +34,7 @@ import static org.mockito.Mockito.*;
public class WidgetControllerTest extends BaseAndroidTest
{
private WidgetController controller;
private WidgetBehavior controller;
private CommandRunner commandRunner;
@@ -41,7 +42,7 @@ public class WidgetControllerTest extends BaseAndroidTest
private long today;
private NotificationTray notificationTray;
private AndroidNotificationTray notificationTray;
@Override
public void setUp()
@@ -52,8 +53,8 @@ public class WidgetControllerTest extends BaseAndroidTest
habit = fixtures.createEmptyHabit();
habitList.add(habit);
commandRunner = mock(CommandRunner.class);
notificationTray = mock(NotificationTray.class);
controller = new WidgetController(commandRunner, notificationTray);
notificationTray = mock(AndroidNotificationTray.class);
controller = new WidgetBehavior(commandRunner, notificationTray);
}
@Test