use of org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext 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);
}
use of org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext 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);
}
use of org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext 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());
}
use of org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext 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);
}
use of org.liberty.android.fantastischmemo.service.cardplayer.CardPlayerContext 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);
}
Aggregations