| Marc Kupietz | 59e95a6 | 2026-08-29 10:19:05 +0300 | [diff] [blame] | 1 | test_that("title slide branding works (website QR, partner_logo, funder_logo)", { |
| 2 | skip_on_cran() |
| 3 | skip_if_not_installed("qrcode") |
| 4 | skip_if_not_installed("base64enc") |
| 5 | |
| 6 | logo_svg <- tempfile(fileext = ".svg") |
| 7 | writeLines( |
| 8 | '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><rect width="10" height="10"/></svg>', |
| 9 | logo_svg |
| 10 | ) |
| 11 | |
| 12 | doc <- tempfile(fileext = ".Rmd") |
| 13 | writeLines( |
| 14 | sprintf( |
| 15 | '--- |
| 16 | title: "Test" |
| 17 | output: revealjs.ids::revealjs_presentation |
| 18 | website: "https://www.ids-mannheim.de/" |
| 19 | partner_logo: "%s" |
| 20 | funder_logo: "%s" |
| 21 | --- |
| 22 | |
| 23 | ## A slide |
| 24 | ', |
| 25 | logo_svg, logo_svg |
| 26 | ), |
| 27 | doc |
| 28 | ) |
| 29 | |
| 30 | out <- rmarkdown::render(doc, quiet = TRUE) |
| 31 | html <- paste(readLines(out, warn = FALSE), collapse = "\n") |
| 32 | |
| 33 | expect_match(html, '<div class="title-qr">', fixed = TRUE) |
| 34 | expect_match(html, '<a class="qrcode" href="https://www.ids-mannheim.de/">', |
| 35 | fixed = TRUE |
| 36 | ) |
| 37 | expect_match(html, "partner-logo: url(\"data:image/svg+xml;base64,", |
| 38 | fixed = TRUE |
| 39 | ) |
| 40 | expect_match(html, '<img class="funder-logo" src="data:image/svg+xml;base64,', |
| 41 | fixed = TRUE |
| 42 | ) |
| 43 | }) |