Skip to content

Commit 418d84d

Browse files
committed
add test
1 parent d2bbdfe commit 418d84d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/testthat/test-stat-density2d.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,10 @@ test_that("stat_density2d can produce contour and raster data", {
9595
# error on incorrect contouring variable
9696
expect_snapshot_error(ggplot_build(p + stat_density_2d(contour_var = "abcd")))
9797
})
98+
99+
test_that("stat_density_2d handles faulty bandwidth", {
100+
p <- ggplot(faithful, aes(eruptions, waiting)) +
101+
stat_density_2d(h = c(0, NA))
102+
expect_snapshot_warning(b <- ggplot_build(p))
103+
expect_s3_class(layer_grob(b)[[1]], "zeroGrob")
104+
})

0 commit comments

Comments
 (0)