@@ -54,28 +54,31 @@ test_that("hline/vline/abline split on linetype/colour/size", {
5454 y = x * 0.95
5555 )
5656 gg <- ggplot(d , aes(x , y )) +
57+ geom_point() +
5758 geom_vline(xintercept = c(2.5 , 3 , 3.5 ), linetype = 1 : 3 ) +
5859 geom_hline(yintercept = c(2.5 , 3 , 3.5 ), size = 1 : 3 ) +
5960 geom_abline(slope = - 1 , intercept = c(2.5 , 3 , 3.5 ), colour = 1 : 3 )
6061
61- l <- plotly_build (gg ) $ x
62- expect_length(l $ data , 9 )
62+ l <- expect_doppelganger_built (gg , " split-hline-vline-abline " )
63+ expect_length(l $ data , 10 )
6364
6465 expect_equivalent(
65- vapply( l $ data , function (x ) x $ line $ dash , character ( 1 )),
66+ unlist(lapply( l $ data , function (x ) x $ line $ dash )),
6667 lty2dash(c(1 : 3 , rep(1 , 6 )))
6768 )
6869
6970 expect_equivalent(
70- unique(vapply( l $ data , function (x ) x $ line $ color , character ( 1 ))),
71+ unique(unlist(lapply( l $ data , function (x ) x $ line $ color ))),
7172 # Default palette colors are changing in R4.0...
7273 # https://github.com/wch/r-source/commit/58eafa7#diff-038aeefcb87409db883f064615187949R2495
7374 toRGB(if (getRversion() > = " 4.0.0" ) c(" black" , " #DF536B" , " #61D04F" ) else c(" black" , " red" , " green3" ))
7475 )
7576
7677 expect_length(
77- unique(vapply( l $ data , function (x ) x $ line $ width , numeric ( 1 ))), 4
78+ unique(unlist(lapply( l $ data , function (x ) x $ line $ width ))), 4
7879 )
80+
81+
7982})
8083
8184
0 commit comments