1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Add plugin-based kittest inspector

New `InspectorPlugin` (gated behind `inspector` feature) launches a
`kittest_inspector` child process and streams the harness's frames + accesskit
tree updates to it over framed MessagePack on stdin/stdout. The inspector
drives the harness by sending `InspectorCommand`s back; supported commands
include `Step` / `Run` / `Play` / `Pause` (deterministic stepping),
`Handle { events }` (event injection), `Resize`, and `Screenshot`.

Auto-attaches when the `KITTEST_INSPECTOR` env var is truthy — the inspector
binary path can be overridden via `KITTEST_INSPECTOR_PATH`. Uses the new
`egui_inspection::protocol` types and starts every connection with a
`HarnessMessage::Hello { peer_kind: Kittest, capabilities: KITTEST }` so the
inspector can render the right controls.

Also re-exports `egui_inspection` as `egui_kittest::inspector_api` for crates
that only depend on kittest.
This commit is contained in:
lucasmerlin
2026-05-21 12:03:47 +02:00
parent 6e679fdefc
commit e3414bec9d
6 changed files with 571 additions and 4 deletions

View File

@@ -26,6 +26,15 @@ wgpu = ["dep:egui-wgpu", "dep:pollster", "dep:image", "dep:wgpu", "eframe?/wgpu"
## Adds a dify-based image snapshot utility.
snapshot = ["dep:dify", "dep:image", "dep:open", "dep:tempfile", "image/png"]
## Expose the [`inspector_api`] wire protocol used to talk to the external
## `kittest_inspector` binary. Pull this in if you're building a tool that consumes the
## same stream — the binary itself enables this transitively.
inspector_api = ["dep:egui_inspection", "egui_inspection/protocol", "egui/serde"]
## Stream frames + accesskit tree to a `kittest_inspector` window for live debugging.
## Auto-launches when the `KITTEST_INSPECTOR` env var is truthy.
inspector = ["inspector_api", "dep:image"]
## Allows testing eframe::App
eframe = ["dep:eframe", "eframe/accesskit"]
@@ -50,6 +59,9 @@ wgpu = { workspace = true, features = ["metal", "dx12", "vulkan", "gles"], optio
# snapshot dependencies
dify = { workspace = true, optional = true }
# inspector dependencies
egui_inspection = { workspace = true, optional = true }
# Enable this when generating docs.
document-features = { workspace = true, optional = true }