Skip to content

Commit 1ec4635

Browse files
committed
Skip tests with ggplot2 code that fails on old R versions
1 parent a33ed3e commit 1ec4635

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

tests/testthat/test-rotated-ticks.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
testthat::skip_if_not(getRversion() >= "4.3.0")
2+
13

24
ss <- data.frame(State=paste("some long text", c("CA", "NY", "TX")),
35
Prop.Inv=c(0, 1, 0.7),

tests/testthat/test-ticktext-linebreaks.R

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,18 @@ expect_margin <- function(L, gg, ticktext) {
2525
expect_equal(round(L$layout$margin$l, 10), round(margin_l, 10))
2626
}
2727

28-
# Linebreaks
29-
d <- data.frame(x = c(1, 2, 3), y = c("ticktext\nlong_ticktext\nticktext", "ticktext", "ticktext"))
30-
gg <- ggplot(d, aes(x, y)) + geom_bar(stat = "identity")
28+
3129

3230
test_that("ggplotly takes account of linebreaks in ticktext", {
31+
testthat::skip_if_not(getRversion() >= "4.3.0")
32+
33+
# Linebreaks
34+
d <- data.frame(
35+
x = c(1, 2, 3),
36+
y = c("ticktext\nlong_ticktext\nticktext", "ticktext", "ticktext")
37+
)
38+
gg <- ggplot(d, aes(x, y)) + geom_bar(stat = "identity")
39+
3340
# Visual Test
3441
L <- expect_doppelganger_built(gg, "ticktext-linebreaks")
3542
# ggplotly returns correct margin

0 commit comments

Comments
 (0)