Skip to content

Commit b5e923b

Browse files
committed
add test
1 parent af716a7 commit b5e923b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/testthat/test-coord_sf.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,3 +425,15 @@ test_that("coord_sf() can render with empty graticules", {
425425
p <- suppressWarnings(layer_grob(ggplot(df) + geom_sf())[[1]])
426426
expect_length(p$x, 1)
427427
})
428+
429+
test_that("coord_sf() can calculate breaks when expansion is on", {
430+
skip_if_not_installed("sf")
431+
df <- sf::st_multipoint(cbind(c(-180, 180), c(-90, 90)))
432+
df <- sf::st_sfc(df, crs = 4326)
433+
b <- ggplot_build(ggplot(df) + geom_sf())
434+
435+
x <- get_guide_data(b, "x")
436+
y <- get_guide_data(b, "y")
437+
expect_equal(nrow(x), 5L)
438+
expect_equal(nrow(y), 3L)
439+
})

0 commit comments

Comments
 (0)