use of com.orgzly.android.db.entity.Repo in project orgzly-android by orgzly.
the class SyncTest method testOnlyBookWithLink.
@Test
public void testOnlyBookWithLink() {
Repo repoA = testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
BookView book = testUtils.setupBook("book-1", "Content");
dataRepository.setLink(book.getBook().getId(), repoA);
testUtils.sync();
book = dataRepository.getBooks().get(0);
assertEquals(BookSyncStatus.ONLY_BOOK_WITH_LINK.toString(), book.getBook().getSyncStatus());
}
use of com.orgzly.android.db.entity.Repo in project orgzly-android by orgzly.
the class TestUtils method renameRepo.
public void renameRepo(String fromUrl, String toUrl) {
Repo repo = dataRepository.getRepo(fromUrl);
if (repo != null) {
Repo newRepo = new Repo(repo.getId(), repo.getType(), toUrl);
dataRepository.updateRepo(new RepoWithProps(newRepo));
} else {
throw new IllegalStateException("Repo " + fromUrl + " does not exist");
}
}
use of com.orgzly.android.db.entity.Repo in project orgzly-android by orgzly.
the class SyncingTest method testSettingLinkToRenamedRepo.
@Test
public void testSettingLinkToRenamedRepo() {
Assume.assumeTrue(BuildConfig.IS_DROPBOX_ENABLED);
Repo repo = testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
testUtils.setupRook(repo, "mock://repo-a/booky.org", "Täht", "1abcde", 1400067156000L);
ActivityScenario.launch(MainActivity.class);
sync();
onBook(0, R.id.item_book_link_repo).check(matches(allOf(withText("mock://repo-a"), isDisplayed())));
onBook(0, R.id.item_book_synced_url).check(matches(allOf(withText("mock://repo-a/booky.org"), isDisplayed())));
onBook(0, R.id.item_book_encoding_used).check(matches((withText(context.getString(R.string.argument_used, "UTF-8")))));
onBook(0, R.id.item_book_encoding_detected).check(matches((withText(context.getString(R.string.argument_detected, "UTF-8")))));
onBook(0, R.id.item_book_encoding_selected).check(matches(not(isDisplayed())));
/* Rename repository. */
onActionItemClick(R.id.activity_action_settings, R.string.settings);
clickSetting("prefs_screen_sync", R.string.sync);
clickSetting("pref_key_repos", R.string.repos_preference_title);
onListItem(0).perform(click());
onView(withId(R.id.activity_repo_dropbox_directory)).perform(replaceTextCloseKeyboard("repo-b"));
onActionItemClick(R.id.done, R.string.done);
pressBack();
pressBack();
pressBack();
/* Set link to new repository. */
onView(withId(R.id.drawer_layout)).perform(open());
onView(allOf(withText(R.string.notebooks), isDescendantOfA(withId(R.id.drawer_navigation_view)))).perform(click());
onView(allOf(withText("booky"), isDisplayed())).perform(longClick());
openContextualToolbarOverflowMenu();
onView(withText(R.string.books_context_menu_item_set_link)).perform(click());
onView(withText("dropbox:/repo-b")).perform(click());
onBook(0, R.id.item_book_link_repo).check(matches(allOf(withText("dropbox:/repo-b"), isDisplayed())));
onBook(0, R.id.item_book_synced_url).check(matches(not(isDisplayed())));
onBook(0, R.id.item_book_encoding_used).check(matches((withText(context.getString(R.string.argument_used, "UTF-8")))));
onBook(0, R.id.item_book_encoding_detected).check(matches((withText(context.getString(R.string.argument_detected, "UTF-8")))));
onBook(0, R.id.item_book_encoding_selected).check(matches(not(isDisplayed())));
onView(allOf(withText("booky"), isDisplayed())).perform(longClick());
openContextualToolbarOverflowMenu();
onView(withText(R.string.books_context_menu_item_set_link)).perform(click());
// Current value
onView(withText("dropbox:/repo-b")).check(matches(isDisplayed()));
}
use of com.orgzly.android.db.entity.Repo in project orgzly-android by orgzly.
the class SyncingTest method testSettingLinkForLoadedOrgTxtBook.
@Test
public void testSettingLinkForLoadedOrgTxtBook() {
Repo repo = testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
testUtils.setupRook(repo, "mock://repo-a/booky.org.txt", "", "1abcdef", 1400067155);
ActivityScenario.launch(MainActivity.class);
sync();
onBook(0, R.id.item_book_link_repo).check(matches(allOf(withText("mock://repo-a"), isDisplayed())));
onBook(0, R.id.item_book_last_action).check(matches(withText(containsString("Loaded from mock://repo-a/booky.org.txt"))));
onView(allOf(withText("booky"), isDisplayed())).perform(longClick());
openContextualToolbarOverflowMenu();
onView(withText(R.string.books_context_menu_item_set_link)).perform(click());
onView(withText("mock://repo-a")).perform(click());
onBook(0, R.id.item_book_link_repo).check(matches(allOf(withText("mock://repo-a"), isDisplayed())));
onBook(0, R.id.item_book_synced_url).check(matches(allOf(withText("mock://repo-a/booky.org.txt"), isDisplayed())));
}
use of com.orgzly.android.db.entity.Repo in project orgzly-android by orgzly.
the class SyncingTest method testSpaceSeparatedBookName.
@Test
public void testSpaceSeparatedBookName() throws IOException {
Repo repo = testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
testUtils.setupRook(repo, "mock://repo-a/Book%20Name.org", "", "1abcdef", 1400067155);
ActivityScenario.launch(MainActivity.class);
sync();
onBook(0, R.id.item_book_synced_url).check(matches(allOf(withText("mock://repo-a/Book%20Name.org"), isDisplayed())));
onBook(0, R.id.item_book_last_action).check(matches(allOf(withText(endsWith("Loaded from mock://repo-a/Book%20Name.org")), isDisplayed())));
}
Aggregations