Skip to content

Commit

Permalink
tests: Skip certain tests on macOS
Browse files Browse the repository at this point in the history
* Unit tests have been adjusted to prevent an CRAN R CMD check ERROR on
  an M1 Mac machine running macOS 14 (#58).

closes #58
  • Loading branch information
trevorld committed Oct 1, 2023
1 parent 25413a0 commit 51aacc0
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- name: Install ghostscript/pdftk on Ubuntu
- name: Install ghostscript/pdftk/exiftool on Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get install -y ghostscript
sudo apt-get install -y libimage-exiftool-perl
sudo apt-get install -y pdftk
shell: bash

- name: Install ghostscript/pdftk on Windows
- name: Install ghostscript/pdftk/exiftool on Windows
if: runner.os == 'Windows'
run: |
choco install -y ghostscript
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Encoding: UTF-8
Package: xmpdf
Type: Package
Title: Edit 'XMP' Metadata and 'PDF' Bookmarks and Documentation Info
Version: 0.1.3
Version: 0.1.4
Description: Edit 'XMP' metadata <https://en.wikipedia.org/wiki/Extensible_Metadata_Platform>
in a variety of media file formats as well as
edit bookmarks (aka outline aka table of contents) and documentation info entries in 'pdf' files.
Expand Down Expand Up @@ -40,5 +40,5 @@ VignetteBuilder: knitr, rmarkdown
SystemRequirements: 'ghostscript' or 'pdftk' for editing pdf bookmarks and/or documentation info entries.
'exiftool' for editing pdf documentation info entries and/or xmp metadata.
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Config/testthat/edition: 3
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
xmpdf 0.1.4
===========

* Unit tests have been adjusted to prevent an CRAN R CMD check ERROR on
an M1 Mac machine running macOS 14 (#58).

xmpdf 0.1.3
===========

Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CRAN Status Badge](https://www.r-pkg.org/badges/version/xmpdf)](https://cran.r-project.org/package=xmpdf)
[![R-CMD-check](https://github.com/trevorld/r-xmpdf/workflows/R-CMD-check/badge.svg)](https://github.com/trevorld/r-xmpdf/actions)
[![codecov](https://codecov.io/github/trevorld/r-xmpdf/branch/main/graph/badge.svg?token=K12GJIBIL7)](https://codecov.io/github/trevorld/r-xmpdf)
[![codecov](https://codecov.io/github/trevorld/r-xmpdf/branch/main/graph/badge.svg)](https://app.codecov.io/github/trevorld/r-xmpdf)

### Table of Contents

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CRAN Status Badge](https://www.r-pkg.org/badges/version/xmpdf)](https://cran.r-project.org/package=xmpdf)
[![R-CMD-check](https://github.com/trevorld/r-xmpdf/workflows/R-CMD-check/badge.svg)](https://github.com/trevorld/r-xmpdf/actions)
[![codecov](https://codecov.io/github/trevorld/r-xmpdf/branch/main/graph/badge.svg?token=K12GJIBIL7)](https://codecov.io/github/trevorld/r-xmpdf)
[![codecov](https://codecov.io/github/trevorld/r-xmpdf/branch/main/graph/badge.svg?token=K12GJIBIL7)](https://app.codecov.io/github/trevorld/r-xmpdf)

### Table of Contents

Expand Down
6 changes: 3 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
* Unit tests have been adjusted to prevent CRAN R CMD check ERRORs on certain CRAN platforms
that don't have `ghostscript` installed or are ran in a non-Unicode locale.
* Unit tests have been adjusted to prevent an CRAN R CMD check ERROR on
an M1 Mac machine running macOS 14.
* System requirements of 'ghostscript' or 'pdftk' for editing pdf bookmarks and/or documentation info entries
and 'exiftool' for editing pdf documentation info entries and/or xmp metadata.
The examples and tests shouldn't not throw an ERROR if one (or all)
of these are not installed.

## Test environments

* local (linux, R 4.2.2)
* local (linux, R 4.3.1)
* win-builder (windows, R devel)
* github actions (windows, R release)
* github actions (linux, R devel)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-bookmarks.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ test_that("set_bookmarks_gs", {

# Does Unicode work
skip_if_not(l10n_info()[["UTF-8"]])
skip_on_os("mac") # CRAN checks on macOS 14
bookmarks <- data.frame(title = c("R\u5f88\u68d2\uff01", "Page 1", "Page 2"),
level = c(1, 2, 2),
page = c(1L, 1L, 2L))
Expand Down Expand Up @@ -120,6 +121,7 @@ test_that("bookmarks_pdftk", {

# Does Unicode work
skip_if_not(l10n_info()[["UTF-8"]])
skip_on_os("mac") # CRAN checks on macOS 14
bookmarks <- data.frame(title = c("R\u5f88\u68d2\uff01", "Page 1", "Page 2"),
level = c(1, 2, 2),
page = c(1L, 1L, 2L))
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-docinfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ test_that("docinfo_pdftk", {

# Unicode works?
skip_if_not(l10n_info()[["UTF-8"]])
skip_on_os("mac") # CRAN checks on macOS 14
set_docinfo_pdftk(docinfo(subject = "R\u5f88\u68d2\uff01"), f4)
expect_equal(get_docinfo_pdftk(f4)[[1]]$subject, "R\u5f88\u68d2\uff01")

Expand Down Expand Up @@ -119,6 +120,7 @@ test_that("set_docinfo_gs", {

# Unicode works?
skip_if_not(l10n_info()[["UTF-8"]])
skip_on_os("mac") # CRAN checks on macOS 14
set_docinfo_gs(docinfo(title = "Test title", subject = "R\u5f88\u68d2\uff01"), f4)
d <- get_docinfo(f4)[[1]]
expect_equal(d$subject, "R\u5f88\u68d2\uff01")
Expand Down Expand Up @@ -152,6 +154,7 @@ test_that("docinfo_exiftool", {

# Unicode works?
skip_if_not(l10n_info()[["UTF-8"]])
skip_on_os("mac") # CRAN checks on macOS 14
set_docinfo_exiftool(docinfo(subject = "R\u5f88\u68d2\uff01"), f4)
expect_equal(get_docinfo_exiftool(f4)[[1]]$subject, "R\u5f88\u68d2\uff01")
})
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-xmp.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ library("grid")
test_that("get_xmp() / set_xmp()", {
skip_if_not(supports_get_xmp() && supports_set_xmp())
skip_if_not(l10n_info()[["UTF-8"]])
skip_on_os("mac") # CRAN checks on macOS 14
f <- tempfile(fileext = ".pdf")
on.exit(unlink(f))
pdf(f)
Expand Down

0 comments on commit 51aacc0

Please sign in to comment.