Feat/warn missing fonts - #47
Open
MaximeRougieux wants to merge 2 commits into
Open
Conversation
T-moz
self-requested a review
August 3, 2026 14:11
T-moz
requested changes
Aug 3, 2026
| await awaitImages(); | ||
| } | ||
|
|
||
| // Find by its type except if the widget's unique key was given. |
| ); | ||
| } | ||
|
|
||
| /// Warns about the font families the snapshotted tree asks for while no font |
Comment on lines
+19
to
+21
| /// The registered families are also recorded in the | ||
| /// [AdaptiveTestConfiguration], which is how [expectGolden] knows whether the | ||
| /// text it snapshots will render real glyphs. |
Collaborator
There was a problem hiding this comment.
Remove those added comments. They don't help package user use the function
| }); | ||
|
|
||
| test('records the loaded families in the configuration', () { | ||
| // This is how expectGolden knows what will render real glyphs. |
Comment on lines
+52
to
+77
| final Set<String> _loadedFontFamilies = {}; | ||
|
|
||
| /// The font families [loadFonts] registered in this test isolate. | ||
| Set<String> get loadedFontFamilies => Set.unmodifiable(_loadedFontFamilies); | ||
|
|
||
| /// Records the families [loadFonts] registered, so that [expectGolden] can | ||
| /// tell whether the text it snapshots will render real glyphs. | ||
| void addLoadedFontFamilies(Iterable<String> families) { | ||
| _loadedFontFamilies.addAll(families); | ||
| } | ||
|
|
||
| final Set<String> _warnedFontFamilies = {}; | ||
|
|
||
| /// The missing font families [expectGolden] already warned about, see | ||
| /// [MissingFontsBehavior.warn]. | ||
| Set<String> get warnedFontFamilies => Set.unmodifiable(_warnedFontFamilies); | ||
|
|
||
| /// Records the families that were warned about, so that a gap shared by many | ||
| /// goldens is only reported once. | ||
| void addWarnedFontFamilies(Iterable<String> families) { | ||
| _warnedFontFamilies.addAll(families); | ||
| } | ||
|
|
||
| MissingFontsBehavior _missingFontsBehavior = MissingFontsBehavior.warn; | ||
|
|
||
| MissingFontsBehavior get missingFontsBehavior => _missingFontsBehavior; |
Collaborator
There was a problem hiding this comment.
All how this should stay private. or at least not being exposed to the public API of adaptive_test
Contributor
Author
There was a problem hiding this comment.
Agreed I think I missed this part when reviewing, sorry i'll see what i can change
| /// [MissingFontsBehavior.warn]. | ||
| Set<String> get warnedFontFamilies => Set.unmodifiable(_warnedFontFamilies); | ||
|
|
||
| /// Records the families that were warned about, so that a gap shared by many |
|
|
||
| final Set<String> _warnedFontFamilies = {}; | ||
|
|
||
| /// The missing font families [expectGolden] already warned about, see |
| /// The font families [loadFonts] registered in this test isolate. | ||
| Set<String> get loadedFontFamilies => Set.unmodifiable(_loadedFontFamilies); | ||
|
|
||
| /// Records the families [loadFonts] registered, so that [expectGolden] can |
|
|
||
| final Set<String> _loadedFontFamilies = {}; | ||
|
|
||
| /// The font families [loadFonts] registered in this test isolate. |
Collaborator
|
@MaximeRougieux Remove "Co-Authored-By" AI commit attributions |
MaximeRougieux
force-pushed
the
feat/warn-missing-fonts
branch
from
August 4, 2026 08:52
8c13588 to
d53c8e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With this PR, the package now warns when a test creates a golden of a widget that uses an unknown font
This behavior is optional and can be opted-out (though it is on by default)