Skip to content

Commit a98d9e2

Browse files
committed
add test
1 parent adcd2cb commit a98d9e2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/testthat/test-scale-date.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ test_that("not cached across calls", {
4747
expect_equal(get_panel_scales(p2)$x$timezone, "Australia/Lord_Howe")
4848
})
4949

50+
test_that("time scale date breaks and labels work", {
51+
52+
d <- c(base_time(), base_time() + 5 * 24 * 3600) - base_time()
53+
54+
sc <- scale_x_time(date_breaks = "1 day", date_labels = "%d")
55+
sc$train(d)
56+
57+
breaks <- sc$get_breaks()
58+
expect_length(breaks, 6)
59+
labels <- sc$get_labels(breaks)
60+
expect_equal(labels, paste0("0", 1:6))
61+
})
62+
5063
test_that("datetime size scales work", {
5164
p <- ggplot(df, aes(y = y)) + geom_point(aes(time1, size = time1))
5265

0 commit comments

Comments
 (0)