Skip to content

Commit c852973

Browse files
committed
add test
1 parent c98360e commit c852973

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed
Lines changed: 136 additions & 0 deletions
Loading

tests/testthat/test-guide-legend.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,19 @@ test_that("legend.byrow works in `guide_legend()`", {
212212
expect_doppelganger("legend.byrow = TRUE", p)
213213
})
214214

215+
test_that("legend.key.justification works as intended", {
216+
217+
p <- ggplot(mtcars, aes(mpg, disp, colour = factor(cyl), size = drat)) +
218+
geom_point() +
219+
scale_size_continuous(
220+
range = c(0, 20), breaks = c(3, 4, 5), limits = c(2.5, 5)
221+
) +
222+
scale_colour_discrete(
223+
labels = c("one line", "up\nto\nfour\nlines", "up\nto\nfive\nwhole\nlines")
224+
) +
225+
theme(legend.key.justification = c(1, 0))
226+
227+
expect_doppelganger("legend key justification", p)
228+
229+
})
230+

0 commit comments

Comments
 (0)