1# Setting of legend key glyphs has to be tested visually
2context("Legend key glyphs")
3
4
5test_that("alternative key glyphs work", {
6  df <- data_frame(x = 1:3, y = 3:1, z = letters[1:3])
7
8  # specify key glyph by name
9  expect_doppelganger("time series and polygon key glyphs",
10    ggplot(df, aes(x, y)) +
11      geom_line(aes(color = "line"), key_glyph = "timeseries") +
12      geom_point(aes(fill = z), pch = 21, size = 3, key_glyph = "polygon")
13   )
14
15  # specify key glyph by function
16  expect_doppelganger("rectangle and dotplot key glyphs",
17    ggplot(df, aes(x, y)) +
18      geom_line(aes(color = "line"), key_glyph = draw_key_rect) +
19      geom_point(aes(fill = z), pch = 21, size = 3, stroke = 2, key_glyph = draw_key_dotplot)
20  )
21})
22