-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
The ability to create fake windows #3754
Copy link
Copy link
Closed
Labels
A-WindowingPlatform-agnostic interface layer to run your app inPlatform-agnostic interface layer to run your app inC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to use
Metadata
Metadata
Assignees
Labels
A-WindowingPlatform-agnostic interface layer to run your app inPlatform-agnostic interface layer to run your app inC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
When writing unit tests for the UI, access to the window is required. But since the tests run in parallel by default, it's impossible to create a real window outside of the main thread. For details, see #1720.
What solution would you like?
But for unit testing, a real window is not needed, it is enough to create a fake one. Currently users can add windows manually using add on
Windowsresource and pass aWindowstruct to it. But to create aWindowI need to provide RawWindowHandle. I would suggest to turn this field intoOption. This way users will be able to create dummy windows and UI plugins will know necessary stuff, like window size and scale. Currently UI plugins such as Egui work in headless mode, but crashes on any access to context because there is no associated window.