@@ -51,8 +51,8 @@ public function test_copy_activated_fonts_to_theme() {
51
51
$ this ->assertEquals ( 'open-sans ' , $ theme_data_after ['typography ' ]['fontFamilies ' ]['theme ' ][1 ]['slug ' ] );
52
52
53
53
// Ensure that the URL was changed to a local file and that it was copied to where it should be
54
- $ this ->assertEquals ( 'file:./assets/fonts/open-sans-normal- 400.ttf ' , $ theme_data_after ['typography ' ]['fontFamilies ' ]['theme ' ][1 ]['fontFace ' ][0 ]['src ' ][0 ] );
55
- $ this ->assertTrue ( file_exists ( get_stylesheet_directory () . '/assets/fonts/open-sans-normal- 400.ttf ' ) );
54
+ $ this ->assertEquals ( 'file:./assets/fonts/open-sans-400-normal .ttf ' , $ theme_data_after ['typography ' ]['fontFamilies ' ]['theme ' ][1 ]['fontFace ' ][0 ]['src ' ][0 ] );
55
+ $ this ->assertTrue ( file_exists ( get_stylesheet_directory () . '/assets/fonts/open-sans-400-normal .ttf ' ) );
56
56
57
57
$ this ->uninstall_theme ( $ test_theme_slug );
58
58
@@ -486,5 +486,18 @@ private function activate_font_in_theme_and_override_in_user() {
486
486
CBT_Theme_JSON_Resolver::write_user_settings ( $ settings );
487
487
}
488
488
489
+ public function test_make_filename_from_fontface () {
490
+ $ font_face = array (
491
+ 'fontFamily ' => 'Open Sans ' ,
492
+ 'fontWeight ' => '400 ' ,
493
+ 'fontStyle ' => 'normal ' ,
494
+ 'unicodeRange ' => 'U+0000-00FF ' ,
495
+ );
496
+ $ src = 'https://example.com/assets/fonts/open-sans-regular.ttf ' ;
497
+ $ src_index = 0 ;
498
+ $ expected = 'open-sans-400-normal-u0000-00ff.ttf ' ;
499
+ $ actual = CBT_Theme_Fonts::make_filename_from_fontface ( $ font_face , $ src , $ src_index );
500
+ $ this ->assertEquals ( $ expected , $ actual );
501
+ }
489
502
}
490
503
0 commit comments