@@ -51,3 +51,32 @@ test_that("stale snapshots are skipped", {
5151 expect_s3_class(cnd , " skip" )
5252 file.remove(new_path )
5353})
54+
55+ test_that(" no 'svglite supports one page' error (#85)" , {
56+ test_draw_axis <- function (add_labels = FALSE ) {
57+ theme <- theme_test() + theme(axis.line = element_line(size = 0.5 ))
58+ positions <- c(" top" , " right" , " bottom" , " left" )
59+
60+ n_breaks <- 3
61+ break_positions <- seq_len(n_breaks ) / (n_breaks + 1 )
62+ labels <- if (add_labels ) as.character(seq_along(break_positions ))
63+
64+ # create the axes
65+ axes <- lapply(positions , function (position ) {
66+ ggplot2 ::: draw_axis(break_positions , labels , axis_position = position , theme = theme )
67+ })
68+ axes_grob <- gTree(children = do.call(gList , axes ))
69+
70+ # arrange them so there's some padding on each side
71+ gt <- gtable(
72+ widths = unit(c(0.05 , 0.9 , 0.05 ), " npc" ),
73+ heights = unit(c(0.05 , 0.9 , 0.05 ), " npc" )
74+ )
75+ gt <- gtable_add_grob(gt , list (axes_grob ), 2 , 2 , clip = " off" )
76+ plot(gt )
77+ }
78+ environment(test_draw_axis ) <- env(ns_env(" ggplot2" ))
79+
80+ expect_doppelganger(" page-error1" , test_draw_axis(FALSE ))
81+ expect_doppelganger(" page-error2" , test_draw_axis(TRUE ))
82+ })
0 commit comments