Skip to content

Commit 2d3e3d0

Browse files
author
Lindsay Carr
committed
add mult axis on same side tests back from jread df commits deleting them
1 parent 7cdc1b2 commit 2d3e3d0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/testthat/tests-axis.R

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,41 @@ test_that("axis reverse",{
4747

4848
})
4949

50+
context('multiple axis on the same side can be used')
51+
test_that("axis can append a second one",{
52+
gs <- gsplot() %>%
53+
points(0:1,0:1) %>%
54+
axis(side=1, at=c(0.5,1)) %>%
55+
axis(side=1, at=c(0.25, 0.75), append=TRUE)
56+
expect_equal(sum(names(gs$side.1) == 'axis'), 2)
57+
})
5058

59+
test_that("axis can append a third one and the forth clears them",{
60+
gs <- gsplot() %>%
61+
points(0:1,0:1) %>%
62+
axis(side=1, at=c(0.5,1)) %>%
63+
axis(side=1, at=c(0.25, 0.75), append=TRUE) %>%
64+
axis(side=1, at=c(0.45, 0.55), append=TRUE)
65+
66+
expect_equal(sum(names(gs$side.1) == 'axis'), 3)
67+
gs <- gsplot() %>%
68+
points(0:1,0:1) %>%
69+
axis(side=1, at=c(0.5,1)) %>%
70+
axis(side=1, at=c(0.25, 0.75), append=TRUE) %>%
71+
axis(side=1, at=c(0.45, 0.55), append=TRUE) %>%
72+
axis(side=1, at=c(0.33))
73+
expect_equal(sum(names(gs$side.1) == 'axis'), 1)
74+
expect_equal(gs$side.1$axis$at, 0.33)
75+
})
76+
77+
test_that("axis tracks append FALSE by default",{
78+
gs <- gsplot() %>%
79+
points(0:1,0:1) %>%
80+
axis(side=1, at=c(0.5,1)) %>%
81+
axis(side=1, at=c(0.25, 0.75)) %>%
82+
axis(side=1, at=c(0.45, 0.55), append=TRUE)
83+
expect_equal(sum(names(gs$side.1) == 'axis'), 2)
84+
})
5185

5286
context("axis user flipped on")
5387

0 commit comments

Comments
 (0)