tests/testthat/test-plot-utils.R

test_that('device-units-to-inches functions work', {
  skip_if_not(capabilities()["X11"], "Test requires png() device, assumed to require X11")
  on.exit(dev.off())
  grDevices::png(tempfile())
  plot(NA, xlim=0:1, ylim=0:1)
  expect_equal(xdev2in(), 5.02469135802469, tolerance = 1e-4)
  expect_equal(ydev2in(), 4.46913580246914, tolerance = 1e-4)
  expect_equal(xydev2in(), c(5.02469135802469, 4.46913580246914), tolerance = 1e-4)

  for (ii in 1:4) expect_invisible(tile.axes(ii, 2L, 2L))
})

Try the funchir package in your browser

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

funchir documentation built on April 3, 2025, 9:25 p.m.