| 1 |
test_that("ggplot2 snapshot tests", { |
| 2 |
skip_if_not_installed("ggplot2", "3.5.2.9000") |
| 3 |
skip_if_not_installed("vdiffr") |
| 4 |
skip_if_not_installed("tibble") |
| 5 |
|
| 6 |
data <- tibble::tibble( |
| 7 |
x = num((1:10) / 100, fixed_exponent = -3, notation = "eng"), |
| 8 |
y = num((1:10) / 100, scale = 100, label = "%"), |
| 9 |
z = num(10^(-5:4), notation = "si") |
| 10 |
) |
| 11 |
|
| 12 |
basic <- |
| 13 |
ggplot2::ggplot(data, ggplot2::aes(x, y)) + |
| 14 |
ggplot2::geom_point() + |
| 15 |
ggplot2::theme_minimal(36) |
| 16 |
|
| 17 |
vdiffr::expect_doppelganger("basic", basic) |
| 18 |
|
| 19 |
log_scale <- |
| 20 |
ggplot2::ggplot(data, ggplot2::aes(x, z)) + |
| 21 |
ggplot2::geom_point() + |
| 22 |
scale_y_num(transform = "log10") + |
| 23 |
ggplot2::theme_minimal(36) |
| 24 |
|
| 25 |
vdiffr::expect_doppelganger("log_scale", log_scale) |
| 26 |
}) |