File: test-logo.R

package info (click to toggle)
r-cran-usethis 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,228 kB
  • sloc: sh: 26; makefile: 17; cpp: 6; ansic: 3
file content (32 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
test_that("use_logo() doesn't error with no README", {
  skip_if_not_installed("magick")
  skip_on_os("solaris")

  create_local_package()
  img <- magick::image_write(magick::image_read("logo:"), "logo.png")
  expect_no_error(use_logo("logo.png"))
})

test_that("use_logo() shows a clickable path with README", {
  skip_if_not_installed("magick")
  skip_on_os("solaris")

  create_local_package()
  use_readme_md()
  img <- magick::image_write(magick::image_read("logo:"), "logo.png")
  withr::local_options(usethis.quiet = FALSE)
  expect_snapshot(use_logo("logo.png"),  transform = scrub_testpkg)
})

# https://github.com/r-lib/usethis/issues/1999
test_that("use_logo() writes a file in lowercase and it knows that", {
  skip_if_not_installed("magick")
  skip_on_os("solaris")

  create_local_package()
  img <- magick::image_write(magick::image_read("logo:"), "LoGo.PNG")

  withr::local_options(list(usethis.quiet = FALSE))
  expect_snapshot(use_logo("LoGo.PNG"), transform = scrub_testpkg)
  expect_proj_file("man", "figures", "logo.png")
})