1context("stat_ellipsis") 2 3test_that("stat_ellipsis returns correct data format", { 4 n_seg <- 40 5 d <- data_frame(x = c(1, 1, 4, 4, 4, 3, 3, 1), y = c(1:4, 1:4), id = rep(1:2, each = 4)) 6 p <- ggplot(d, aes(x = x, y = y, group = id)) + 7 geom_point() + 8 stat_ellipse(segments = n_seg) 9 out <- layer_data(p, 2) 10 expect_equal(nrow(out), (n_seg + 1) * 2) 11 expect_equal(unique(out$group), c(1, 2)) 12}) 13