tests/testthat/test-grid-utils.R

test_that("width_cm and height_cm work with unit arithmetic", {
  x <- 2 * unit(1, "cm")

  expect_equal(width_cm(x), 2)
  expect_equal(height_cm(x), 2)
})

Try the ggplot2 package in your browser

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

ggplot2 documentation built on Oct. 12, 2023, 5:08 p.m.