8000 Load images on the ui thread for tests by lucasmerlin · Pull Request #6901 · emilk/egui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Load images on the ui thread for tests #6901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2025
Merged

Conversation

lucasmerlin
Copy link
Collaborator

#5394 made it so images would load on a background thread, which is great. But this makes snapshot tests that have images via include_image!() flakey since they might or might not load by the time the snapshot is rendered.
This is no perfect solution, since the underlying problem of "waiting for something async to happen" still exists and we should add some more general solution for that.

@lucasmerlin lucasmerlin added tests Unit tests, regression tests, manual tests, … egui egui_extras and removed egui labels Apr 30, 2025
@lucasmerlin lucasmerlin added this to the 0.32.0 milestone Apr 30, 2025
Copy link

Preview available at https://egui-pr-preview.github.io/pr/6901-lucasload-images-sync-for-test
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@emilk emilk merged commit 2947821 into master Apr 30, 2025
49 of 50 checks passed
@emilk emilk deleted the lucas/load-images-sync-for-test branch April 30, 2025 10:55
lucasmerlin added a commit that referenced this pull request May 7, 2025
lucasmerlin added a commit that referenced this pull request May 8, 2025
With kittest it was difficult to wait for images to be loaded before
taking a snapshot test.
This PR adds `Harness::with_wait_for_pending_images` (true by default)
which will cause `Harness::run` to sleep until all images are loaded (or
`HarnessBuilder::with_max_steps` is exceeded).

It also adds a new ImageLoader::has_pending and
BytesLoader::has_pending, which should be implemented if things are
loaded / decoded asynchronously.

It reverts #6901 which was my previous
attempt to fix this (but this didn't work since only the tested crate is
compiled with cfg(test) and not it's dependencies)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui_extras tests Unit tests, regression tests, manual tests, …
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0