tests/testthat/test-compiler-pt-to-lines.r

acontext("pt/points to lines conversion test")

viz <- list(
  p1 = ggplot()+
    geom_point(aes(Petal.Length, Sepal.Length, color=Species),data=iris))

theme.pars <- plot_theme(viz)
panel_margin_lines <- pt.to.lines(theme.pars$panel.margin)

if(grid::unitType(theme.pars$panel.margin) %in% c("pt", "points")) {
  test_that("after conversion values unequal", {
    # The values shouldn't be identical because we're applying operations over the value.
    # new_val <- round(as.numeric(pt_value) * (0.25/5.5), digits = 2)
    # pt.to.lines() should return different value if unit passed is pt/points.
    expect_false(identical(panel_margin_lines, theme.pars$panel.margin))
  })
}

Try the animint2 package in your browser

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

animint2 documentation built on Nov. 22, 2023, 1:07 a.m.