😎 Give your xaringan slides some style
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

39 linhas
1.3KB

  1. context("test-themes")
  2. test_theme_file <- function(theme = "duo") {
  3. theme_fun <- switch(
  4. theme,
  5. "duo" = duo,
  6. "duo_accent" = duo_accent,
  7. "duo_accent_inverse" = duo_accent_inverse,
  8. "mono_accent" = mono_accent,
  9. "mono_accent_inverse" = mono_accent_inverse,
  10. "mono_dark" = mono_dark,
  11. "mono_light" = mono_light,
  12. "solarized_dark" = solarized_dark,
  13. "solarized_light" = solarized_light,
  14. stop("Unknown theme")
  15. )
  16. tmpfile <- tempfile()
  17. theme_file <- paste0(theme, ".css")
  18. theme_fun(outfile = tmpfile)
  19. theme_css <- readLines(tmpfile)
  20. # Mask package version in test files
  21. theme_css <- sub("( \\* Version: )[\\d.-]+", "\\1a.b.c.d.eeee", theme_css, perl = TRUE)
  22. theme_css <- paste(theme_css, collapse = "\n")
  23. expect_known_output(cat(theme_css), test_path("css", theme_file))
  24. }
  25. test_that("duo()", test_theme_file("duo"))
  26. test_that("duo_accent()", test_theme_file("duo_accent"))
  27. test_that("duo_accent_inverse()", test_theme_file("duo_accent_inverse"))
  28. test_that("mono_accent()", test_theme_file("mono_accent"))
  29. test_that("mono_accent_inverse()", test_theme_file("mono_accent_inverse"))
  30. test_that("mono_dark()", test_theme_file("mono_dark"))
  31. test_that("mono_light()", test_theme_file("mono_light"))
  32. test_that("solarized_dark()", test_theme_file("solarized_dark"))
  33. test_that("solarized_light()", test_theme_file("solarized_light"))