Skip to content

Add kittest plugin api#8135

Draft
lucasmerlin wants to merge 10 commits into
mainfrom
lucas/kittest-plugin
Draft

Add kittest plugin api#8135
lucasmerlin wants to merge 10 commits into
mainfrom
lucas/kittest-plugin

Conversation

@lucasmerlin
Copy link
Copy Markdown
Collaborator

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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

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

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.
@lucasmerlin lucasmerlin force-pushed the lucas/kittest-plugin branch from 6ac83f8 to 5e7c70b Compare May 21, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant