Skip to content

Commit b959275

Browse files
committed
Add tests for dummy data and inherit.aes
1 parent e27ec67 commit b959275

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/testthat/test-annotate.r

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,23 @@ test_that("segment annotations transform with scales", {
2626
annotate("segment", x = 2, y = 10, xend = 5, yend = 30, colour = "red") +
2727
scale_y_reverse()
2828
})
29+
30+
test_that("annotation_* has dummy data assigned and don't inherit aes", {
31+
custom <- annotation_custom(zeroGrob())
32+
logtick <- annotation_logticks()
33+
library(maps)
34+
usamap <- map_data("state")
35+
map <- annotation_map(usamap)
36+
rainbow <- matrix(hcl(seq(0, 360, length.out = 50 * 50), 80, 70), nrow = 50)
37+
raster <- annotation_raster(rainbow, 15, 20, 3, 4)
38+
dummy <- dummy_data()
39+
expect_equal(custom$data, dummy)
40+
expect_equal(logtick$data, dummy)
41+
expect_equal(map$data, dummy)
42+
expect_equal(raster$data, dummy)
43+
44+
expect_false(custom$inherit.aes)
45+
expect_false(logtick$inherit.aes)
46+
expect_false(map$inherit.aes)
47+
expect_false(raster$inherit.aes)
48+
})

0 commit comments

Comments
 (0)