mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-10 02:58:51 -06:00
Rename checkmark values to NO, YES_AUTO, YES_MANUAL and SKIP
This makes the source code consistent with the user interface.
This commit is contained in:
@@ -57,7 +57,7 @@ public class CreateRepetitionCommandTest extends BaseUnitTest
|
||||
|
||||
Repetition rep = reps.getByTimestamp(today);
|
||||
assertNotNull(rep);
|
||||
assertEquals(CHECKED_EXPLICITLY, rep.getValue());
|
||||
assertEquals(YES_MANUAL, rep.getValue());
|
||||
|
||||
command.execute();
|
||||
rep = reps.getByTimestamp(today);
|
||||
@@ -67,7 +67,7 @@ public class CreateRepetitionCommandTest extends BaseUnitTest
|
||||
command.undo();
|
||||
rep = reps.getByTimestamp(today);
|
||||
assertNotNull(rep);
|
||||
assertEquals(CHECKED_EXPLICITLY, rep.getValue());
|
||||
assertEquals(YES_MANUAL, rep.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.*;
|
||||
import nl.jqno.equalsverifier.*;
|
||||
|
||||
import static java.util.Calendar.*;
|
||||
import static junit.framework.TestCase.*;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
import static org.hamcrest.core.IsEqual.*;
|
||||
import static org.isoron.uhabits.core.models.Checkmark.*;
|
||||
@@ -69,10 +68,10 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
public void test_buildCheckmarksFromIntervals_1() throws Exception
|
||||
{
|
||||
Repetition reps[] = new Repetition[]{
|
||||
new Repetition(day(10), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(5), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(2), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(1), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(10), YES_MANUAL),
|
||||
new Repetition(day(5), YES_MANUAL),
|
||||
new Repetition(day(2), YES_MANUAL),
|
||||
new Repetition(day(1), YES_MANUAL),
|
||||
};
|
||||
|
||||
ArrayList<CheckmarkList.Interval> intervals = new ArrayList<>();
|
||||
@@ -81,17 +80,17 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
intervals.add(new CheckmarkList.Interval(day(2), day(2), day(1)));
|
||||
|
||||
List<Checkmark> expected = new ArrayList<>();
|
||||
expected.add(new Checkmark(day(0), UNCHECKED));
|
||||
expected.add(new Checkmark(day(1), CHECKED_EXPLICITLY));
|
||||
expected.add(new Checkmark(day(2), CHECKED_EXPLICITLY));
|
||||
expected.add(new Checkmark(day(3), UNCHECKED));
|
||||
expected.add(new Checkmark(day(4), CHECKED_IMPLICITLY));
|
||||
expected.add(new Checkmark(day(5), CHECKED_EXPLICITLY));
|
||||
expected.add(new Checkmark(day(6), CHECKED_IMPLICITLY));
|
||||
expected.add(new Checkmark(day(7), UNCHECKED));
|
||||
expected.add(new Checkmark(day(8), CHECKED_IMPLICITLY));
|
||||
expected.add(new Checkmark(day(9), CHECKED_IMPLICITLY));
|
||||
expected.add(new Checkmark(day(10), CHECKED_EXPLICITLY));
|
||||
expected.add(new Checkmark(day(0), NO));
|
||||
expected.add(new Checkmark(day(1), YES_MANUAL));
|
||||
expected.add(new Checkmark(day(2), YES_MANUAL));
|
||||
expected.add(new Checkmark(day(3), NO));
|
||||
expected.add(new Checkmark(day(4), YES_AUTO));
|
||||
expected.add(new Checkmark(day(5), YES_MANUAL));
|
||||
expected.add(new Checkmark(day(6), YES_AUTO));
|
||||
expected.add(new Checkmark(day(7), NO));
|
||||
expected.add(new Checkmark(day(8), YES_AUTO));
|
||||
expected.add(new Checkmark(day(9), YES_AUTO));
|
||||
expected.add(new Checkmark(day(10), YES_MANUAL));
|
||||
|
||||
List<Checkmark> actual =
|
||||
CheckmarkList.buildCheckmarksFromIntervals(reps, intervals);
|
||||
@@ -102,14 +101,14 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
public void test_buildCheckmarksFromIntervals_2() throws Exception
|
||||
{
|
||||
Repetition reps[] = new Repetition[]{
|
||||
new Repetition(day(0), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(0), YES_MANUAL),
|
||||
};
|
||||
|
||||
ArrayList<CheckmarkList.Interval> intervals = new ArrayList<>();
|
||||
intervals.add(new CheckmarkList.Interval(day(0), day(0), day(-10)));
|
||||
|
||||
List<Checkmark> expected = new ArrayList<>();
|
||||
expected.add(new Checkmark(day(0), CHECKED_EXPLICITLY));
|
||||
expected.add(new Checkmark(day(0), YES_MANUAL));
|
||||
|
||||
List<Checkmark> actual =
|
||||
CheckmarkList.buildCheckmarksFromIntervals(reps, intervals);
|
||||
@@ -120,9 +119,9 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
public void test_buildIntervals_1() throws Exception
|
||||
{
|
||||
Repetition reps[] = new Repetition[]{
|
||||
new Repetition(day(23), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(18), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(8), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(23), YES_MANUAL),
|
||||
new Repetition(day(18), YES_MANUAL),
|
||||
new Repetition(day(8), YES_MANUAL),
|
||||
};
|
||||
|
||||
ArrayList<CheckmarkList.Interval> expected = new ArrayList<>();
|
||||
@@ -139,9 +138,9 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
public void test_buildIntervals_2() throws Exception
|
||||
{
|
||||
Repetition reps[] = new Repetition[]{
|
||||
new Repetition(day(23), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(18), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(8), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(23), YES_MANUAL),
|
||||
new Repetition(day(18), YES_MANUAL),
|
||||
new Repetition(day(8), YES_MANUAL),
|
||||
};
|
||||
|
||||
ArrayList<CheckmarkList.Interval> expected = new ArrayList<>();
|
||||
@@ -158,11 +157,11 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
public void test_buildIntervals_3() throws Exception
|
||||
{
|
||||
Repetition reps[] = new Repetition[]{
|
||||
new Repetition(day(23), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(22), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(18), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(15), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(8), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(23), YES_MANUAL),
|
||||
new Repetition(day(22), YES_MANUAL),
|
||||
new Repetition(day(18), YES_MANUAL),
|
||||
new Repetition(day(15), YES_MANUAL),
|
||||
new Repetition(day(8), YES_MANUAL),
|
||||
};
|
||||
|
||||
ArrayList<CheckmarkList.Interval> expected = new ArrayList<>();
|
||||
@@ -181,9 +180,9 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
public void test_buildIntervals_4() throws Exception
|
||||
{
|
||||
Repetition[] reps = new Repetition[]{
|
||||
new Repetition(day(30), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(20), SKIPPED),
|
||||
new Repetition(day(10), CHECKED_EXPLICITLY),
|
||||
new Repetition(day(30), YES_MANUAL),
|
||||
new Repetition(day(20), SKIP),
|
||||
new Repetition(day(10), YES_MANUAL),
|
||||
};
|
||||
|
||||
ArrayList<CheckmarkList.Interval> expected = new ArrayList<>();
|
||||
@@ -201,13 +200,13 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
travelInTime(-3);
|
||||
|
||||
int[] expectedValues = {
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY
|
||||
YES_MANUAL,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL,
|
||||
YES_AUTO,
|
||||
YES_AUTO,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL
|
||||
};
|
||||
|
||||
int[] actualValues = nonDailyHabit.getCheckmarks().getAllValues();
|
||||
@@ -221,19 +220,19 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
travelInTime(3);
|
||||
|
||||
int[] expectedValues = {
|
||||
UNCHECKED,
|
||||
UNCHECKED,
|
||||
UNCHECKED,
|
||||
CHECKED_EXPLICITLY,
|
||||
UNCHECKED,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY
|
||||
NO,
|
||||
NO,
|
||||
NO,
|
||||
YES_MANUAL,
|
||||
NO,
|
||||
YES_AUTO,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL,
|
||||
YES_AUTO,
|
||||
YES_AUTO,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL
|
||||
};
|
||||
|
||||
int[] actualValues = nonDailyHabit.getCheckmarks().getAllValues();
|
||||
@@ -254,16 +253,16 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
public void test_getAllValues_withNonDailyHabit()
|
||||
{
|
||||
int[] expectedValues = {
|
||||
CHECKED_EXPLICITLY,
|
||||
UNCHECKED,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY
|
||||
YES_MANUAL,
|
||||
NO,
|
||||
YES_AUTO,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL,
|
||||
YES_AUTO,
|
||||
YES_AUTO,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL
|
||||
};
|
||||
|
||||
int[] actualValues = nonDailyHabit.getCheckmarks().getAllValues();
|
||||
@@ -291,13 +290,13 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
CheckmarkList checkmarks = nonDailyHabit.getCheckmarks();
|
||||
|
||||
travelInTime(-1);
|
||||
assertThat(checkmarks.getTodayValue(), equalTo(UNCHECKED));
|
||||
assertThat(checkmarks.getTodayValue(), equalTo(NO));
|
||||
|
||||
travelInTime(0);
|
||||
assertThat(checkmarks.getTodayValue(), equalTo(CHECKED_EXPLICITLY));
|
||||
assertThat(checkmarks.getTodayValue(), equalTo(YES_MANUAL));
|
||||
|
||||
travelInTime(1);
|
||||
assertThat(checkmarks.getTodayValue(), equalTo(UNCHECKED));
|
||||
assertThat(checkmarks.getTodayValue(), equalTo(NO));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -316,17 +315,17 @@ public class CheckmarkListTest extends BaseUnitTest
|
||||
Timestamp to = today.minus(5);
|
||||
|
||||
int[] expectedValues = {
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_IMPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
CHECKED_EXPLICITLY,
|
||||
UNCHECKED,
|
||||
UNCHECKED,
|
||||
UNCHECKED,
|
||||
UNCHECKED,
|
||||
UNCHECKED,
|
||||
UNCHECKED
|
||||
YES_MANUAL,
|
||||
YES_AUTO,
|
||||
YES_AUTO,
|
||||
YES_MANUAL,
|
||||
YES_MANUAL,
|
||||
NO,
|
||||
NO,
|
||||
NO,
|
||||
NO,
|
||||
NO,
|
||||
NO
|
||||
};
|
||||
|
||||
int[] actualValues = nonDailyHabit.getCheckmarks().getValues(from, to);
|
||||
|
||||
@@ -70,12 +70,12 @@ public class SQLiteRepetitionListTest extends BaseUnitTest
|
||||
RepetitionRecord record = getByTimestamp(today.plus(1));
|
||||
assertNull(record);
|
||||
|
||||
Repetition rep = new Repetition(today.plus(1), CHECKED_EXPLICITLY);
|
||||
Repetition rep = new Repetition(today.plus(1), YES_MANUAL);
|
||||
habit.getRepetitions().add(rep);
|
||||
|
||||
record = getByTimestamp(today.plus(1));
|
||||
assertNotNull(record);
|
||||
assertThat(record.value, equalTo(CHECKED_EXPLICITLY));
|
||||
assertThat(record.value, equalTo(YES_MANUAL));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -84,7 +84,7 @@ public class HabitCardListCacheTest extends BaseUnitTest
|
||||
{
|
||||
Habit h2 = habitList.getByPosition(2);
|
||||
Timestamp today = DateUtils.getToday();
|
||||
commandRunner.execute(new CreateRepetitionCommand(habitList, h2, today, Checkmark.UNCHECKED), h2.getId());
|
||||
commandRunner.execute(new CreateRepetitionCommand(habitList, h2, today, Checkmark.NO), h2.getId());
|
||||
verify(listener).onItemChanged(2);
|
||||
verify(listener).onRefreshFinished();
|
||||
verifyNoMoreInteractions(listener);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class ListHabitsBehaviorTest extends BaseUnitTest
|
||||
public void testOnToggle()
|
||||
{
|
||||
assertTrue(habit1.isCompletedToday());
|
||||
behavior.onToggle(habit1, DateUtils.getToday(), Checkmark.UNCHECKED);
|
||||
behavior.onToggle(habit1, DateUtils.getToday(), Checkmark.NO);
|
||||
assertFalse(habit1.isCompletedToday());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user