Skip to content

Font loading regression tests - #25482

Open
ickshonpe wants to merge 5 commits into
bevyengine:mainfrom
ickshonpe:font-loading-regression-tests
Open

Font loading regression tests#25482
ickshonpe wants to merge 5 commits into
bevyengine:mainfrom
ickshonpe:font-loading-regression-tests

Conversation

@ickshonpe

@ickshonpe ickshonpe commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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::font module:

  • text_font_is_set_changed_when_its_font_asset_is_inserted
  • textfonts_are_not_set_changed_when_a_font_asset_is_inserted_for_other_textfonts

ickshonpe and others added 3 commits August 20, 2026 11:07
…::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>
@ickshonpe ickshonpe added C-Testing A change that impacts how we test Bevy or how users test their apps A-Text Rendering and layout for characters S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Aug 20, 2026
@alice-i-cecile

Copy link
Copy Markdown
Member

@Cyannide can I get your review here please?

@Cyannide Cyannide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ickshonpe

Copy link
Copy Markdown
Contributor Author

Yep, these aren't meant to be comprehensive, just splitting things up into small easy to review PRs.

@ickshonpe ickshonpe added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Text Rendering and layout for characters C-Testing A change that impacts how we test Bevy or how users test their apps D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants