Skip to content

Commit

Permalink
fix: Skip 'cat_bookmarks()' examples/tests if no 'pdftk'
Browse files Browse the repository at this point in the history
* New `get_bookmarks_pdftools()` is not good enough
  for use with `set_bookmarks()` since doesn't know page numbers.
  Need to make sure `get_bookmarks_pdftk()` will be called
  in examples/tests otherwise skip.
  • Loading branch information
trevorld committed Mar 28, 2024
1 parent 1f778e5 commit 1066953
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
5 changes: 4 additions & 1 deletion R/bookmarks.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ get_bookmarks_pdftools <- function(filename, use_names = TRUE) {
#' A "total_pages" attribute will be set for the theoretical total pages of
#' the concatenated document represented by the concatenated bookmarks.
#' @examples
#' if (supports_get_bookmarks() && supports_set_bookmarks() && require("grid", quietly = TRUE)) {
#' if (supports_get_bookmarks() &&
#' supports_set_bookmarks() &&
#' supports_pdftk() &&
#' require("grid", quietly = TRUE)) {
#' # Create two different two-page pdf files
#' make_pdf <- function(f, title) {
#' pdf(f, onefile = TRUE, title = title)
Expand Down
5 changes: 4 additions & 1 deletion man/cat_bookmarks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-bookmarks.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ test_that("`get_count()` and `get_level()`", {
})

test_that("`cat_bookmarks()` works", {
skip_if_not(supports_get_bookmarks() && supports_set_bookmarks())
skip_if_not(supports_get_bookmarks() && supports_set_bookmarks() && supports_pdftk())
bookmarks <- data.frame(title = c("Page 1", "Page 2"),
page = c(1L, 2L))
f2 <- tempfile(fileext = ".pdf")
Expand Down

0 comments on commit 1066953

Please sign in to comment.