@@ -519,6 +519,30 @@ TEST_F(ShellTest, ReportTimingsIsCalledImmediatelyAfterTheFirstFrame) {
519
519
ASSERT_EQ (timestamps.size (), FrameTiming::kCount );
520
520
}
521
521
522
+ TEST_F (ShellTest, ReloadSystemFonts) {
523
+ auto settings = CreateSettingsForFixture ();
524
+
525
+ fml::MessageLoop::EnsureInitializedForCurrentThread ();
526
+ auto task_runner = fml::MessageLoop::GetCurrent ().GetTaskRunner ();
527
+ TaskRunners task_runners (" test" , task_runner, task_runner, task_runner,
528
+ task_runner);
529
+ auto shell = CreateShell (std::move (settings), std::move (task_runners));
530
+
531
+ auto fontCollection = GetFontCollection (shell.get ());
532
+ std::vector<std::string> families (1 , " Robotofake" );
533
+ auto font = fontCollection->GetMinikinFontCollectionForFamilies (families, " en" );
534
+ ASSERT_EQ (font->getId (), (unsigned int )0 );
535
+ // Result should be cached.
536
+ font = fontCollection->GetMinikinFontCollectionForFamilies (families, " en" );
537
+ ASSERT_EQ (font->getId (), (unsigned int )0 );
538
+ bool result = shell->ReloadSystemFonts ();
539
+
540
+ // Cache is cleared, and FontCollection will be assigned a new id in incremental order.
541
+ font = fontCollection->GetMinikinFontCollectionForFamilies (families, " en" );
542
+ ASSERT_EQ (font->getId (), (unsigned int )1 );
543
+ ASSERT_TRUE (result);
544
+ }
545
+
522
546
TEST_F (ShellTest, WaitForFirstFrame) {
523
547
auto settings = CreateSettingsForFixture ();
524
548
std::unique_ptr<Shell> shell = CreateShell (settings);
0 commit comments