Merge branch 'dev' into pull/austil
1
build.sh
@@ -205,6 +205,7 @@ run_local_tests() {
|
|||||||
build_instrumentation_apk
|
build_instrumentation_apk
|
||||||
install_test_butler
|
install_test_butler
|
||||||
install_apk
|
install_apk
|
||||||
|
uninstall_test_apk
|
||||||
install_test_apk
|
install_test_apk
|
||||||
run_instrumented_tests
|
run_instrumented_tests
|
||||||
parse_instrumentation_results
|
parse_instrumentation_results
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 21 KiB |
@@ -121,7 +121,7 @@ public class BaseAndroidTest extends TestCase
|
|||||||
|
|
||||||
protected void awaitLatch() throws InterruptedException
|
protected void awaitLatch() throws InterruptedException
|
||||||
{
|
{
|
||||||
assertTrue(latch.await(60, TimeUnit.SECONDS));
|
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setLocale(@NonNull String language, @NonNull String country)
|
protected void setLocale(@NonNull String language, @NonNull String country)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.isoron.uhabits.pebble;
|
package org.isoron.uhabits.receivers;
|
||||||
|
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
import android.support.annotation.*;
|
import android.support.annotation.*;
|
||||||
@@ -29,12 +29,13 @@ import com.getpebble.android.kit.util.*;
|
|||||||
|
|
||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.isoron.uhabits.core.models.*;
|
import org.isoron.uhabits.core.models.*;
|
||||||
import org.isoron.uhabits.receivers.*;
|
|
||||||
import org.json.*;
|
import org.json.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.runner.*;
|
import org.junit.runner.*;
|
||||||
|
|
||||||
import static com.getpebble.android.kit.Constants.*;
|
import static android.os.Build.VERSION.SDK_INT;
|
||||||
|
import static android.os.Build.VERSION_CODES.KITKAT;
|
||||||
|
import static com.getpebble.android.kit.Constants.MSG_DATA;
|
||||||
import static org.hamcrest.MatcherAssert.*;
|
import static org.hamcrest.MatcherAssert.*;
|
||||||
import static org.hamcrest.core.IsEqual.*;
|
import static org.hamcrest.core.IsEqual.*;
|
||||||
|
|
||||||
@@ -63,6 +64,8 @@ public class PebbleReceiverTest extends BaseAndroidTest
|
|||||||
@Test
|
@Test
|
||||||
public void testCount() throws Exception
|
public void testCount() throws Exception
|
||||||
{
|
{
|
||||||
|
if(SDK_INT <= KITKAT) return;
|
||||||
|
|
||||||
onPebbleReceived((dict) -> {
|
onPebbleReceived((dict) -> {
|
||||||
assertThat(dict.getString(0), equalTo("COUNT"));
|
assertThat(dict.getString(0), equalTo("COUNT"));
|
||||||
assertThat(dict.getInteger(1), equalTo(2L));
|
assertThat(dict.getInteger(1), equalTo(2L));
|
||||||
@@ -76,6 +79,8 @@ public class PebbleReceiverTest extends BaseAndroidTest
|
|||||||
@Test
|
@Test
|
||||||
public void testFetch() throws Exception
|
public void testFetch() throws Exception
|
||||||
{
|
{
|
||||||
|
if(SDK_INT <= KITKAT) return;
|
||||||
|
|
||||||
onPebbleReceived((dict) -> {
|
onPebbleReceived((dict) -> {
|
||||||
assertThat(dict.getString(0), equalTo("HABIT"));
|
assertThat(dict.getString(0), equalTo("HABIT"));
|
||||||
assertThat(dict.getInteger(1), equalTo(habit2.getId()));
|
assertThat(dict.getInteger(1), equalTo(habit2.getId()));
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import javax.annotation.concurrent.*;
|
import javax.annotation.concurrent.*;
|
||||||
|
|
||||||
|
import static java.lang.Math.min;
|
||||||
import static org.isoron.uhabits.core.models.Checkmark.CHECKED_EXPLICITLY;
|
import static org.isoron.uhabits.core.models.Checkmark.CHECKED_EXPLICITLY;
|
||||||
import static org.isoron.uhabits.core.models.Checkmark.CHECKED_IMPLICITLY;
|
import static org.isoron.uhabits.core.models.Checkmark.CHECKED_IMPLICITLY;
|
||||||
import static org.isoron.uhabits.core.models.Checkmark.UNCHECKED;
|
import static org.isoron.uhabits.core.models.Checkmark.UNCHECKED;
|
||||||
@@ -60,8 +61,7 @@ public abstract class CheckmarkList
|
|||||||
long today = DateUtils.getStartOfToday();
|
long today = DateUtils.getStartOfToday();
|
||||||
|
|
||||||
long begin = reps[0].getTimestamp();
|
long begin = reps[0].getTimestamp();
|
||||||
if (intervals.size() > 0)
|
if (intervals.size() > 0) begin = min(begin, intervals.get(0).begin);
|
||||||
begin = Long.min(begin, intervals.get(0).begin);
|
|
||||||
|
|
||||||
int nDays = (int) ((today - begin) / day) + 1;
|
int nDays = (int) ((today - begin) / day) + 1;
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ public abstract class CheckmarkList
|
|||||||
final long today = DateUtils.getStartOfToday();
|
final long today = DateUtils.getStartOfToday();
|
||||||
|
|
||||||
Checkmark newest = getNewestComputed();
|
Checkmark newest = getNewestComputed();
|
||||||
if(newest != null && newest.getTimestamp() == today) return;
|
if (newest != null && newest.getTimestamp() == today) return;
|
||||||
invalidateNewerThan(0);
|
invalidateNewerThan(0);
|
||||||
|
|
||||||
Repetition oldestRep = habit.getRepetitions().getOldest();
|
Repetition oldestRep = habit.getRepetitions().getOldest();
|
||||||
|
|||||||