tests/testthat/test-geom-sf.R

context("geom-sf")

# Visual tests ------------------------------------------------------------

test_that("geom_sf draws correctly", {
  skip_if_not_installed("sf")
  if (packageVersion("sf") < "0.5.3") skip("Need sf 0.5.3")

  f <- system.file("gpkg/nc.gpkg", package="sf")
  nc <- sf::read_sf(f)

  vdiffr::expect_doppelganger("North Carolina county boundaries",
    ggplot() + geom_sf(data = nc) + coord_sf(datum = 4326)
  )

  pts <- sf::st_sf(a = 1:2, geometry = sf::st_sfc(sf::st_point(0:1), sf::st_point(1:2)))
  vdiffr::expect_doppelganger("spatial points",
    ggplot() + geom_sf(data = pts)
  )
})
SahaRahul/ggplot2 documentation built on May 17, 2019, 1:46 p.m.