File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 2020use_logo <- function (img , geometry = " 240x278" , retina = TRUE ) {
2121 check_is_package(" use_logo()" )
2222
23- logo_path <- proj_path(" man" , " figures" , " logo" , ext = path_ext(img ))
23+ ext <- tolower(path_ext(img ))
24+ logo_path <- proj_path(" man" , " figures" , " logo" , ext = ext )
2425 create_directory(path_dir(logo_path ))
2526 if (! can_overwrite(logo_path )) {
2627 return (invisible (FALSE ))
2728 }
2829
29- if (path_ext( img ) == " svg" ) {
30+ if (ext == " svg" ) {
3031 logo_path <- path(" man" , " figures" , " logo.svg" )
3132 file_copy(img , proj_path(logo_path ), overwrite = TRUE )
3233 ui_bullets(c(" v" = " Copied {.path {pth(img)}} to {.path {logo_path}}." ))
Original file line number Diff line number Diff line change 88 [ ] Add logo to 'README.md' with the following html:
99 # {TESTPKG} <img src="man/figures/logo.png" align="right" height="90" alt="" />
1010
11+ # use_logo() writes a file in lowercase and it knows that
12+
13+ Code
14+ use_logo("LoGo.PNG")
15+ Message
16+ v Creating 'man/figures/'.
17+ v Resized 'LoGo.PNG' to 240x278.
18+ [ ] Add logo to your README with the following html:
19+ # {TESTPKG} <img src="man/figures/logo.png" align="right" height="90" alt="" />
20+
Original file line number Diff line number Diff line change @@ -17,3 +17,16 @@ test_that("use_logo() shows a clickable path with README", {
1717 withr :: local_options(usethis.quiet = FALSE )
1818 expect_snapshot(use_logo(" logo.png" ), transform = scrub_testpkg )
1919})
20+
21+ # https://github.com/r-lib/usethis/issues/1999
22+ test_that(" use_logo() writes a file in lowercase and it knows that" , {
23+ skip_if_not_installed(" magick" )
24+ skip_on_os(" solaris" )
25+
26+ create_local_package()
27+ img <- magick :: image_write(magick :: image_read(" logo:" ), " LoGo.PNG" )
28+
29+ withr :: local_options(list (usethis.quiet = FALSE ))
30+ expect_snapshot(use_logo(" LoGo.PNG" ), transform = scrub_testpkg )
31+ expect_proj_file(" man" , " figures" , " logo.png" )
32+ })
You can’t perform that action at this time.
0 commit comments