MemoryHabitList: Inherit parent's order

Fixes #598
pull/672/head
Alinson S. Xavier 5 years ago
parent 09bf49a9ce
commit 590298bf5b

@ -55,6 +55,7 @@ public class MemoryHabitList extends HabitList
super(matcher);
this.parent = parent;
this.comparator = comparator;
this.order = parent.order;
parent.getObservable().addListener(this::loadFromParent);
loadFromParent();
}

@ -31,8 +31,7 @@ import static junit.framework.TestCase.assertFalse;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.isoron.uhabits.core.models.HabitList.Order.*;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
@SuppressWarnings("JavaDoc")
public class HabitListTest extends BaseUnitTest
@ -211,6 +210,17 @@ public class HabitListTest extends BaseUnitTest
habitList.reorder(h1, h2);
}
@Test
public void testOrder_inherit()
{
habitList.setOrder(BY_COLOR_ASC);
HabitList filteredList = habitList.getFiltered(new HabitMatcherBuilder()
.setArchivedAllowed(false)
.setCompletedAllowed(false)
.build());
assertEquals(filteredList.getOrder(), BY_COLOR_ASC);
}
@Test
public void testWriteCSV() throws IOException
{

Loading…
Cancel
Save