Search in sources :

Example 61 with SmallTest

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

the class CardDaoTest method testGetCardsByOrdinalAndSize.

@SmallTest
@Test
public void testGetCardsByOrdinalAndSize() throws Exception {
    CardDao cardDao = helper.getCardDao();
    // Card ordianl 1 to 10
    List<Card> cards1 = cardDao.getCardsByOrdinalAndSize(1, 10);
    assertEquals(10, (int) cards1.size());
    assertEquals(1, (int) cards1.get(0).getOrdinal());
    assertEquals(10, (int) cards1.get(9).getOrdinal());
    // Card orgdinal 20 to 28
    List<Card> cards2 = cardDao.getCardsByOrdinalAndSize(20, 10);
    assertEquals(9, (int) cards2.size());
    assertEquals(20, (int) cards2.get(0).getOrdinal());
    assertEquals(28, (int) cards2.get(8).getOrdinal());
    // Get nothing
    List<Card> cards3 = cardDao.getCardsByOrdinalAndSize(31, 10);
    assertEquals(9, (int) cards2.size());
    assertEquals(0, (int) cards3.size());
}
Also used : CardDao(org.liberty.android.fantastischmemo.dao.CardDao) Card(org.liberty.android.fantastischmemo.entity.Card) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) SmallTest(android.support.test.filters.SmallTest)

Example 62 with SmallTest

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

the class CardDaoTest method testGetRandomReviewedCards.

@SmallTest
@Test
public void testGetRandomReviewedCards() throws Exception {
    CardDao cardDao = helper.getCardDao();
    List<Card> cards = cardDao.getRandomReviewedCards(null, 10);
    assertEquals(0, cards.size());
}
Also used : CardDao(org.liberty.android.fantastischmemo.dao.CardDao) Card(org.liberty.android.fantastischmemo.entity.Card) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) SmallTest(android.support.test.filters.SmallTest)

Example 63 with SmallTest

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

the class CardDaoTest method testGetScheduledCardCount.

@SmallTest
@Test
public void testGetScheduledCardCount() throws Exception {
    CardDao cardDao = helper.getCardDao();
    assertEquals(0L, cardDao.getScheduledCardCount(null));
    setupThreeCategories();
    CategoryDao categoryDao = helper.getCategoryDao();
    List<Category> cts = categoryDao.queryForEq("name", "My category");
    Category ct = cts.get(0);
    assertEquals(0L, cardDao.getScheduledCardCount(ct));
}
Also used : Category(org.liberty.android.fantastischmemo.entity.Category) CategoryDao(org.liberty.android.fantastischmemo.dao.CategoryDao) CardDao(org.liberty.android.fantastischmemo.dao.CardDao) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) SmallTest(android.support.test.filters.SmallTest)

Example 64 with SmallTest

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

the class CardDaoTest method testCreateCardMaintainOrdinal.

@SmallTest
@Test
public void testCreateCardMaintainOrdinal() throws Exception {
    CardDao cardDao = helper.getCardDao();
    // Create card has null ordinal, append to the end
    Card nc = new Card();
    assertNull(nc.getOrdinal());
    cardDao.create(nc);
    assertEquals(29, (int) nc.getOrdinal());
    // Create card with an ordinal
    nc = new Card();
    nc.setOrdinal(14);
    cardDao.create(nc);
    Card c13 = cardDao.queryForId(13);
    Card c14 = cardDao.queryForId(14);
    Card c15 = cardDao.queryForId(15);
    assertEquals(13, (int) c13.getOrdinal());
    assertEquals(14, (int) nc.getOrdinal());
    assertEquals(15, (int) c14.getOrdinal());
    assertEquals(16, (int) c15.getOrdinal());
}
Also used : CardDao(org.liberty.android.fantastischmemo.dao.CardDao) Card(org.liberty.android.fantastischmemo.entity.Card) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) SmallTest(android.support.test.filters.SmallTest)

Example 65 with SmallTest

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

the class CardDaoTest method testGetNewCardCount.

@SmallTest
@Test
public void testGetNewCardCount() throws Exception {
    CardDao cardDao = helper.getCardDao();
    assertEquals(28L, cardDao.getNewCardCount(null));
    setupThreeCategories();
    CategoryDao categoryDao = helper.getCategoryDao();
    List<Category> cts = categoryDao.queryForEq("name", "My category");
    Category ct = cts.get(0);
    assertEquals(3L, cardDao.getNewCardCount(ct));
}
Also used : Category(org.liberty.android.fantastischmemo.entity.Category) CategoryDao(org.liberty.android.fantastischmemo.dao.CategoryDao) CardDao(org.liberty.android.fantastischmemo.dao.CardDao) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) 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