mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Opt-in skips: Update tests
This commit is contained in:
@@ -56,6 +56,7 @@ public class HistoryChartTest extends BaseViewTest
|
|||||||
today = new Timestamp(DateUtils.getStartOfToday());
|
today = new Timestamp(DateUtils.getStartOfToday());
|
||||||
|
|
||||||
chart = new HistoryChart(targetContext);
|
chart = new HistoryChart(targetContext);
|
||||||
|
chart.setSkipEnabled(true);
|
||||||
chart.setCheckmarks(habit.getCheckmarks().getAllValues());
|
chart.setCheckmarks(habit.getCheckmarks().getAllValues());
|
||||||
chart.setColor(PaletteUtils.getAndroidTestColor(habit.getColor()));
|
chart.setColor(PaletteUtils.getAndroidTestColor(habit.getColor()));
|
||||||
measureView(chart, dpToPixels(400), dpToPixels(200));
|
measureView(chart, dpToPixels(400), dpToPixels(200));
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class CheckmarkWidgetTest extends BaseViewTest
|
|||||||
super.setUp();
|
super.setUp();
|
||||||
setTheme(R.style.WidgetTheme);
|
setTheme(R.style.WidgetTheme);
|
||||||
prefs.setWidgetOpacity(255);
|
prefs.setWidgetOpacity(255);
|
||||||
|
prefs.setSkipEnabled(true);
|
||||||
|
|
||||||
habit = fixtures.createVeryLongHabit();
|
habit = fixtures.createVeryLongHabit();
|
||||||
checkmarks = habit.getCheckmarks();
|
checkmarks = habit.getCheckmarks();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package org.isoron.uhabits.receivers;
|
|||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.isoron.uhabits.core.commands.*;
|
import org.isoron.uhabits.core.commands.*;
|
||||||
import org.isoron.uhabits.core.models.*;
|
import org.isoron.uhabits.core.models.*;
|
||||||
|
import org.isoron.uhabits.core.preferences.*;
|
||||||
import org.isoron.uhabits.core.ui.*;
|
import org.isoron.uhabits.core.ui.*;
|
||||||
import org.isoron.uhabits.core.ui.widgets.*;
|
import org.isoron.uhabits.core.ui.widgets.*;
|
||||||
import org.isoron.uhabits.core.utils.*;
|
import org.isoron.uhabits.core.utils.*;
|
||||||
@@ -44,6 +45,8 @@ public class WidgetControllerTest extends BaseAndroidJVMTest
|
|||||||
|
|
||||||
private NotificationTray notificationTray;
|
private NotificationTray notificationTray;
|
||||||
|
|
||||||
|
private Preferences preferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp()
|
public void setUp()
|
||||||
{
|
{
|
||||||
@@ -53,8 +56,9 @@ public class WidgetControllerTest extends BaseAndroidJVMTest
|
|||||||
habit = fixtures.createEmptyHabit();
|
habit = fixtures.createEmptyHabit();
|
||||||
commandRunner = mock(CommandRunner.class);
|
commandRunner = mock(CommandRunner.class);
|
||||||
notificationTray = mock(NotificationTray.class);
|
notificationTray = mock(NotificationTray.class);
|
||||||
|
preferences = mock(Preferences.class);
|
||||||
controller =
|
controller =
|
||||||
new WidgetBehavior(habitList, commandRunner, notificationTray);
|
new WidgetBehavior(habitList, commandRunner, notificationTray, preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -343,6 +343,11 @@ public class Preferences
|
|||||||
return storage.getBoolean("pref_skip_enabled", false);
|
return storage.getBoolean("pref_skip_enabled", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSkipEnabled(boolean value)
|
||||||
|
{
|
||||||
|
storage.putBoolean("pref_skip_enabled", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return An integer representing the first day of the week. Sunday
|
* @return An integer representing the first day of the week. Sunday
|
||||||
|
|||||||
Reference in New Issue
Block a user