use of com.ichi2.anki.CardBrowser.Column.DUE in project AnkiChinaAndroid by ankichinateam.
the class SchedV2Test method test_learn_collapsedV2.
@Test
public void test_learn_collapsedV2() throws Exception {
Collection col = getColV2();
// add 2 notes
Note note = col.newNote();
note.setItem("Front", "1");
col.addNote(note);
note = col.newNote();
note.setItem("Front", "2");
col.addNote(note);
// set as a learn card and rebuild queues
col.getDb().execute("update cards set queue=0, type=0");
col.reset();
// should get '1' first
Card c = col.getSched().getCard();
assertTrue(c.q().endsWith("1"));
// pass it so it's due in 10 minutes
col.getSched().answerCard(c, 3);
// get the other card
c = col.getSched().getCard();
assertTrue(c.q().endsWith("2"));
// fail it so it's due in 1 minute
col.getSched().answerCard(c, 1);
// we shouldn't get the same card again
c = col.getSched().getCard();
assertFalse(c.q().endsWith("2"));
}
use of com.ichi2.anki.CardBrowser.Column.DUE in project AnkiChinaAndroid by ankichinateam.
the class SchedTest method test_button_spacingV1.
@Test
public void test_button_spacingV1() throws Exception {
Collection col = getColV1();
Note note = col.newNote();
note.setItem("Front", "one");
col.addNote(note);
// 1 day ivl review card due now
Card c = note.cards().get(0);
c.setType(CARD_TYPE_REV);
c.setQueue(QUEUE_TYPE_REV);
c.setDue(col.getSched().getToday());
c.setReps(1);
c.setIvl(1);
c.startTimer();
c.flush();
col.reset();
// Upstream, there is no space in 2d
assertEquals("2 d", without_unicode_isolation(col.getSched().nextIvlStr(getTargetContext(), c, 2)));
assertEquals("3 d", without_unicode_isolation(col.getSched().nextIvlStr(getTargetContext(), c, 3)));
assertEquals("4 d", without_unicode_isolation(col.getSched().nextIvlStr(getTargetContext(), c, 4)));
}
use of com.ichi2.anki.CardBrowser.Column.DUE in project AnkiChinaAndroid by ankichinateam.
the class SchedTest method test_finishedV1.
@Test
public void test_finishedV1() throws Exception {
Collection col = getColV1();
// nothing due
assertThat(col.getSched().finishedMsg(getTargetContext()).toString(), containsString("Congratulations"));
assertThat(col.getSched().finishedMsg(getTargetContext()).toString(), not(containsString("limit")));
Note note = col.newNote();
note.setItem("Front", "one");
note.setItem("Back", "two");
col.addNote(note);
// have a new card
assertThat(col.getSched().finishedMsg(getTargetContext()).toString(), containsString("new cards available"));
// turn it into a review
col.reset();
Card c = note.cards().get(0);
c.startTimer();
col.getSched().answerCard(c, 3);
// nothing should be due tomorrow, as it's due in a week
assertThat(col.getSched().finishedMsg(getTargetContext()).toString(), containsString("Congratulations"));
assertThat(col.getSched().finishedMsg(getTargetContext()).toString(), not(containsString("limit")));
}
use of com.ichi2.anki.CardBrowser.Column.DUE in project Anki-Android by ankidroid.
the class CardBrowserTest method resetDataTest.
@Test
@Config(qualifiers = "en")
public void resetDataTest() {
Card c = addNoteUsingBasicModel("Hello", "World").firstCard();
c.setDue(5);
c.setQueue(Consts.QUEUE_TYPE_REV);
c.setType(Consts.CARD_TYPE_REV);
c.flush();
CardBrowser b = getBrowserWithNoNewCards();
b.checkCardsAtPositions(0);
CardBrowser.CardCache card = getCheckedCard(b);
assertThat("Initial due of checked card", card.getColumnHeaderText(CardBrowser.Column.DUE), is("8/12/20"));
b.resetProgressNoConfirm(Collections.singletonList(card.getId()));
advanceRobolectricLooperWithSleep();
assertThat("Position of checked card after reset", card.getColumnHeaderText(CardBrowser.Column.DUE), is("1"));
}
use of com.ichi2.anki.CardBrowser.Column.DUE in project Anki-Android by ankidroid.
the class SchedV2Test method test_moveVersions.
@Test
public void test_moveVersions() throws Exception {
Collection col = getColV2();
col.changeSchedulerVer(1);
Note n = col.newNote();
n.setItem("Front", "one");
col.addNote(n);
// make it a learning card
col.reset();
Card c = getCard();
col.getSched().answerCard(c, BUTTON_ONE);
// the move to v2 should reset it to new
col.changeSchedulerVer(2);
c.load();
assertEquals(QUEUE_TYPE_NEW, c.getQueue());
assertEquals(CARD_TYPE_NEW, c.getType());
// fail it again, and manually bury it
col.reset();
c = getCard();
col.getSched().answerCard(c, BUTTON_ONE);
col.getSched().buryCards(new long[] { c.getId() });
c.load();
assertEquals(QUEUE_TYPE_MANUALLY_BURIED, c.getQueue());
// revert to version 1
col.changeSchedulerVer(1);
// card should have moved queues
c.load();
assertEquals(QUEUE_TYPE_SIBLING_BURIED, c.getQueue());
// and it should be new again when unburied
col.getSched().unburyCards();
c.load();
assertEquals(CARD_TYPE_NEW, c.getQueue());
assertEquals(QUEUE_TYPE_NEW, c.getType());
// make sure relearning cards transition correctly to v1
col.changeSchedulerVer(2);
// card with 100 day interval, answering again
col.getSched().reschedCards(Collections.singletonList(c.getId()), 100, 100);
c.load();
c.setDue(0);
c.flush();
DeckConfig conf = col.getSched()._cardConf(c);
conf.getJSONObject("lapse").put("mult", 0.5);
col.getDecks().save(conf);
col.reset();
c = getCard();
col.getSched().answerCard(c, BUTTON_ONE);
c.load();
assertEquals(50, c.getIvl());
// due should be correctly set when removed from learning early
col.changeSchedulerVer(1);
c.load();
assertEquals(QUEUE_TYPE_REV, c.getQueue());
assertEquals(CARD_TYPE_REV, c.getType());
assertEquals(50, c.getDue());
}
Aggregations