@@ -54,28 +54,31 @@ test_that("hline/vline/abline split on linetype/colour/size", {
54
54
y = x * 0.95
55
55
)
56
56
gg <- ggplot(d , aes(x , y )) +
57
+ geom_point() +
57
58
geom_vline(xintercept = c(2.5 , 3 , 3.5 ), linetype = 1 : 3 ) +
58
59
geom_hline(yintercept = c(2.5 , 3 , 3.5 ), size = 1 : 3 ) +
59
60
geom_abline(slope = - 1 , intercept = c(2.5 , 3 , 3.5 ), colour = 1 : 3 )
60
61
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 )
63
64
64
65
expect_equivalent(
65
- vapply( l $ data , function (x ) x $ line $ dash , character ( 1 )),
66
+ unlist(lapply( l $ data , function (x ) x $ line $ dash )),
66
67
lty2dash(c(1 : 3 , rep(1 , 6 )))
67
68
)
68
69
69
70
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 ))),
71
72
# Default palette colors are changing in R4.0...
72
73
# https://github.com/wch/r-source/commit/58eafa7#diff-038aeefcb87409db883f064615187949R2495
73
74
toRGB(if (getRversion() > = " 4.0.0" ) c(" black" , " #DF536B" , " #61D04F" ) else c(" black" , " red" , " green3" ))
74
75
)
75
76
76
77
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
78
79
)
80
+
81
+
79
82
})
80
83
81
84
0 commit comments