use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class RecentListUtilTest method testAddEquivalentPath.
@SmallTest
@Test
public void testAddEquivalentPath() {
Option mockOption = mock(Option.class);
when(mockOption.getRecentCount()).thenReturn(7);
// Equivalent path are considered the same
RecentListUtil recentListUtil = new RecentListUtil(getContext(), mockOption);
recentListUtil.addToRecentList("/sdcard/1.db");
recentListUtil.addToRecentList("/sdcard//1.db");
recentListUtil.addToRecentList("//sdcard/1.db");
recentListUtil.addToRecentList("/sdcard/1.db");
recentListUtil.addToRecentList("/sdcard/./2.db");
recentListUtil.addToRecentList("/sdcard//2.db");
String[] recentList = recentListUtil.getAllRecentDBPath();
assertEquals("/sdcard/2.db", recentList[0]);
assertEquals("/sdcard/1.db", recentList[1]);
}
use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class OptionTest method testGetShuffleType.
@SmallTest
@Test
public void testGetShuffleType() {
Option option = new Option(getContext());
editor.putBoolean(AMPrefKeys.SHUFFLING_CARDS_KEY, true);
editor.commit();
assertEquals(Option.ShuffleType.LOCAL, option.getShuffleType());
editor.putBoolean(AMPrefKeys.SHUFFLING_CARDS_KEY, false);
editor.commit();
assertEquals(Option.ShuffleType.NONE, option.getShuffleType());
}
use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class RecentListUtilTest method testDeleteRecentItem.
@SmallTest
@Test
public void testDeleteRecentItem() {
Option mockOption = mock(Option.class);
when(mockOption.getRecentCount()).thenReturn(7);
// Add 5 dbs
RecentListUtil recentListUtil = new RecentListUtil(getContext(), mockOption);
recentListUtil.addToRecentList("/sdcard/1.db");
recentListUtil.addToRecentList("/sdcard/2.db");
recentListUtil.addToRecentList("/sdcard/3.db");
recentListUtil.addToRecentList("/sdcard/4.db");
recentListUtil.addToRecentList("/sdcard/5.db");
recentListUtil.deleteFromRecentList("/sdcard/5.db");
assertEquals("/sdcard/4.db", recentListUtil.getRecentDBPath());
recentListUtil.deleteFromRecentList("/sdcard/2.db");
assertEquals("/sdcard/4.db", recentListUtil.getRecentDBPath());
String[] recentList = recentListUtil.getAllRecentDBPath();
assertEquals("/sdcard/4.db", recentList[0]);
assertEquals("/sdcard/3.db", recentList[1]);
assertEquals("/sdcard/1.db", recentList[2]);
}
use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class RecentListUtilTest method testClearRecentList.
@SmallTest
@Test
public void testClearRecentList() {
Option mockOption = mock(Option.class);
when(mockOption.getRecentCount()).thenReturn(7);
RecentListUtil recentListUtil = new RecentListUtil(getContext(), mockOption);
recentListUtil.addToRecentList("/sdcard/a.db");
recentListUtil.addToRecentList("/sdcard/b.db");
recentListUtil.clearRecentList();
assertNull(recentListUtil.getRecentDBPath());
}
Aggregations