Skip to content

Commit 966f89d

Browse files
committed
add test
1 parent 76448ee commit 966f89d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/testthat/test-geom-tile.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,18 @@ test_that("accepts linejoin parameter", {
3434
gp2 <- layer_grob(ggplot(df, aes(x, y)) + geom_tile(linejoin = "round"))[[1]]$gp
3535
expect_equal(gp2$linejoin, "round")
3636
})
37+
38+
test_that("width and height are inferred per panel", {
39+
df <- data_frame0(
40+
x = c(1, 2, 3, 10, 20, 30),
41+
y = c(10, 10.5, 11, 100, 200, 300),
42+
f = rep(c("A", "B"), each = 3)
43+
)
44+
45+
ld <- layer_data(
46+
ggplot(df, aes(x, y)) + geom_tile() + facet_wrap(~f, scales = "free")
47+
)
48+
49+
expect_equal(ld$xmax - ld$xmin, c(1, 1, 1, 10, 10, 10))
50+
expect_equal(ld$ymax - ld$ymin, c(0.5, 0.5, 0.5, 100, 100, 100))
51+
})

0 commit comments

Comments
 (0)