mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Fix errors
This commit is contained in:
@@ -203,7 +203,7 @@ public class FrequencyChart extends ScrollableChart
|
|||||||
rect.set(0, 0, baseSize, baseSize);
|
rect.set(0, 0, baseSize, baseSize);
|
||||||
rect.offset(prevRect.left, prevRect.top + baseSize * j);
|
rect.offset(prevRect.left, prevRect.top + baseSize * j);
|
||||||
|
|
||||||
int i = DateUtils.javaWeekdayToLoopWeekday(localeWeekdayList[j]);
|
int i = localeWeekdayList[j] % 7;
|
||||||
if (values != null) drawMarker(canvas, rect, values[i]);
|
if (values != null) drawMarker(canvas, rect, values[i]);
|
||||||
|
|
||||||
rect.offset(0, rowHeight);
|
rect.offset(0, rowHeight);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class CheckmarkListTest extends BaseUnitTest
|
|||||||
{
|
{
|
||||||
private long dayLength;
|
private long dayLength;
|
||||||
|
|
||||||
private long today;
|
private Timestamp today;
|
||||||
|
|
||||||
private Habit nonDailyHabit;
|
private Habit nonDailyHabit;
|
||||||
|
|
||||||
@@ -55,6 +55,7 @@ public class CheckmarkListTest extends BaseUnitTest
|
|||||||
|
|
||||||
numericalHabit = fixtures.createNumericalHabit();
|
numericalHabit = fixtures.createNumericalHabit();
|
||||||
habitList.add(numericalHabit);
|
habitList.add(numericalHabit);
|
||||||
|
today = DateUtils.getToday();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -285,8 +286,8 @@ public class CheckmarkListTest extends BaseUnitTest
|
|||||||
@Test
|
@Test
|
||||||
public void test_getValues_withValidInterval()
|
public void test_getValues_withValidInterval()
|
||||||
{
|
{
|
||||||
long from = today - 15 * dayLength;
|
Timestamp from = today.minus(15);
|
||||||
long to = today - 5 * dayLength;
|
Timestamp to = today.minus(5);
|
||||||
|
|
||||||
int[] expectedValues = {
|
int[] expectedValues = {
|
||||||
CHECKED_EXPLICITLY,
|
CHECKED_EXPLICITLY,
|
||||||
@@ -302,10 +303,7 @@ public class CheckmarkListTest extends BaseUnitTest
|
|||||||
UNCHECKED
|
UNCHECKED
|
||||||
};
|
};
|
||||||
|
|
||||||
int[] actualValues = nonDailyHabit
|
int[] actualValues = nonDailyHabit.getCheckmarks().getValues(from, to);
|
||||||
.getCheckmarks()
|
|
||||||
.getValues(new Timestamp(from), new Timestamp(to));
|
|
||||||
|
|
||||||
assertThat(actualValues, equalTo(expectedValues));
|
assertThat(actualValues, equalTo(expectedValues));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class ListHabitsBehaviorTest extends BaseUnitTest
|
|||||||
@Test
|
@Test
|
||||||
public void testOnStartup_firstLaunch()
|
public void testOnStartup_firstLaunch()
|
||||||
{
|
{
|
||||||
long today = DateUtils.getStartOfToday();
|
Timestamp today = DateUtils.getToday();
|
||||||
|
|
||||||
when(prefs.isFirstRun()).thenReturn(true);
|
when(prefs.isFirstRun()).thenReturn(true);
|
||||||
behavior.onStartup();
|
behavior.onStartup();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
package org.isoron.uhabits.core.utils;
|
package org.isoron.uhabits.core.utils;
|
||||||
|
|
||||||
import org.isoron.uhabits.core.*;
|
import org.isoron.uhabits.core.*;
|
||||||
|
import org.isoron.uhabits.core.models.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -34,7 +35,7 @@ public class DateUtilsTest extends BaseUnitTest
|
|||||||
public void testFormatHeaderDate()
|
public void testFormatHeaderDate()
|
||||||
{
|
{
|
||||||
long timestamp = timestamp(2015, DECEMBER, 31);
|
long timestamp = timestamp(2015, DECEMBER, 31);
|
||||||
GregorianCalendar date = DateUtils.getCalendar(timestamp);
|
GregorianCalendar date = new Timestamp(timestamp).toCalendar();
|
||||||
String formatted = DateUtils.formatHeaderDate(date);
|
String formatted = DateUtils.formatHeaderDate(date);
|
||||||
assertThat(formatted, equalTo("Thu\n31"));
|
assertThat(formatted, equalTo("Thu\n31"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user