Search in sources :

Example 96 with SmallTest

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

the class CardPlayerStateTest method testPlayRandomNextCard.

@SmallTest
@Test
public void testPlayRandomNextCard() {
    cardPlayerContext = new CardPlayerContext(mockEventHandler, mockCardTTSUtil, mockAmTTSServiceHandler, helper, delayBeteenQAInSec, delayBeteenCardsInSec, // Shuffle enabled
    true, true);
    cardPlayerContext.setCurrentCard(helper.getCardDao().queryForId(TEST_CARD_ID));
    verifyStateTransition(CardPlayerState.PLAYING_QUESTION, CardPlayerMessage.GO_TO_NEXT, CardPlayerState.PLAYING_QUESTION);
}
Also used : CardPlayerContext(org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) SmallTest(android.support.test.filters.SmallTest)

Example 97 with SmallTest

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

the class CardPlayerStateTest method testPlayPrevQuestionNoRepeatWithFirstCardShouldStop.

@SmallTest
@Test
public void testPlayPrevQuestionNoRepeatWithFirstCardShouldStop() {
    cardPlayerContext = new CardPlayerContext(mockEventHandler, mockCardTTSUtil, mockAmTTSServiceHandler, helper, delayBeteenQAInSec, delayBeteenCardsInSec, false, // No repeat
    false);
    cardPlayerContext.setCurrentCard(helper.getCardDao().queryForId(TEST_FIRST_CARD_ID));
    verifyStateTransition(CardPlayerState.PLAYING_QUESTION, CardPlayerMessage.GO_TO_PREV, CardPlayerState.STOPPED);
}
Also used : CardPlayerContext(org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) SmallTest(android.support.test.filters.SmallTest)

Example 98 with SmallTest

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

the class CardPlayerStateTest method testPlayPrevQuestionNoRepeatWithCardInMiddle.

@SmallTest
@Test
public void testPlayPrevQuestionNoRepeatWithCardInMiddle() {
    cardPlayerContext = new CardPlayerContext(mockEventHandler, mockCardTTSUtil, mockAmTTSServiceHandler, helper, delayBeteenQAInSec, delayBeteenCardsInSec, false, // No repeat
    false);
    cardPlayerContext.setCurrentCard(helper.getCardDao().queryForId(TEST_CARD_ID));
    verifyStateTransition(CardPlayerState.PLAYING_QUESTION, CardPlayerMessage.GO_TO_PREV, CardPlayerState.PLAYING_QUESTION);
    assertEquals(TEST_CARD_ID - 1, (int) cardPlayerContext.getCurrentCard().getId());
}
Also used : CardPlayerContext(org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) SmallTest(android.support.test.filters.SmallTest)

Example 99 with SmallTest

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

the class CardPlayerStateTest method testPlayRandomPrevCard.

// Shuffle test
@SmallTest
@Test
public void testPlayRandomPrevCard() {
    cardPlayerContext = new CardPlayerContext(mockEventHandler, mockCardTTSUtil, mockAmTTSServiceHandler, helper, delayBeteenQAInSec, delayBeteenCardsInSec, // Shuffle enabled
    true, true);
    cardPlayerContext.setCurrentCard(helper.getCardDao().queryForId(TEST_CARD_ID));
    verifyStateTransition(CardPlayerState.PLAYING_QUESTION, CardPlayerMessage.GO_TO_PREV, CardPlayerState.PLAYING_QUESTION);
}
Also used : CardPlayerContext(org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest) AbstractExistingDBTest(org.liberty.android.fantastischmemo.test.AbstractExistingDBTest) SmallTest(android.support.test.filters.SmallTest)

Example 100 with SmallTest

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

the class CardPlayerStateTest method testPlayRandomNextCardWithRepeat.

// Shuffle and repeat work together. Shuffle should take precedence
// so it alway repeat
@SmallTest
@Test
public void testPlayRandomNextCardWithRepeat() {
    cardPlayerContext = new CardPlayerContext(mockEventHandler, mockCardTTSUtil, mockAmTTSServiceHandler, helper, delayBeteenQAInSec, delayBeteenCardsInSec, // Shuffle enabled
    true, // No repeat
    false);
    // Use last card to test that repeat has no effect
    cardPlayerContext.setCurrentCard(helper.getCardDao().queryForId(TEST_LAST_CARD_ID));
    verifyStateTransition(CardPlayerState.PLAYING_QUESTION, CardPlayerMessage.GO_TO_NEXT, CardPlayerState.PLAYING_QUESTION);
}
Also used : CardPlayerContext(org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext) 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