mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Merge branch 'dev'
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
VERSION_CODE = 48
|
VERSION_CODE = 49
|
||||||
VERSION_NAME = 1.8.5
|
VERSION_NAME = 1.8.6
|
||||||
|
|
||||||
MIN_SDK_VERSION = 21
|
MIN_SDK_VERSION = 21
|
||||||
TARGET_SDK_VERSION = 29
|
TARGET_SDK_VERSION = 29
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Álinson Santos Xavier <isoron@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Loop Habit Tracker.
|
||||||
|
*
|
||||||
|
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.isoron.uhabits.regression
|
||||||
|
|
||||||
|
import android.support.test.filters.*
|
||||||
|
import org.isoron.uhabits.*
|
||||||
|
import org.isoron.uhabits.acceptance.steps.CommonSteps.*
|
||||||
|
import org.isoron.uhabits.acceptance.steps.CommonSteps.Screen.*
|
||||||
|
import org.isoron.uhabits.acceptance.steps.EditHabitSteps.*
|
||||||
|
import org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*
|
||||||
|
import org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*
|
||||||
|
import org.junit.*
|
||||||
|
|
||||||
|
|
||||||
|
@LargeTest
|
||||||
|
class ListHabitsRegressionTest : BaseUserInterfaceTest() {
|
||||||
|
/**
|
||||||
|
* https://github.com/iSoron/uhabits/issues/539
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@Throws(Exception::class)
|
||||||
|
fun should_not_crash_after_deleting_then_adding_a_habit() {
|
||||||
|
launchApp()
|
||||||
|
verifyShowsScreen(LIST_HABITS)
|
||||||
|
longClickText("Track time")
|
||||||
|
clickMenu(DELETE)
|
||||||
|
clickOK()
|
||||||
|
|
||||||
|
clickMenu(ADD)
|
||||||
|
verifyShowsScreen(EDIT_HABIT)
|
||||||
|
typeName("Hello world")
|
||||||
|
clickSave()
|
||||||
|
|
||||||
|
verifyDisplaysText("Hello world")
|
||||||
|
longPressCheckmarks("Hello world", 3)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
1.8.5
|
1.8.6
|
||||||
* Bugfixes
|
* Bugfixes
|
||||||
1.8:
|
1.8:
|
||||||
* New bar chart showing number of repetitions performed each week, month or year
|
* New bar chart showing number of repetitions performed each week, month or year
|
||||||
|
|||||||
@@ -79,13 +79,14 @@ public class SQLiteHabitList extends HabitList
|
|||||||
{
|
{
|
||||||
loadRecords();
|
loadRecords();
|
||||||
habit.setPosition(size());
|
habit.setPosition(size());
|
||||||
list.add(habit);
|
|
||||||
|
|
||||||
HabitRecord record = new HabitRecord();
|
HabitRecord record = new HabitRecord();
|
||||||
record.copyFrom(habit);
|
record.copyFrom(habit);
|
||||||
repository.save(record);
|
repository.save(record);
|
||||||
|
habit.id = record.id;
|
||||||
rebuildOrder();
|
rebuildOrder();
|
||||||
|
|
||||||
|
list.add(habit);
|
||||||
getObservable().notifyListeners();
|
getObservable().notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class SQLiteHabitListTest extends BaseUnitTest
|
|||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
Habit habit = fixtures.createEmptyHabit();
|
Habit habit = fixtures.createEmptyHabit();
|
||||||
habit.setName("habit " + i);
|
habit.setName("habit " + (i+1));
|
||||||
habitList.update(habit);
|
habitList.update(habit);
|
||||||
habitsArray.add(habit);
|
habitsArray.add(habit);
|
||||||
|
|
||||||
@@ -147,13 +147,13 @@ public class SQLiteHabitListTest extends BaseUnitTest
|
|||||||
@Test
|
@Test
|
||||||
public void testGetById()
|
public void testGetById()
|
||||||
{
|
{
|
||||||
Habit h1 = habitList.getById(0);
|
Habit h1 = habitList.getById(1);
|
||||||
assertNotNull(h1);
|
assertNotNull(h1);
|
||||||
assertThat(h1.getName(), equalTo("habit 0"));
|
assertThat(h1.getName(), equalTo("habit 1"));
|
||||||
|
|
||||||
Habit h2 = habitList.getById(0);
|
Habit h2 = habitList.getById(2);
|
||||||
assertNotNull(h2);
|
assertNotNull(h2);
|
||||||
assertThat(h1, equalTo(h2));
|
assertThat(h2, equalTo(h2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -167,7 +167,7 @@ public class SQLiteHabitListTest extends BaseUnitTest
|
|||||||
@Test
|
@Test
|
||||||
public void testGetByPosition()
|
public void testGetByPosition()
|
||||||
{
|
{
|
||||||
Habit h = habitList.getByPosition(5);
|
Habit h = habitList.getByPosition(4);
|
||||||
assertNotNull(h);
|
assertNotNull(h);
|
||||||
assertThat(h.getName(), equalTo("habit 5"));
|
assertThat(h.getName(), equalTo("habit 5"));
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ public class SQLiteHabitListTest extends BaseUnitTest
|
|||||||
@Test
|
@Test
|
||||||
public void testRemove() throws Exception
|
public void testRemove() throws Exception
|
||||||
{
|
{
|
||||||
Habit h = habitList.getByPosition(2);
|
Habit h = habitList.getById(2);
|
||||||
habitList.remove(h);
|
habitList.remove(h);
|
||||||
assertThat(habitList.indexOf(h), equalTo(-1));
|
assertThat(habitList.indexOf(h), equalTo(-1));
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ public class SQLiteHabitListTest extends BaseUnitTest
|
|||||||
|
|
||||||
rec = repository.find(3L);
|
rec = repository.find(3L);
|
||||||
assertNotNull(rec);
|
assertNotNull(rec);
|
||||||
assertThat(rec.position, equalTo(2));
|
assertThat(rec.position, equalTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -212,11 +212,11 @@ public class SQLiteHabitListTest extends BaseUnitTest
|
|||||||
|
|
||||||
HabitRecord record3 = repository.find(3L);
|
HabitRecord record3 = repository.find(3L);
|
||||||
assertNotNull(record3);
|
assertNotNull(record3);
|
||||||
assertThat(record3.position, equalTo(4));
|
assertThat(record3.position, equalTo(3));
|
||||||
|
|
||||||
HabitRecord record4 = repository.find(4L);
|
HabitRecord record4 = repository.find(4L);
|
||||||
assertNotNull(record4);
|
assertNotNull(record4);
|
||||||
assertThat(record4.position, equalTo(3));
|
assertThat(record4.position, equalTo(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user