tests/testthat/test-common-plot.R

test_that("the theme and the save helper work", {
  p <-
    ggplot2::ggplot(data = data.frame(x = 1:5, y = 1:5), mapping = ggplot2::aes(x = x, y = y)) +
    ggplot2::geom_point() +
    dmai_theme()
  expect_s3_class(p, "ggplot")
  f <- tempfile(fileext = ".pdf")
  skip_if_not(capabilities("cairo"), "no cairo device")
  expect_identical(dmai_save(plot = p, filename = f, width = 4, height = 3), f)
  expect_true(file.exists(f))
})

Try the dmai package in your browser

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

dmai documentation built on Nov. 9, 2026, 9:07 a.m.