Skip to content

Commit eb04424

Browse files
committed
add test
1 parent 66d9dee commit eb04424

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/testthat/test-geom-ribbon.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,15 @@ test_that("outline.type option works", {
7474
expect_s3_class(g_area_default$children[[1]]$children[[2]], "polyline")
7575
expect_equal(g_area_default$children[[1]]$children[[2]]$id, rep(1L, each = 4))
7676
})
77+
78+
test_that("ribbons can have gradients", {
79+
80+
df <- data.frame(x = 1:2, ymin = c(-1:-2), ymax = 1:2)
81+
p <- ggplot(df, aes(x, ymin = ymin, ymax = ymax, fill = x)) +
82+
geom_ribbon(outline.type = "full") +
83+
scale_fill_gradientn(colours = c("red", "blue"))
84+
fill <- layer_grob(p)[[1]]$children[[1]]$gp$fill
85+
86+
expect_s3_class(fill, "GridLinearGradient")
87+
expect_equal(fill$colours, alpha(c("red", "blue"), NA))
88+
})

0 commit comments

Comments
 (0)