Search in sources :

Example 1 with AutomaticAnswer

use of com.ichi2.anki.reviewer.AutomaticAnswer in project Anki-Android by ankidroid.

the class AbstractFlashcardViewerTest method noAutomaticAnswerAfterRenderProcessGoneAndPaused_issue9632.

@Test
public void noAutomaticAnswerAfterRenderProcessGoneAndPaused_issue9632() {
    ActivityController<NonAbstractFlashcardViewer> controller = getViewerController(true);
    NonAbstractFlashcardViewer viewer = controller.get();
    viewer.mAutomaticAnswer = new AutomaticAnswer(viewer, new AutomaticAnswerSettings(AutomaticAnswerAction.BURY_CARD, true, 5, 5));
    viewer.executeCommand(ViewerCommand.COMMAND_SHOW_ANSWER);
    assertThat("messages after flipping card", viewer.hasAutomaticAnswerQueued(), equalTo(true));
    controller.pause();
    assertThat("disabled after pause", viewer.mAutomaticAnswer.isDisabled(), is(true));
    assertThat("no auto answer after pause", viewer.hasAutomaticAnswerQueued(), equalTo(false));
    viewer.mOnRenderProcessGoneDelegate.onRenderProcessGone(viewer.getWebView(), mock(RenderProcessGoneDetail.class));
    assertThat("no auto answer after onRenderProcessGone when paused", viewer.hasAutomaticAnswerQueued(), equalTo(false));
}
Also used : RenderProcessGoneDetail(android.webkit.RenderProcessGoneDetail) AutomaticAnswer(com.ichi2.anki.reviewer.AutomaticAnswer) AutomaticAnswerSettings(com.ichi2.anki.reviewer.AutomaticAnswerSettings) Test(org.junit.Test)

Aggregations

RenderProcessGoneDetail (android.webkit.RenderProcessGoneDetail)1 AutomaticAnswer (com.ichi2.anki.reviewer.AutomaticAnswer)1 AutomaticAnswerSettings (com.ichi2.anki.reviewer.AutomaticAnswerSettings)1 Test (org.junit.Test)1