Skip to content

Commit 4fd2ce3

Browse files
committed
add test
1 parent 912c29e commit 4fd2ce3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/testthat/test-theme.R

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,26 @@ test_that("margin_part() mechanics work as expected", {
673673
expect_equal(as.numeric(test), c(5.5, 5.5, 11, 5.5))
674674
})
675675

676+
test_that("geom elements are inherited correctly", {
677+
678+
GeomFoo <- ggproto("GeomFoo", GeomPoint)
679+
GeomBar <- ggproto("GeomBar", GeomFoo)
680+
681+
p <- ggplot(data.frame(x = 1), aes(x, x)) +
682+
stat_identity(geom = GeomBar) +
683+
theme(
684+
geom = element_geom(pointshape = 15),
685+
geom.point = element_geom(borderwidth = 2, ink = "blue"),
686+
geom.foo = element_geom(pointsize = 2),
687+
geom.bar = element_geom(ink = "red")
688+
)
689+
p <- layer_data(p)
690+
expect_equal(p$shape, 15)
691+
expect_equal(p$stroke, 2)
692+
expect_equal(p$size, 2)
693+
expect_equal(p$colour, "red")
694+
})
695+
676696
# Visual tests ------------------------------------------------------------
677697

678698
test_that("aspect ratio is honored", {

0 commit comments

Comments
 (0)