Skip to content

Commit c95553e

Browse files
committed
add test
1 parent 51818fe commit c95553e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tests/testthat/_snaps/theme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,8 @@
9898

9999
The `aspect.ratio` theme element must be a <numeric/integer> object.
100100

101+
# theme() warns about conflicting palette options
102+
103+
The `options('ggplot2.discrete.colour')` setting is incompatible with the `palette.colour.discrete` theme setting.
104+
i You can set `options(ggplot2.discrete.colour = NULL)`.
105+

tests/testthat/test-theme.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,16 @@ test_that("margin_part() mechanics work as expected", {
710710
expect_equal(as.numeric(test), c(5.5, 5.5, 11, 5.5))
711711
})
712712

713+
test_that("theme() warns about conflicting palette options", {
714+
expect_silent(
715+
theme(palette.colour.discrete = c("dodgerblue", "orange"))
716+
)
717+
local_options(ggplot2.discrete.colour = c("red", "purple"))
718+
expect_snapshot_warning(
719+
theme(palette.colour.discrete = c("dodgerblue", "orange"))
720+
)
721+
})
722+
713723
# Visual tests ------------------------------------------------------------
714724

715725
test_that("element_polygon() can render a grob", {

0 commit comments

Comments
 (0)