Search in sources :

Example 36 with Repo

use of com.orgzly.android.db.entity.Repo in project orgzly-android by orgzly.

the class SyncingTest method testPrefaceModificationMakesBookOutOfSync.

@Test
public void testPrefaceModificationMakesBookOutOfSync() {
    Repo repo = testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
    testUtils.setupRook(repo, "mock://repo-a/booky.org", "", "abc", 1234567890000L);
    ActivityScenario.launch(MainActivity.class);
    sync();
    onBook(0, R.id.item_book_sync_needed_icon).check(matches(not(isDisplayed())));
    // Change preface
    onBook(0).perform(click());
    onActionItemClick(R.id.books_options_menu_book_preface, R.string.edit_book_preface);
    onView(withId(R.id.fragment_book_preface_content)).perform(replaceTextCloseKeyboard("Modified preface"));
    onView(withId(R.id.done)).perform(click());
    pressBack();
    onBook(0, R.id.item_book_sync_needed_icon).check(matches(isDisplayed()));
}
Also used : Repo(com.orgzly.android.db.entity.Repo) OrgzlyTest(com.orgzly.android.OrgzlyTest) Test(org.junit.Test)

Example 37 with Repo

use of com.orgzly.android.db.entity.Repo in project orgzly-android by orgzly.

the class SyncingTest method testForceSavingBookWithLink.

@Test
public void testForceSavingBookWithLink() {
    Repo repo = testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
    testUtils.setupBook("booky", "First book used for testing\n* Note A", repo);
    ActivityScenario.launch(MainActivity.class);
    onView(allOf(withText("booky"), isDisplayed())).perform(longClick());
    onView(withId(R.id.books_context_menu_force_save)).perform(click());
    onView(withText(R.string.overwrite)).perform(click());
    onBook(0, R.id.item_book_last_action).check(matches(withText(endsWith(context.getString(R.string.force_saved_to_uri, "mock://repo-a/booky.org")))));
}
Also used : Repo(com.orgzly.android.db.entity.Repo) OrgzlyTest(com.orgzly.android.OrgzlyTest) Test(org.junit.Test)

Example 38 with Repo

use of com.orgzly.android.db.entity.Repo in project orgzly-android by orgzly.

the class SyncingTest method testDeleteExistingRemoteFile.

@Test
public void testDeleteExistingRemoteFile() {
    Repo repo = testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
    testUtils.setupBook("booky", "Sample book used for tests");
    ActivityScenario.launch(MainActivity.class);
    sync();
    onView(allOf(withText("booky"), isDisplayed())).check(matches(isDisplayed()));
    onBook(0).perform(longClick());
    openContextualToolbarOverflowMenu();
    onView(withText(R.string.delete)).perform(click());
    onView(withId(R.id.delete_linked_checkbox)).perform(click());
    onView(withText(R.string.delete)).perform(click());
    Assert.assertEquals(0, dbRepoBookRepository.getBooks(repo.getId(), Uri.parse("mock://repo-a")).size());
}
Also used : Repo(com.orgzly.android.db.entity.Repo) OrgzlyTest(com.orgzly.android.OrgzlyTest) Test(org.junit.Test)

Aggregations

Repo (com.orgzly.android.db.entity.Repo)38 OrgzlyTest (com.orgzly.android.OrgzlyTest)35 Test (org.junit.Test)35 BookView (com.orgzly.android.db.entity.BookView)11 BookNamesake (com.orgzly.android.sync.BookNamesake)5 File (java.io.File)4 Intent (android.content.Intent)2 Uri (android.net.Uri)2 AppIntent (com.orgzly.android.AppIntent)2 Book (com.orgzly.android.db.entity.Book)2 AlertDialog (android.app.AlertDialog)1 BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 IntentFilter (android.content.IntentFilter)1 Configuration (android.content.res.Configuration)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 Menu (android.view.Menu)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1