use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class OptionTest method testGetDictApp.
@SmallTest
@Test
public void testGetDictApp() {
Option option = new Option(getContext());
editor.putString(AMPrefKeys.DICT_APP_KEY, "COLORDICT");
editor.commit();
assertEquals(Option.DictApp.COLORDICT, option.getDictApp());
editor.putString(AMPrefKeys.DICT_APP_KEY, "FORA");
editor.commit();
assertEquals(Option.DictApp.FORA, option.getDictApp());
editor.putString(AMPrefKeys.DICT_APP_KEY, "BLUEDICT");
editor.commit();
assertEquals(Option.DictApp.BLUEDICT, option.getDictApp());
}
use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class OptionTest method testGetButtonStyle.
@SmallTest
@Test
public void testGetButtonStyle() {
Option option = new Option(getContext());
editor.putString(AMPrefKeys.BUTTON_STYLE_KEY, "ANYMEMO");
editor.commit();
assertEquals(Option.ButtonStyle.ANYMEMO, option.getButtonStyle());
editor.putString(AMPrefKeys.BUTTON_STYLE_KEY, "MNEMOSYNE");
editor.commit();
assertEquals(Option.ButtonStyle.MNEMOSYNE, option.getButtonStyle());
editor.putString(AMPrefKeys.BUTTON_STYLE_KEY, "ANKI");
editor.commit();
assertEquals(Option.ButtonStyle.ANKI, option.getButtonStyle());
}
use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class OptionTest method testGetSpeakingType.
@SmallTest
@Test
public void testGetSpeakingType() {
Option option = new Option(getContext());
editor.putString(AMPrefKeys.SPEECH_CONTROL_KEY, "TAP");
editor.commit();
assertEquals(Option.SpeakingType.TAP, option.getSpeakingType());
editor.putString(AMPrefKeys.SPEECH_CONTROL_KEY, "AUTO");
editor.commit();
assertEquals(Option.SpeakingType.AUTO, option.getSpeakingType());
editor.putString(AMPrefKeys.SPEECH_CONTROL_KEY, "MANUAL");
editor.commit();
assertEquals(Option.SpeakingType.MANUAL, option.getSpeakingType());
editor.putString(AMPrefKeys.SPEECH_CONTROL_KEY, "AUTOTAP");
editor.commit();
assertEquals(Option.SpeakingType.AUTOTAP, option.getSpeakingType());
}
use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class RecentListUtilTest method testAddRecentListWithinLimit.
@SmallTest
@Test
public void testAddRecentListWithinLimit() {
Option mockOption = mock(Option.class);
when(mockOption.getRecentCount()).thenReturn(7);
RecentListUtil recentListUtil = new RecentListUtil(getContext(), mockOption);
recentListUtil.addToRecentList("/sdcard/a.db");
assertEquals("/sdcard/a.db", recentListUtil.getRecentDBPath());
recentListUtil.addToRecentList("/sdcard/b.db");
String[] recentList = recentListUtil.getAllRecentDBPath();
assertEquals("/sdcard/b.db", recentList[0]);
assertEquals("/sdcard/a.db", recentList[1]);
}
use of org.liberty.android.fantastischmemo.entity.Option in project AnyMemo by helloworld1.
the class RecentListUtilTest method testAddRecentListLargerThanLimit.
@SmallTest
@Test
public void testAddRecentListLargerThanLimit() {
// Mock recent count limit to 3.
Option mockOption = mock(Option.class);
when(mockOption.getRecentCount()).thenReturn(3);
// 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");
// Only 3 should be in recent list
String[] recentList = recentListUtil.getAllRecentDBPath();
assertEquals(3, recentList.length);
assertEquals("/sdcard/5.db", recentList[0]);
assertEquals("/sdcard/4.db", recentList[1]);
assertEquals("/sdcard/3.db", recentList[2]);
}
Aggregations