1context("scale_brewer")
2
3test_that("mid-point in diverging brewer color scale", {
4  d <- data_frame(x = -1:1)
5
6  p <- ggplot(d) +
7    aes(x = x, y = 1, color = x) +
8    scale_color_distiller(palette = 'RdBu', direction = 1, limits = c(-1, 1))
9
10  expect_equal(layer_data(p)$colour, c("#B2182B", "#F7F7F7", "#2166AC"))
11
12  p <- ggplot(d) +
13    aes(x = x, y = 1, fill = x) +
14    scale_fill_distiller(palette = 'RdBu', direction = 1, limits = c(-1, 1))
15
16  expect_equal(layer_data(p)$fill, c("#B2182B", "#F7F7F7", "#2166AC"))
17})
18