Skip to content

The ability to create fake windows #3754

@Shatur

Description

@Shatur

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 Windows resource and pass a Window struct to it. But to create a Window I need to provide RawWindowHandle. I would suggest to turn this field into Option. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WindowingPlatform-agnostic interface layer to run your app inC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions