Search in sources :

Example 1 with CheckDatabaseResult

use of com.ichi2.libanki.Collection.CheckDatabaseResult in project AnkiChinaAndroid by ankichinateam.

the class DeckPickerCheckDatabaseListenerTest method validResultWithValidDataWillDisplayMessageBox.

@Test
public void validResultWithValidDataWillDisplayMessageBox() {
    CheckDatabaseResult validData = validData();
    TaskData result = validResultWithData(validData);
    execute(result);
    assertThat("Load Failed dialog should not be shown if invalid data is supplied", !impl.didDisplayDialogLoadFailed());
    assertThat("Dialog should be displayed", impl.didDisplayMessage());
}
Also used : CheckDatabaseResult(com.ichi2.libanki.Collection.CheckDatabaseResult) TaskData(com.ichi2.async.TaskData) Test(org.junit.Test)

Example 2 with CheckDatabaseResult

use of com.ichi2.libanki.Collection.CheckDatabaseResult in project AnkiChinaAndroid by ankichinateam.

the class DeckPickerCheckDatabaseListenerTest method validResultWithFailedDatabaseWillShowFailedDialog.

@Test
public void validResultWithFailedDatabaseWillShowFailedDialog() {
    CheckDatabaseResult failedDb = failedDatabase();
    TaskData result = validResultWithData(failedDb);
    execute(result);
    assertThat("Load Failed dialog should be shown if failed data is supplied", impl.didDisplayDialogLoadFailed());
    assertThat("Locked Database dialog should be shown if Db was locked", !impl.didDisplayLockedDialog());
    assertThat("Dialog should not be displayed", !impl.didDisplayMessage());
}
Also used : CheckDatabaseResult(com.ichi2.libanki.Collection.CheckDatabaseResult) TaskData(com.ichi2.async.TaskData) Test(org.junit.Test)

Example 3 with CheckDatabaseResult

use of com.ichi2.libanki.Collection.CheckDatabaseResult in project Anki-Android by ankidroid.

the class DeckPickerCheckDatabaseListenerTest method validResultWithValidDataWillDisplayMessageBox.

@Test
public void validResultWithValidDataWillDisplayMessageBox() {
    CheckDatabaseResult validData = validData();
    Pair<Boolean, Collection.CheckDatabaseResult> result = validResultWithData(validData);
    execute(result);
    assertThat("Load Failed dialog should not be shown if invalid data is supplied", !mImpl.didDisplayDialogLoadFailed());
    assertThat("Dialog should be displayed", mImpl.didDisplayMessage());
}
Also used : CheckDatabaseResult(com.ichi2.libanki.Collection.CheckDatabaseResult) Test(org.junit.Test)

Example 4 with CheckDatabaseResult

use of com.ichi2.libanki.Collection.CheckDatabaseResult in project Anki-Android by ankidroid.

the class DeckPickerCheckDatabaseListenerTest method validResultWithLockedDatabaseWillShowLockedDialog.

@Test
public void validResultWithLockedDatabaseWillShowLockedDialog() {
    CheckDatabaseResult lockedDb = lockedDatabase();
    Pair<Boolean, Collection.CheckDatabaseResult> result = validResultWithData(lockedDb);
    execute(result);
    assertThat("Load Failed dialog should not be shown if invalid data is supplied", !mImpl.didDisplayDialogLoadFailed());
    assertThat("Locked Database dialog should be shown if Db was locked", mImpl.didDisplayLockedDialog());
    assertThat("Dialog should not be displayed", !mImpl.didDisplayMessage());
}
Also used : CheckDatabaseResult(com.ichi2.libanki.Collection.CheckDatabaseResult) Test(org.junit.Test)

Example 5 with CheckDatabaseResult

use of com.ichi2.libanki.Collection.CheckDatabaseResult in project AnkiChinaAndroid by ankichinateam.

the class DeckPickerCheckDatabaseListenerTest method validResultWithLockedDatabaseWillShowLockedDialog.

@Test
public void validResultWithLockedDatabaseWillShowLockedDialog() {
    CheckDatabaseResult lockedDb = lockedDatabase();
    TaskData result = validResultWithData(lockedDb);
    execute(result);
    assertThat("Load Failed dialog should not be shown if invalid data is supplied", !impl.didDisplayDialogLoadFailed());
    assertThat("Locked Database dialog should be shown if Db was locked", impl.didDisplayLockedDialog());
    assertThat("Dialog should not be displayed", !impl.didDisplayMessage());
}
Also used : CheckDatabaseResult(com.ichi2.libanki.Collection.CheckDatabaseResult) TaskData(com.ichi2.async.TaskData) Test(org.junit.Test)

Aggregations

CheckDatabaseResult (com.ichi2.libanki.Collection.CheckDatabaseResult)7 Test (org.junit.Test)7 TaskData (com.ichi2.async.TaskData)3 SuppressLint (android.annotation.SuppressLint)2 SQLiteDatabaseLockedException (android.database.sqlite.SQLiteDatabaseLockedException)2 ConfirmModSchemaException (com.ichi2.anki.exception.ConfirmModSchemaException)2 NoSuchDeckException (com.ichi2.libanki.exception.NoSuchDeckException)2 FunctionalInterfaces (com.ichi2.utils.FunctionalInterfaces)2 JSONException (com.ichi2.utils.JSONException)2 JSONObject (com.ichi2.utils.JSONObject)2 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ContentValues (android.content.ContentValues)1 Context (android.content.Context)1 Resources (android.content.res.Resources)1 Cursor (android.database.Cursor)1 TextUtils (android.text.TextUtils)1 Pair (android.util.Pair)1