Search in sources :

Example 81 with SmallTest

use of android.support.test.filters.SmallTest 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());
}
Also used : Option(org.liberty.android.fantastischmemo.entity.Option) SmallTest(android.support.test.filters.SmallTest) AbstractPreferencesTest(org.liberty.android.fantastischmemo.test.AbstractPreferencesTest) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 82 with SmallTest

use of android.support.test.filters.SmallTest 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());
}
Also used : Option(org.liberty.android.fantastischmemo.entity.Option) SmallTest(android.support.test.filters.SmallTest) AbstractPreferencesTest(org.liberty.android.fantastischmemo.test.AbstractPreferencesTest) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 83 with SmallTest

use of android.support.test.filters.SmallTest 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());
}
Also used : Option(org.liberty.android.fantastischmemo.entity.Option) SmallTest(android.support.test.filters.SmallTest) AbstractPreferencesTest(org.liberty.android.fantastischmemo.test.AbstractPreferencesTest) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 84 with SmallTest

use of android.support.test.filters.SmallTest in project AnyMemo by helloworld1.

the class CardProviderTest method testCardCount.

@SmallTest
@Test
public void testCardCount() {
    ContentResolver cr = getContext().getContentResolver();
    Cursor cursor = cr.query(Uri.parse("content://" + AUTHORITY + "/" + TestHelper.SAMPLE_DB_NAME + "/count"), null, null, null, null);
    assertEquals(1, cursor.getCount());
    assertTrue(cursor.moveToFirst());
    assertEquals(28, cursor.getInt(0));
}
Also used : Cursor(android.database.Cursor) ContentResolver(android.content.ContentResolver) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 85 with SmallTest

use of android.support.test.filters.SmallTest in project AnyMemo by helloworld1.

the class CardProviderTest method testGetCardWithStartOrdinalAndCount.

@SmallTest
@Test
public void testGetCardWithStartOrdinalAndCount() {
    ContentResolver cr = getContext().getContentResolver();
    Cursor cursor = cr.query(Uri.parse("content://" + AUTHORITY + "/" + TestHelper.SAMPLE_DB_NAME + "/start_ordinal/3/count/5"), null, null, null, null);
    assertEquals(5, cursor.getCount());
    assertTrue(cursor.moveToFirst());
    assertEquals(3, cursor.getInt(cursor.getColumnIndex("ordinal")));
    assertEquals("face", cursor.getString(cursor.getColumnIndex("question")));
    assertEquals("le visage", cursor.getString(cursor.getColumnIndex("answer")));
    assertTrue(cursor.moveToNext());
    assertEquals(4, cursor.getInt(cursor.getColumnIndex("ordinal")));
}
Also used : Cursor(android.database.Cursor) ContentResolver(android.content.ContentResolver) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Aggregations

SmallTest (android.support.test.filters.SmallTest)252 Test (org.junit.Test)137 AbstractExistingDBTest (org.liberty.android.fantastischmemo.test.AbstractExistingDBTest)86 Parcel (android.os.Parcel)48 TimeBase (com.android.internal.os.BatteryStatsImpl.TimeBase)45 Card (org.liberty.android.fantastischmemo.entity.Card)43 CardDao (org.liberty.android.fantastischmemo.dao.CardDao)37 Setting (org.liberty.android.fantastischmemo.entity.Setting)21 Binder (android.os.Binder)20 Category (org.liberty.android.fantastischmemo.entity.Category)17 AbstractPreferencesTest (org.liberty.android.fantastischmemo.test.AbstractPreferencesTest)17 LearningData (org.liberty.android.fantastischmemo.entity.LearningData)15 UiThreadTest (android.support.test.annotation.UiThreadTest)14 CategoryDao (org.liberty.android.fantastischmemo.dao.CategoryDao)13 LocaleList (android.os.LocaleList)10 Option (org.liberty.android.fantastischmemo.entity.Option)9 QueueManager (org.liberty.android.fantastischmemo.queue.QueueManager)9 ContentResolver (android.content.ContentResolver)8 Cursor (android.database.Cursor)8 OnTickListener (com.tmall.wireless.tangram.support.TimerSupport.OnTickListener)8