Search in sources :

Example 1 with WhiteboardPenColor

use of com.ichi2.anki.model.WhiteboardPenColor in project Anki-Android by ankidroid.

the class ReviewerNoParamTest method whiteboardPenColorChangeChangesDatabaseLight.

@Test
public void whiteboardPenColorChangeChangesDatabaseLight() {
    Whiteboard whiteboard = startReviewerForWhiteboard();
    whiteboard.setPenColor(ARBITRARY_PEN_COLOR_VALUE);
    WhiteboardPenColor penColor = getPenColor();
    assertThat("Light pen color is changed", penColor.getLightPenColor(), is(ARBITRARY_PEN_COLOR_VALUE));
}
Also used : WhiteboardPenColor(com.ichi2.anki.model.WhiteboardPenColor) Test(org.junit.Test)

Example 2 with WhiteboardPenColor

use of com.ichi2.anki.model.WhiteboardPenColor in project Anki-Android by ankidroid.

the class MetaDB method getWhiteboardPenColor.

/**
 * Returns the pen color of the whiteboard for the given deck.
 */
public static WhiteboardPenColor getWhiteboardPenColor(Context context, long did) {
    openDBIfClosed(context);
    try (Cursor cur = mMetaDb.rawQuery("SELECT lightpencolor, darkpencolor FROM whiteboardState WHERE did = ?", new String[] { Long.toString(did) })) {
        cur.moveToFirst();
        Integer light = DatabaseUtil.getInteger(cur, 0);
        Integer dark = DatabaseUtil.getInteger(cur, 1);
        return new WhiteboardPenColor(light, dark);
    } catch (Exception e) {
        Timber.e(e, "Error retrieving whiteboard pen color from MetaDB ");
        return WhiteboardPenColor.getDefault();
    }
}
Also used : Cursor(android.database.Cursor) WhiteboardPenColor(com.ichi2.anki.model.WhiteboardPenColor) SQLiteException(android.database.sqlite.SQLiteException)

Example 3 with WhiteboardPenColor

use of com.ichi2.anki.model.WhiteboardPenColor in project Anki-Android by ankidroid.

the class ReviewerNoParamTest method whiteboardPenColorChangeChangesDatabaseDark.

@Test
public void whiteboardPenColorChangeChangesDatabaseDark() {
    enableDarkMode();
    Whiteboard whiteboard = startReviewerForWhiteboard();
    whiteboard.setPenColor(ARBITRARY_PEN_COLOR_VALUE);
    WhiteboardPenColor penColor = getPenColor();
    assertThat("Dark pen color is changed", penColor.getDarkPenColor(), is(ARBITRARY_PEN_COLOR_VALUE));
}
Also used : WhiteboardPenColor(com.ichi2.anki.model.WhiteboardPenColor) Test(org.junit.Test)

Aggregations

WhiteboardPenColor (com.ichi2.anki.model.WhiteboardPenColor)3 Test (org.junit.Test)2 Cursor (android.database.Cursor)1 SQLiteException (android.database.sqlite.SQLiteException)1