From 17c53940999a60624693642e7a6a13828a214871 Mon Sep 17 00:00:00 2001 From: Emily de la Rua <59304861+edelarua@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:22:01 -0500 Subject: [PATCH] Fix `ggsave` tests (#1154) Fixes #1150 The `svglite` package is required to output test snapshots that use `ggsave`. --- tests/testthat/test-utils_ggplot.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test-utils_ggplot.R b/tests/testthat/test-utils_ggplot.R index a2fe9d0c62..1313062e81 100644 --- a/tests/testthat/test-utils_ggplot.R +++ b/tests/testthat/test-utils_ggplot.R @@ -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" ) @@ -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" ) @@ -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" ) @@ -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" ) @@ -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" ) })