tests/testthat/test-create_table_graphic.R

test_that("create_table_graphic_plot() namespaces", {
  expect_true(requireNamespace("gtable", quietly = TRUE))
  expect_true(requireNamespace("ggplotify", quietly = TRUE))
  expect_true(requireNamespace("ggplot2", quietly = TRUE))
  expect_true(requireNamespace("vdiffr", quietly = TRUE))
})

test_that("create_table_graphic()", {
  expect_snapshot({
    graph_table <- RplotterPkg::create_table_graphic(
      df = RplotterPkg::car_stats,
      table_width = 7,
      show_row_names = TRUE,
      cell_just = "right",
      cell_hor_pos = 0.95,
      title = "Average Measures by Cylinders"
    )
  })
  expect_true(is.ggplot(graph_table))
  vdiffr::expect_doppelganger("create_table_graphic()", graph_table)
  expect_no_error(ggplot_build(graph_table))
})
deandevl/RplotterPkg documentation built on March 1, 2025, 11:17 a.m.