tests/testthat/test-geom-polypath.R

test_that("polypath works as intended", {
  skip_if_not_installed("vdiffr")

  load_longlake_data(which = "longlake_waterdf")
  df <- df_spatial(longlake_waterdf[3,])
  expect_doppelganger(
    "polygon without the proper holes",
    ggplot() +
      ggplot2::geom_polygon(aes(x, y, group = piece_id), data = df)
  )

  expect_doppelganger(
    "polygon with the proper holes",
    ggplot() +
      geom_polypath(aes(x, y, group = piece_id), data = df)
  )

  expect_error(
    ggplot() + geom_polypath(aes(x, y, group = piece_id), data = df, rule = "fish"),
    "must be 'evenodd'"
  )
})

Try the ggspatial package in your browser

Any scripts or data that you put into this service are public.

ggspatial documentation built on Aug. 17, 2023, 5:13 p.m.