Search in sources :

Example 1 with Entry

use of com.newsrob.Entry in project newsrob by marianokamp.

the class DifferentialUpdateTests method testDifferentialUpdateRead2.

/** Is the pinned state preserved */
public void testDifferentialUpdateRead2() throws Exception {
    createTestDataSet1();
    // One pinned, one unread, one read
    assertEquals(3, entryManager.getArticleCount());
    assertEquals(2, entryManager.getUnreadArticleCount());
    assertEquals(1, entryManager.getUnreadArticleCountExcludingPinned());
    // do
    final EntriesRetriever entriesRetriever = getEntriesRetriever(new String[] { getAtomIdForArticle(3) });
    // First article should still be read,
    // 2nd article should now be read,
    // 3rd article should still be unread and pinned.
    entriesRetriever.differentialUpdateOfArticlesStates(entryManager, TestUtil.getDummyJob(entryManager), EntriesRetriever.GOOGLE_STATE_READING_LIST, EntriesRetriever.GOOGLE_STATE_READ, ArticleDbState.READ);
    // Unchanged
    assertEquals(3, entryManager.getArticleCount());
    assertEquals(1, entryManager.getUnreadArticleCount());
    assertEquals(0, entryManager.getUnreadArticleCountExcludingPinned());
    Entry firstArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(1));
    assertEquals(ReadState.READ, firstArticle.getReadState());
    assertFalse(firstArticle.isReadStatePending());
    Entry secondArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(2));
    assertEquals(ReadState.READ, secondArticle.getReadState());
    assertFalse(secondArticle.isReadStatePending());
    Entry thirdArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(3));
    assertEquals(ReadState.PINNED, thirdArticle.getReadState());
    assertFalse(thirdArticle.isReadStatePending());
}
Also used : Entry(com.newsrob.Entry) EntriesRetriever(com.newsrob.EntriesRetriever)

Example 2 with Entry

use of com.newsrob.Entry in project newsrob by marianokamp.

the class PinTests method testMarkAllReadDoesntMarkPinnedArticlesRead.

public void testMarkAllReadDoesntMarkPinnedArticlesRead() throws InterruptedException {
    TestUtil.populateDatabaseWithDataSet1(entryManager);
    Entry article = entryManager.findEntryByAtomId("atomid5");
    entryManager.increaseUnreadLevel(article);
    article = entryManager.findEntryByAtomId("atomid5");
    assertEquals(ReadState.PINNED, article.getReadState());
    DBQuery dbq = new DBQuery(entryManager, null, null);
    executeMarkAllRead(dbq);
    assertEquals(1, entryManager.getUnreadArticleCount());
}
Also used : Entry(com.newsrob.Entry) DBQuery(com.newsrob.DBQuery)

Example 3 with Entry

use of com.newsrob.Entry in project newsrob by marianokamp.

the class PinTests method testIncreaseReadLevelFromUnread.

public void testIncreaseReadLevelFromUnread() {
    Entry article = createArticleWithReadState(ReadState.UNREAD);
    entryManager.increaseReadLevel(article);
    assertEquals(ReadState.READ, article.getReadState());
    assertTrue(article.isReadStatePending());
    // no change when increasing the read level again
    entryManager.increaseReadLevel(article);
    assertEquals(ReadState.READ, article.getReadState());
    assertTrue(article.isReadStatePending());
}
Also used : Entry(com.newsrob.Entry)

Example 4 with Entry

use of com.newsrob.Entry in project newsrob by marianokamp.

the class PinTests method testIncreaseUnreadLevelFromPinned.

public void testIncreaseUnreadLevelFromPinned() {
    Entry article = createArticleWithReadState(ReadState.PINNED);
    entryManager.increaseUnreadLevel(article);
    assertEquals(ReadState.PINNED, article.getReadState());
    assertFalse(article.isReadStatePending());
}
Also used : Entry(com.newsrob.Entry)

Example 5 with Entry

use of com.newsrob.Entry in project newsrob by marianokamp.

the class PinTests method testIncreaseUnreadLevelFromRead.

public void testIncreaseUnreadLevelFromRead() {
    Entry article = createArticleWithReadState(ReadState.READ);
    entryManager.increaseUnreadLevel(article);
    assertEquals(ReadState.UNREAD, article.getReadState());
    assertTrue(article.isReadStatePending());
    entryManager.increaseUnreadLevel(article);
    assertEquals(ReadState.PINNED, article.getReadState());
    assertTrue(article.isReadStatePending());
    entryManager.increaseUnreadLevel(article);
    assertEquals(ReadState.PINNED, article.getReadState());
    assertTrue(article.isReadStatePending());
}
Also used : Entry(com.newsrob.Entry)

Aggregations

Entry (com.newsrob.Entry)24 Date (java.util.Date)6 Label (com.newsrob.Label)4 CursorIndexOutOfBoundsException (android.database.CursorIndexOutOfBoundsException)3 FileNotFoundException (java.io.FileNotFoundException)3 ActivityNotFoundException (android.content.ActivityNotFoundException)2 DBQuery (com.newsrob.DBQuery)2 EntriesRetriever (com.newsrob.EntriesRetriever)2 Feed (com.newsrob.Feed)2 IOException (java.io.IOException)2 Method (java.lang.reflect.Method)2 Cursor (android.database.Cursor)1 TextView (android.widget.TextView)1 IEntryModelUpdateListener (com.newsrob.IEntryModelUpdateListener)1 ModelUpdateResult (com.newsrob.jobs.ModelUpdateResult)1