@@ -32,14 +32,15 @@ test_that("alpha affects only fill colour of solid geoms", {
32
32
geom_polygon(fill = " red" , colour = " red" , alpha = 0.5 )
33
33
rect <- ggplot(df , aes(xmin = x , xmax = x + 1 , ymin = 1 , ymax = y + 1 )) +
34
34
geom_rect(fill = " red" , colour = " red" , alpha = 0.5 )
35
+ # geom_ribbon() consists of polygonGrob and polylineGrob
35
36
ribb <- ggplot(df , aes(x = x , ymin = 1 , ymax = y + 1 )) +
36
37
geom_ribbon(fill = " red" , colour = " red" , alpha = 0.5 )
37
38
38
39
expect_equal(layer_grob(poly )[[1 ]]$ gp $ col [[1 ]], " red" )
39
40
expect_equal(layer_grob(rect )[[1 ]]$ gp $ col [[1 ]], " red" )
40
- expect_equal(layer_grob(ribb )[[1 ]]$ children [[1 ]]$ gp $ col [[1 ]], " red" )
41
+ expect_equal(layer_grob(ribb )[[1 ]]$ children [[1 ]]$ children [[ 2 ]] $ gp $ col [[1 ]], " red" )
41
42
42
43
expect_equal(layer_grob(poly )[[1 ]]$ gp $ fill [[1 ]], " #FF000080" )
43
44
expect_equal(layer_grob(rect )[[1 ]]$ gp $ fill [[1 ]], " #FF000080" )
44
- expect_equal(layer_grob(ribb )[[1 ]]$ children [[1 ]]$ gp $ fill [[1 ]], " #FF000080" )
45
+ expect_equal(layer_grob(ribb )[[1 ]]$ children [[1 ]]$ children [[ 1 ]] $ gp $ fill [[1 ]], " #FF000080" )
45
46
})
0 commit comments