瀏覽代碼

Fix typo in get_title_size() and add test

pkg-add-anim-opts-fixed
Garrick Aden-Buie 7 年之前
父節點
當前提交
d47f3de2b4
共有 2 個檔案被更改,包括 2 行新增1 行删除
  1. +1
    -1
      R/animate_options.R
  2. +1
    -0
      tests/testthat/test-anim_options.R

+ 1
- 1
R/animate_options.R 查看文件



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

+ 1
- 0
tests/testthat/test-anim_options.R 查看文件

expect_equal(get_anim_opt(), anim_options(text_size = 5, title_size = 10)) expect_equal(get_anim_opt(), anim_options(text_size = 5, title_size = 10))
expect_error(get_anim_opt("text_size")) expect_error(get_anim_opt("text_size"))
expect_equal(get_text_size(), 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)) anim_options_set(anim_options(2, 1))
expect_equal(get_anim_opt("transition_length"), 2) expect_equal(get_anim_opt("transition_length"), 2)

Loading…
取消
儲存