| test_that("title slide branding works (website QR, partner_logo, funder_logo)", { |
| skip_on_cran() |
| skip_if_not_installed("qrcode") |
| skip_if_not_installed("base64enc") |
| |
| logo_svg <- tempfile(fileext = ".svg") |
| writeLines( |
| '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><rect width="10" height="10"/></svg>', |
| logo_svg |
| ) |
| |
| doc <- tempfile(fileext = ".Rmd") |
| writeLines( |
| sprintf( |
| '--- |
| title: "Test" |
| output: revealjs.ids::revealjs_presentation |
| website: "https://www.ids-mannheim.de/" |
| partner_logo: "%s" |
| funder_logo: "%s" |
| --- |
| |
| ## A slide |
| ', |
| logo_svg, logo_svg |
| ), |
| doc |
| ) |
| |
| out <- rmarkdown::render(doc, quiet = TRUE) |
| html <- paste(readLines(out, warn = FALSE), collapse = "\n") |
| |
| expect_match(html, '<div class="title-qr">', fixed = TRUE) |
| expect_match(html, '<a class="qrcode" href="https://www.ids-mannheim.de/">', |
| fixed = TRUE |
| ) |
| expect_match(html, "partner-logo: url(\"data:image/svg+xml;base64,", |
| fixed = TRUE |
| ) |
| expect_match(html, '<img class="funder-logo" src="data:image/svg+xml;base64,', |
| fixed = TRUE |
| ) |
| }) |