File: test-geom-polygon.R

package info (click to toggle)
r-cran-ggplot2 3.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,748 kB
  • sloc: sh: 15; makefile: 5
file content (26 lines) | stat: -rw-r--r-- 572 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

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

skip_if(utils::packageVersion('grid') < "3.6")
test_that("geom_polygon draws correctly", {

  tbl <- data_frame(
    x = c(
      0, 10, 10, 0,
      20, 30, 30, 20,
      22, 28, 28, 22
    ),
    y = c(
      0, 0, 10, 10,
      20, 20, 30, 30,
      22, 22, 28, 28
    ),
    group = c(rep(1, 4), rep(2, 8)),
    subgroup = c(rep(1, 8), rep(2, 4))
  )

  p <- ggplot(tbl, aes(x, y, group = group, subgroup = subgroup)) +
    geom_polygon()

  expect_doppelganger("basic polygon plot", p)
})