Skip to content

Change Harness::run to run until no more repaints are requested#5580

Merged
emilk merged 6 commits intomasterfrom
lucas/kittest-run-until-no-more-repaints
Jan 7, 2025
Merged

Change Harness::run to run until no more repaints are requested#5580
emilk merged 6 commits intomasterfrom
lucas/kittest-run-until-no-more-repaints

Conversation

@lucasmerlin
Copy link
Collaborator

@lucasmerlin lucasmerlin commented Jan 3, 2025

Previously, Harness::run just called Harness::step 3 times. If that wasn't enough, tests would often call run multiple times so all animations would finish properly.

Also, I introduced HarnessBuilder::with_step_dt to customize with how big of a dt each frame is called. I set the default to 1.0 / 6.0 (~6fps) so we don't waste cpu in tests waiting on animations.

HarnessBuilder::max_steps allows us to control how many steps Harness::run should run before panicing.
The default is 6, so we run for up to 1.0 logical seconds (six frames at 6 fps), which should be enough to finish most animations.

Turns out a lot of snapshots where rendered before fully shown and had a light opacity, those are now fixed.

  • I have followed the instructions in the PR template

@lucasmerlin lucasmerlin added feature New feature or request tests Unit tests, regression tests, manual tests, … egui_kittest labels Jan 3, 2025
@github-actions
Copy link

github-actions bot commented Jan 3, 2025

Preview available at https://egui-pr-preview.github.io/pr/5580-lucaskittest-run-until-no-more-repaints
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@lucasmerlin lucasmerlin mentioned this pull request Jan 3, 2025
1 task
@lucasmerlin lucasmerlin force-pushed the lucas/kittest-run-until-no-more-repaints branch from 5cd20ef to 51facca Compare January 6, 2025 13:43
Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Wonderful!

emilk

This comment was marked as duplicate.

@emilk emilk merged commit 52060c0 into master Jan 7, 2025
@emilk emilk deleted the lucas/kittest-run-until-no-more-repaints branch January 7, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui_kittest feature New feature or request tests Unit tests, regression tests, manual tests, …

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants