Skip to content

Commit 226d86b

Browse files
committed
add test for re-transforming
1 parent 3b4c3a9 commit 226d86b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/testthat/test-scales.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,16 @@ test_that("discrete scales work with NAs in arbitrary positions", {
748748

749749
})
750750

751+
test_that("continuous scales update limits when changing transforms", {
752+
753+
x <- scale_x_continuous(limits = c(10, 100), trans = "sqrt")
754+
expect_equal(x$limits, sqrt(c(10, 100)))
755+
756+
x <- x$update(list(transform = "log10"))
757+
expect_equal(x$limits, c(1, 2))
758+
759+
})
760+
751761
test_that("scale updating mechanism works", {
752762
p <- ggplot(mtcars, aes(disp, mpg, colour = factor(cyl), shape = factor(gear))) +
753763
geom_point(na.rm = TRUE)

0 commit comments

Comments
 (0)