Skip to content

Commit ca9e188

Browse files
committed
add test
1 parent 54c289e commit ca9e188

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/testthat/test-coord-.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,19 @@ test_that("coords append a column to the layout correctly", {
7676
expect_equal(test$COORD, c(1, 2, 1))
7777
})
7878

79+
test_that("coord expand takes a vector", {
80+
81+
base <- ggplot() + lims(x = c(0, 10), y = c(0, 10))
82+
83+
p <- ggplot_build(base + coord_cartesian(expand = c(TRUE, FALSE, FALSE, TRUE)))
84+
pp <- p$layout$panel_params[[1]]
85+
expect_equal(pp$x.range, c(-0.5, 10))
86+
expect_equal(pp$y.range, c(0, 10.5))
87+
88+
p <- ggplot_build(base + coord_cartesian(expand = c(top = FALSE, left = FALSE)))
89+
pp <- p$layout$panel_params[[1]]
90+
expect_equal(pp$x.range, c(0, 10.5))
91+
expect_equal(pp$y.range, c(-0.5, 10))
92+
93+
})
94+

0 commit comments

Comments
 (0)