Skip to content

Comments

Simplify UI layout tests#21081

Merged
alice-i-cecile merged 4 commits intobevyengine:mainfrom
ickshonpe:simplify-ui-layout-tests
Dec 16, 2025
Merged

Simplify UI layout tests#21081
alice-i-cecile merged 4 commits intobevyengine:mainfrom
ickshonpe:simplify-ui-layout-tests

Conversation

@ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Sep 16, 2025

Objective

The UI layout tests use dummy Window entities and a system update_cameras_test_system that updates the camera target info from the dummy windows. We can simplify the tests, and make them less fragile, by setting the camera's ComputedCameraValues and RenderTargetInfo directly.

Solution

  • Remove the dummy Window entities, any Window queries, and update_cameras_test_system.
  • In the UI test setup code, set the values for the camera's computed values and render target info when they are spawned.
  • Had to hack around a bit with the ui_node_should_properly_update_when_changing_target_camera test and manually set the camera's viewport values. The logic for the other tests is unchanged.

This ended up one line longer in total, but it's just because of white space added by formatting around the nested camera value declarations.

Testing

The tests still pass.

@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets 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-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 16, 2025
@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change X-Uncontroversial This work is generally agreed upon labels Sep 16, 2025
Copy link
Contributor

@rossleonardy rossleonardy left a comment

Choose a reason for hiding this comment

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

Makes sense to get window out of here

@pablo-lua pablo-lua 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 Dec 15, 2025
@alice-i-cecile
Copy link
Member

@ickshonpe more merge conflicts, sorry!

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 16, 2025
Merged via the queue into bevyengine:main with commit a2e5c7a Dec 16, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-UI Graphical user interfaces, styles, layouts, and widgets C-Code-Quality A section of code that is hard to understand or change 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 X-Uncontroversial This work is generally agreed upon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants