File tree Expand file tree Collapse file tree 5 files changed +24
-14
lines changed Expand file tree Collapse file tree 5 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -323,20 +323,6 @@ fn custom_fonts() {
323323 contents. contains ( "fonts/fonts.css" )
324324 } ;
325325
326- // Mixed with copy-fonts=true
327- // Should ignore the copy-fonts setting since the user has provided their own fonts.css.
328- let temp = TempFileBuilder :: new ( ) . prefix ( "mdbook" ) . tempdir ( ) . unwrap ( ) ;
329- let p = temp. path ( ) ;
330- MDBook :: init ( p) . build ( ) . unwrap ( ) ;
331- write_file ( & p. join ( "theme/fonts" ) , "fonts.css" , b"/*custom*/" ) . unwrap ( ) ;
332- write_file ( & p. join ( "theme/fonts" ) , "myfont.woff" , b"" ) . unwrap ( ) ;
333- MDBook :: load ( p) . unwrap ( ) . build ( ) . unwrap ( ) ;
334- assert ! ( has_fonts_css( p) ) ;
335- assert_eq ! (
336- actual_files( & p. join( "book/fonts" ) ) ,
337- [ "fonts.css" , "myfont.woff" ]
338- ) ;
339-
340326 // copy-fonts=false, no theme
341327 // This should generate a deprecation warning.
342328 let temp = TempFileBuilder :: new ( ) . prefix ( "mdbook" ) . tempdir ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -115,3 +115,25 @@ book/fonts/source-code-pro-v11-all-charsets-500.woff2
115115"# ] ] ,
116116 ) ;
117117}
118+
119+ // Custom fonts.css.
120+ #[ test]
121+ fn fonts_css ( ) {
122+ BookTest :: from_dir ( "theme/fonts_css" )
123+ . check_file_contains ( "book/index.html" , "fonts/fonts.css" )
124+ . check_file (
125+ "book/fonts/fonts.css" ,
126+ str![ [ r#"
127+ /*custom*/
128+
129+ "# ] ] ,
130+ )
131+ . check_file ( "book/fonts/myfont.woff" , str![ [ "" ] ] )
132+ . check_file_list (
133+ "book/fonts" ,
134+ str![ [ r#"
135+ book/fonts/fonts.css
136+ book/fonts/myfont.woff
137+ "# ] ] ,
138+ ) ;
139+ }
Original file line number Diff line number Diff line change 1+ - [ With Fonts] ( index.md )
Original file line number Diff line number Diff line change 1+ /*custom*/
You can’t perform that action at this time.
0 commit comments