mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Fix default color and failing tests
This commit is contained in:
@@ -53,7 +53,7 @@ public class HabitFixtures
|
|||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName("Meditate");
|
habit.setName("Meditate");
|
||||||
habit.setDescription("Did you meditate this morning?");
|
habit.setDescription("Did you meditate this morning?");
|
||||||
habit.setColor(3);
|
habit.setColor(5);
|
||||||
habit.setFrequency(Frequency.DAILY);
|
habit.setFrequency(Frequency.DAILY);
|
||||||
habit.setId(id);
|
habit.setId(id);
|
||||||
habitList.add(habit);
|
habitList.add(habit);
|
||||||
@@ -64,7 +64,7 @@ public class HabitFixtures
|
|||||||
{
|
{
|
||||||
Habit habit = createEmptyHabit();
|
Habit habit = createEmptyHabit();
|
||||||
habit.setFrequency(new Frequency(3, 7));
|
habit.setFrequency(new Frequency(3, 7));
|
||||||
habit.setColor(4);
|
habit.setColor(7);
|
||||||
|
|
||||||
long day = DateUtils.millisecondsInOneDay;
|
long day = DateUtils.millisecondsInOneDay;
|
||||||
long today = DateUtils.getStartOfToday();
|
long today = DateUtils.getStartOfToday();
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class NumberButtonViewTest extends BaseViewTest
|
|||||||
view = new NumberButtonView(targetContext);
|
view = new NumberButtonView(targetContext);
|
||||||
view.setUnit("steps");
|
view.setUnit("steps");
|
||||||
view.setThreshold(100.0);
|
view.setThreshold(100.0);
|
||||||
view.setColor(ColorUtils.getAndroidTestColor(5));
|
view.setColor(ColorUtils.getAndroidTestColor(8));
|
||||||
|
|
||||||
measureView(view, dpToPixels(48), dpToPixels(48));
|
measureView(view, dpToPixels(48), dpToPixels(48));
|
||||||
|
|
||||||
|
|||||||
@@ -180,8 +180,8 @@ public class HabitListTest extends BaseAndroidTest
|
|||||||
|
|
||||||
String expectedCSV =
|
String expectedCSV =
|
||||||
"Position,Name,Description,NumRepetitions,Interval,Color\n" +
|
"Position,Name,Description,NumRepetitions,Interval,Color\n" +
|
||||||
"001,Meditate,Did you meditate this morning?,1,1,#F9A825\n" +
|
"001,Meditate,Did you meditate this morning?,1,1,#FF8F00\n" +
|
||||||
"002,Wake up early,Did you wake up before 6am?,2,3,#388E3C\n";
|
"002,Wake up early,Did you wake up before 6am?,2,3,#AFB42B\n";
|
||||||
|
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
habitList.writeCSV(writer);
|
habitList.writeCSV(writer);
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ public class Habit
|
|||||||
|
|
||||||
public HabitData()
|
public HabitData()
|
||||||
{
|
{
|
||||||
this.color = 5;
|
this.color = 8;
|
||||||
this.archived = false;
|
this.archived = false;
|
||||||
this.frequency = new Frequency(3, 7);
|
this.frequency = new Frequency(3, 7);
|
||||||
this.type = YES_NO_HABIT;
|
this.type = YES_NO_HABIT;
|
||||||
|
|||||||
@@ -94,13 +94,13 @@ public class ListHabitsSelectionMenuBehaviorTest extends BaseUnitTest
|
|||||||
@Test
|
@Test
|
||||||
public void onChangeColor() throws Exception
|
public void onChangeColor() throws Exception
|
||||||
{
|
{
|
||||||
assertThat(habit1.getColor(), equalTo(5));
|
assertThat(habit1.getColor(), equalTo(8));
|
||||||
assertThat(habit2.getColor(), equalTo(5));
|
assertThat(habit2.getColor(), equalTo(8));
|
||||||
when(adapter.getSelected()).thenReturn(asList(habit1, habit2));
|
when(adapter.getSelected()).thenReturn(asList(habit1, habit2));
|
||||||
|
|
||||||
behavior.onChangeColor();
|
behavior.onChangeColor();
|
||||||
|
|
||||||
verify(screen).showColorPicker(eq(5), colorPickerCallback.capture());
|
verify(screen).showColorPicker(eq(8), colorPickerCallback.capture());
|
||||||
colorPickerCallback.getValue().onColorPicked(30);
|
colorPickerCallback.getValue().onColorPicked(30);
|
||||||
assertThat(habit1.getColor(), equalTo(30));
|
assertThat(habit1.getColor(), equalTo(30));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user