Skip to content

Commit 751e7bf

Browse files
committed
Skip tests when FreeType is too old
Rather than throwing errors in the middle of R CMD check
1 parent 889127f commit 751e7bf

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

R/svg.R

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ get_aliases <- function() {
1515
}
1616

1717
write_svg <- function(p, file, title, user_fonts) {
18-
ver <- gdtools::version_freetype()
19-
if (ver < "2.6") {
20-
stop(call. = FALSE,
21-
"vdiffr requires FreeType >= 2.6.0. Current version: ", ver
22-
)
23-
}
24-
2518
user_fonts <- user_fonts %||% get_aliases()
2619
svglite::svglite(file, user_fonts = user_fonts)
2720
on.exit(grDevices::dev.off())

R/testthat-ui.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
#' }
3939
expect_doppelganger <- function(title, fig, path = NULL, ...,
4040
user_fonts = NULL) {
41+
ver <- gdtools::version_freetype()
42+
if (ver < "2.6.0") {
43+
msg <- paste("vdiffr requires FreeType >= 2.6.0. Current version:", ver)
44+
testthat::skip(msg)
45+
}
46+
4147
fig_name <- str_standardise(title)
4248
testcase <- make_testcase_file(fig_name)
4349
write_svg(fig, testcase, title, user_fonts)

0 commit comments

Comments
 (0)