Parcourir la source

Fix typo in get_title_size() and add test

pull/18/head
Garrick Aden-Buie il y a 7 ans
Parent
révision
f6edac08ff
2 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. +1
    -1
      R/animate_options.R
  2. +1
    -0
      tests/testthat/test-anim_options.R

+ 1
- 1
R/animate_options.R Voir le fichier

@@ -195,7 +195,7 @@ get_text_size <- function(x = NULL) {

get_title_size <- function(x = NULL) {
if (!is.null(x)) return(x)
plot_settings$anim_opts$text_size %||%
plot_settings$anim_opts$title_size %||%
getFromNamespace("theme_env", "ggplot2")$current$plot.title$size %||%
plot_settings$default$title_size
}

+ 1
- 0
tests/testthat/test-anim_options.R Voir le fichier

@@ -12,6 +12,7 @@ test_that("setting and getting animation options works", {
expect_equal(get_anim_opt(), anim_options(text_size = 5, title_size = 10))
expect_error(get_anim_opt("text_size"))
expect_equal(get_text_size(), get_anim_opt()$text_size)
expect_equal(get_title_size(), get_anim_opt()$title_size)

anim_options_set(anim_options(2, 1))
expect_equal(get_anim_opt("transition_length"), 2)

Chargement…
Annuler
Enregistrer