Font loading regression tests - #25482
Open
ickshonpe wants to merge 5 commits into
Open
Conversation
…::MAX (bevyengine#24989) # Objective This fixes an issue in handling Winit windows with `UpdateMode::Reactive` containing a wait duration of `Duration::MAX`. According to the docs on `UpdateMode::Reactive.wait`: `This has no upper limit. The App will wait indefinitely if you set this to Duration::MAX.` In practice, though, configuring the `WinitSettings` resource like the following could cause indefinitely-repeating window redraws after transitioning into the unfocused mode: ```rust WinitSettings { focused_mode: WinitUpdateMode::reactive(Duration::from_secs(1)), unfocused_mode: WinitUpdateMode::reactive_low_power(Duration::MAX), } ``` In the file, this was because the `None` case on the `checked_add` was unhandled, meaning that reaching it with Duration::MAX would cause Winit to always be waiting for a time that had already passed and never properly suspend. ## Solution Simply handle the `None` case by updating the control flow to `Wait`. See code comment for more info. ## Testing In MacOS, I've tested with both the vanilla window/low_power example, alongside a fork modified to use the aforementioned WinitSettings. Between this and brief testing in a personal project, I've found no behavioral regressions. --------- Co-authored-by: drewbluewasabi <drewbluewasabi@gmail.com>
alice-i-cecile
approved these changes
Aug 20, 2026
Member
|
@Cyannide can I get your review here please? |
Cyannide
approved these changes
Aug 20, 2026
Cyannide
left a comment
Contributor
There was a problem hiding this comment.
Both tests are well thought out and seem to cover what they are meant to test. The first one confirms the TextFont doesn't go dirty prematurely and will get flagged once acted on. The second exercises the fact that the changes are tracked independently.
It might be useful to also have tests for loading by font family or families and font removal since it triggers a full rebuild of the collection.
And doing a hot-reload over an existing font especially since currently that's a NOP unless another font was removed in the same frame.
Contributor
Author
|
Yep, these aren't meant to be comprehensive, just splitting things up into small easy to review PRs. |
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.
Objective
Add some regression tests to check that the correct
TextFonts are marked changed on font loading.Solution
Two new tests in the
bevy_text::fontmodule:text_font_is_set_changed_when_its_font_asset_is_insertedtextfonts_are_not_set_changed_when_a_font_asset_is_inserted_for_other_textfonts