Add kittest plugin api#8135
Draft
lucasmerlin wants to merge 10 commits into
Draft
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/8135-lucaskittest-plugin View snapshot changes at kitdiff |
Replaces the separate on_accesskit_update hook with a `&TreeUpdate` parameter on `after_step` — one hook per step, tree delivered inline. `step_no_side_effects` now returns the TreeUpdate so plugins driving the harness from within their own hook (where nested dispatches are suppressed) can still see it. Also adds `#[track_caller]` to the internal `_step` / `_step_no_side_effects` / `_try_run` so `Location::caller()` inside `step()` walks up to the user's original call site when reached via `run()`.
Drop the redundant `plugin_` prefix on the dispatch helper (it's already a method on `Harness`). Make `TestResult` `Copy` so it can be passed by value inside the dispatch closure, removing the need for the `fail_ref` re-borrow helper. Also drop the empty-plugins early-return microopt in `dispatch` — the `mem::take`/`extend` dance is cheap on empty vecs.
The wrapping Option only existed so Drop could consume SnapshotResults before plugins fire. mem::take swaps in a fresh default instead, dropping the original — same outcome with no Option-juggling at every call site (no more .as_mut().expect(...), and take_snapshot_results stops needing .replace()). The default SnapshotResults has handled = true so dropping the placeholder is a no-op.
6ac83f8 to
5e7c70b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows extending kittest to have code run on every frame.
Useful to e.g. add assertions that should run on any tests.
I'm building a kittest inspector that will use this plugin api to allow debugging kittest tests frame-by-frame.