| 1 |
test_that("beamer_presentation() incorporates latex dependencies", { |
| 2 |
expected_dependencies <- c( |
| 3 |
"\\usepackage{longtable}", # from extra_dependencies |
| 4 |
"\\usepackage{hyperref}" # from knit_meta |
| 5 |
) |
| 6 |
|
| 7 |
extra_dependencies <- list( |
| 8 |
# do not include non-latex dependencies |
| 9 |
# as pre processor does not care the kind of extra dependencies |
| 10 |
latex_dependency("longtable") |
| 11 |
) |
| 12 |
knit_meta <- list( |
| 13 |
latex_dependency("hyperref"), |
| 14 |
html_dependency_jquery() # pre_processor should remove html dependencies |
| 15 |
) |
| 16 |
|
| 17 |
fmt <- beamer_presentation(extra_dependencies = extra_dependencies) |
| 18 |
|
| 19 |
pandoc_args <- fmt$pre_processor( |
| 20 |
list(), |
| 21 |
tempfile(), |
| 22 |
"static", |
| 23 |
knit_meta, |
| 24 |
tempdir(), |
| 25 |
tempdir() |
| 26 |
) |
| 27 |
|
| 28 |
included <- pandoc_args[which(pandoc_args == "--include-in-header") + 1L] |
| 29 |
expect_length(included, 1L) |
| 30 |
expect_true(file.exists(included)) |
| 31 |
expect_identical(readLines(included), expected_dependencies) |
| 32 |
}) |