mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Skwasm] Respect the debugDisableFallbackFonts flag. (flutter/engine#51626)
Skwasm needs to respect the `debugDisableFallbackFonts` flag, which is used by framework tests.
This commit is contained in:
parent
419e281a4e
commit
f79cfcc0d3
@ -113,7 +113,7 @@ class SkwasmParagraph extends SkwasmObjectWrapper<RawParagraph> implements ui.Pa
|
||||
@override
|
||||
void layout(ui.ParagraphConstraints constraints) {
|
||||
paragraphLayout(handle, constraints.width);
|
||||
if (!_hasCheckedForMissingCodePoints) {
|
||||
if (!debugDisableFontFallbacks && !_hasCheckedForMissingCodePoints) {
|
||||
_hasCheckedForMissingCodePoints = true;
|
||||
final int missingCodePointCount = paragraphGetUnresolvedCodePoints(handle, nullptr, 0);
|
||||
if (missingCodePointCount > 0) {
|
||||
|
||||
@ -431,6 +431,26 @@ void testMain() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('fallback fonts do not download when debugDisableFontFallbacks is set', () async {
|
||||
debugDisableFontFallbacks = true;
|
||||
|
||||
expect(renderer.fontCollection.fontFallbackManager!.globalFontFallbacks, <String>['Roboto']);
|
||||
|
||||
// Creating this paragraph would cause us to start to download the
|
||||
// fallback font if we didn't disable font fallbacks.
|
||||
final ui.ParagraphBuilder pb = ui.ParagraphBuilder(
|
||||
ui.ParagraphStyle(),
|
||||
);
|
||||
pb.addText('Hello 😊');
|
||||
pb.build().layout(const ui.ParagraphConstraints(width: 1000));
|
||||
|
||||
await renderer.fontCollection.fontFallbackManager!.debugWhenIdle();
|
||||
|
||||
// Make sure we didn't download the fallback font.
|
||||
expect(renderer.fontCollection.fontFallbackManager!.globalFontFallbacks,
|
||||
isNot(contains('Noto Color Emoji')));
|
||||
});
|
||||
},
|
||||
// HTML renderer doesn't use the fallback font manager.
|
||||
skip: isHtml,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user