diff --git a/tests/testthat/_snaps/ops_meaningful/alpha-0-5-from-function.svg b/tests/testthat/_snaps/ops_meaningful/alpha-0-5-from-function.svg new file mode 100644 index 0000000..18ef745 --- /dev/null +++ b/tests/testthat/_snaps/ops_meaningful/alpha-0-5-from-function.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +10 +15 +20 +25 +30 +35 + + + +4 +6 +8 +100 +200 +300 + + + +mpg +hp + +cyl + + + + + + + + + + + + + + + +4 +6 +8 +alpha-0.5-from-function + + diff --git a/tests/testthat/_snaps/ops_meaningful/alpha-0-5.svg b/tests/testthat/_snaps/ops_meaningful/alpha-0-5.svg new file mode 100644 index 0000000..f6b0c81 --- /dev/null +++ b/tests/testthat/_snaps/ops_meaningful/alpha-0-5.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +10 +15 +20 +25 +30 +35 + + + +4 +6 +8 +100 +200 +300 + + + +mpg +hp + +cyl + + + + + + + + + + + + + + + +4 +6 +8 +alpha-0.5 + + diff --git a/tests/testthat/test_ops_meaningful.R b/tests/testthat/test_ops_meaningful.R new file mode 100644 index 0000000..13d60c8 --- /dev/null +++ b/tests/testthat/test_ops_meaningful.R @@ -0,0 +1,32 @@ + + +p <- mtcars |> + dplyr::mutate(cyl = as.factor(cyl)) |> + ggplot(aes(mpg, hp)) + + geom_point() + + + +testthat::test_that("non-mapping parameter works (alpha)", { + .addSide <- function(p, my_alpha) { + p + geom_ysideboxplot( + aes(x = cyl, y = hp, fill = cyl), orientation = "x", + alpha = my_alpha + ) + } + vdiffr::expect_doppelganger("alpha-0.5", p + geom_ysideboxplot( + aes(x = cyl, y = hp, fill = cyl), orientation = "x", + alpha = 0.5 + )) + vdiffr::expect_doppelganger("alpha-0.5-from-function", .addSide(p, 0.5)) +}) + + +testthat::test_that("No Ops meaningful warning", { + + p2 <- p + geom_ysideboxplot( + aes(x = cyl, y = hp, fill = cyl), orientation = "x" + ) + expect_no_warning(invisible(ggplot_build(p2))) + +})