tests/testthat/test-geom_marquee.R

test_that("geom_marquee inserts the aesthetics correctly", {
  p <- ggplot2::ggplot(mtcars) +
    geom_marquee(
      ggplot2::aes(disp, mpg, label = gear),
      family = "serif",
      size = 6,
      color = "red",
      fill = "blue",
      size.unit = "Pt"
    )
  png(tempfile())
  p <- ggplot2::ggplotGrob(p)
  dev.off()
  grob <- p$grobs[[which(p$layout$name == "panel")]]$children[[3]]

  expect_equal(grob$text$family[1], "serif")
  expect_equal(grob$text$size[1], 6, tolerance = 0.1)
  expect_equal(grob$text$color[1], "#FF0000")

  expect_s3_class(grob$text$background[[1]], "marquee_skip_inherit")
  expect_equal(as.vector(grob$text$background[[1]]), "blue")
  expect_equal(grob$text$background[[2]], NA_character_)
})

Try the marquee package in your browser

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

marquee documentation built on Sept. 15, 2025, 5:07 p.m.