tests/testthat/test.theme_ggdist.R

# Tests for themes
#
# Author: mjskay
###############################################################################

library(dplyr)
library(tidyr)



test_that("theme helper functions work", {
  skip_if_no_vdiffr()


  p = data.frame(
    x = 1:2,
    y = 0,
    g = c("aaa","bbb")
  ) %>%
    ggplot(aes(x, y)) +
    geom_point() +
    theme_test() +
    axis_titles_bottom_left()

  vdiffr::expect_doppelganger("facet titles on right", {
    p + facet_grid(g ~ .) +
      facet_title_horizontal()
  })

  vdiffr::expect_doppelganger("facet titles on left", {
    p + facet_grid(g ~ ., switch = "y") +
      facet_title_horizontal()
  })

})

Try the ggdist package in your browser

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

ggdist documentation built on Nov. 27, 2023, 9:06 a.m.