Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d42ec1c

Browse files
committed
update
1 parent 42e921f commit d42ec1c

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ FILE: ../../../flutter/third_party/txt/src/txt/platform_android.cc
10381038
FILE: ../../../flutter/third_party/txt/src/txt/platform_fuchsia.cc
10391039
FILE: ../../../flutter/third_party/txt/src/txt/platform_linux.cc
10401040
FILE: ../../../flutter/third_party/txt/src/txt/platform_mac.mm
1041+
FILE: ../../../flutter/third_party/txt/src/txt/platform_windows.cc
10411042
FILE: ../../../flutter/vulkan/vulkan_application.cc
10421043
FILE: ../../../flutter/vulkan/vulkan_application.h
10431044
FILE: ../../../flutter/vulkan/vulkan_backbuffer.cc

shell/common/shell.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,10 +1385,9 @@ bool Shell::ReloadSystemFonts() {
13851385
document.Accept(writer);
13861386
std::string message = buffer.GetString();
13871387
fml::RefPtr<PlatformMessage> fontsChangeMessage =
1388-
fml::MakeRefCounted<flutter::PlatformMessage>(
1389-
kSystemChannel,
1390-
std::vector<uint8_t>(message.begin(), message.end()),
1391-
nullptr);
1388+
fml::MakeRefCounted<flutter::PlatformMessage>(
1389+
kSystemChannel, std::vector<uint8_t>(message.begin(), message.end()),
1390+
nullptr);
13921391

13931392
OnPlatformViewDispatchPlatformMessage(fontsChangeMessage);
13941393
return true;

shell/common/shell.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,10 @@ class Shell final : public PlatformView::Delegate,
285285
fml::Status WaitForFirstFrame(fml::TimeDelta timeout);
286286

287287
//----------------------------------------------------------------------------
288-
/// @brief Used by embedders to reload the system fonts in FontCollection.
289-
/// It also clears the cached font families and send system channel
290-
/// message to framework to rebuild affected widgets.
288+
/// @brief Used by embedders to reload the system fonts in
289+
/// FontCollection.
290+
/// It also clears the cached font families and send system
291+
/// channel message to framework to rebuild affected widgets.
291292
///
292293
/// @return Returns if shell reloads system fonts successfully.
293294
///

shell/common/shell_unittests.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,17 +532,21 @@ TEST_F(ShellTest, ReloadSystemFonts) {
532532
std::vector<std::string> families(1, "Robotofake");
533533
auto font =
534534
fontCollection->GetMinikinFontCollectionForFamilies(families, "en");
535-
ASSERT_EQ(font->getId(), static_cast<double>(0));
535+
if (font == nullptr) {
536+
// System does not have any font to begin with. Aborts the test.
537+
return;
538+
}
539+
unsigned int id = font->getId();
536540
// Result should be cached.
537541
font = fontCollection->GetMinikinFontCollectionForFamilies(families, "en");
538-
ASSERT_EQ(font->getId(), static_cast<double>(0));
542+
ASSERT_EQ(font->getId(), id);
539543
bool result = shell->ReloadSystemFonts();
540544

541-
// Cache is cleared, and FontCollection will be assigned a new id in
542-
// incremental order.
545+
// Cache is cleared, and FontCollection will be assigned a new id.
543546
font = fontCollection->GetMinikinFontCollectionForFamilies(families, "en");
544-
ASSERT_EQ(font->getId(), static_cast<double>(1));
547+
ASSERT_NE(font->getId(), id);
545548
ASSERT_TRUE(result);
549+
shell.reset();
546550
}
547551

548552
TEST_F(ShellTest, WaitForFirstFrame) {

shell/platform/embedder/tests/embedder_unittests.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ TEST(EmbedderTestNoFixture, CanGetCurrentTimeInNanoseconds) {
238238
TEST_F(EmbedderTest, CanReloadSystemFonts) {
239239
auto& context = GetEmbedderContext();
240240
EmbedderConfigBuilder builder(context);
241+
builder.SetSoftwareRendererConfig();
241242
auto engine = builder.LaunchEngine();
242243
ASSERT_TRUE(engine.is_valid());
243244

0 commit comments

Comments
 (0)