Skip to content

Commit

Permalink
Fix ggsave tests (#1154)
Browse files Browse the repository at this point in the history
Fixes #1150 

The `svglite` package is required to output test snapshots that use
`ggsave`.
  • Loading branch information
edelarua authored Dec 5, 2023
1 parent 2f74254 commit 17c5394
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/testthat/test-utils_ggplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ testthat::test_that("rtables2gg works as expected", {
testthat::expect_snapshot_file(
tbl %>%
rtable2gg() %>%
svglite::ggsave(filename = "rtable2gg_default.svg", path = "./_snaps/utils_ggplot", width = 5) %>%
ggplot2::ggsave(filename = "rtable2gg_default.svg", path = "./_snaps/utils_ggplot", width = 5) %>%
suppressMessages(),
"rtable2gg_default.svg"
)
Expand All @@ -29,7 +29,7 @@ testthat::test_that("rtables2gg works as expected", {
testthat::expect_snapshot_file(
tbl %>%
rtable2gg(fontsize = 5) %>%
svglite::ggsave(filename = "rtable2gg_fs.svg", path = "./_snaps/utils_ggplot", width = 5) %>%
ggplot2::ggsave(filename = "rtable2gg_fs.svg", path = "./_snaps/utils_ggplot", width = 5) %>%
suppressMessages(),
"rtable2gg_fs.svg"
)
Expand All @@ -38,7 +38,7 @@ testthat::test_that("rtables2gg works as expected", {
testthat::expect_snapshot_file(
tbl %>%
rtable2gg(colwidths = c(4, 2, 2, 3)) %>%
svglite::ggsave(filename = "rtable2gg_cw.svg", path = "./_snaps/utils_ggplot", width = 5) %>%
ggplot2::ggsave(filename = "rtable2gg_cw.svg", path = "./_snaps/utils_ggplot", width = 5) %>%
suppressMessages(),
"rtable2gg_cw.svg"
)
Expand All @@ -47,7 +47,7 @@ testthat::test_that("rtables2gg works as expected", {
testthat::expect_snapshot_file(
tbl %>%
rtable2gg(lbl_col_padding = -5) %>%
svglite::ggsave(filename = "rtable2gg_lblpad.svg", path = "./_snaps/utils_ggplot", width = 5) %>%
ggplot2::ggsave(filename = "rtable2gg_lblpad.svg", path = "./_snaps/utils_ggplot", width = 5) %>%
suppressMessages(),
"rtable2gg_lblpad.svg"
)
Expand All @@ -74,7 +74,7 @@ testthat::test_that("rtables2gg works with multiple column splits", {
testthat::expect_snapshot_file(
tbl %>%
rtable2gg() %>%
svglite::ggsave(filename = "rtable2gg_colsplits.svg", path = "./_snaps/utils_ggplot", height = 3, width = 10),
ggplot2::ggsave(filename = "rtable2gg_colsplits.svg", path = "./_snaps/utils_ggplot", height = 3, width = 10),
"rtable2gg_colsplits.svg"
)
})

0 comments on commit 17c5394

Please sign in to comment.