Skip to content

testing::Driver: an interactive test driver (click, drag, type, press, settle) #373

Closed

Description

@samitbasu

From a consumer's widget review: its rig (338 lines, 26 tests) runs the real view through egui frames with click(path_suffix), drag, type_text, press(chord), key, select_all and window_focus, reads back nodes by path suffix and painted text by content (painted, shows, fits), and settle()s across animations.

eggshell's own tests/it files (interaction, commands, blur_cause, dnd_*, choices, hit_route…) each carry private copies of these helpers.

Proposal: a public testing::Driver covering that surface, then migrate eggshell's own tests onto it (removing the duplicates) and offer it to consumers. It builds on Headless, Placed queries and Placed::menu_open.

Activity

  1. added
    v0.1
    consumer
    on Nov 18, 2026
  2. samitbasu commented on Nov 18, 2026

    @samitbasu
    OwnerAuthor

    Design note: testing::Driver

    Read against origin/main at 62fc13a (after #375). This is a note only: no code and no PR. The consumer is not named.

    0. The survey: what the driver replaces

    tests/it/support/mod.rs (704 lines): the shared rig

    Item Line What it does
    Rig<A> 142 The harness state: app, LayoutState, view fn, Bar companion, Page, ReducedMotion, and the last frame copied out as nodes: Vec<(String, Rect)> and ids: Vec<(String, Id)> (277–285), plus an observe hook
    harness, harness_prepared, harness_stepped, harness_scaled_stepped, harness_scaled, harness_timed 162, 173, 184, 195, 208, 219 Six constructors for one builder. Every frame applies shadcn and full_motion, runs prepare, paints the page, shows the bar, then builds, lays out and draws. The step is 0.05 s and the accessibility check is on
    FrameRig, frame_harness, frame_harness_scaled 540, 546, 556 The same for a view that draws the whole frame itself (scroll areas, dnd). It steps at 1/60 s and turns record on
    full_motion 129 Restores animation_time, which kittest sets to zero
    past_bar 76 Focuses the bar's last Tab stop
    rect_of, id_of 295, 306 Look up an exact readable path in the copied list. They panic
    hover_over 316 hover_at, then 3 frames
    press_and_release 321 A primary press, a frame, a release, a frame
    click_node 383 rect_of centre, hover_over, press_and_release
    hover_node 361 Hovers a node's centre
    press, release 491, 504 Press (or release) on a node, then 12 frames
    drag 334 Hover 3 frames, drag_at, then the midpoint, to and drop_at, one frame each, then 3 frames
    rest_for_tooltip 369 Steps until the clock passes tooltip delay plus enter (loop capped at 10 000), then 4 frames
    focused_node, focused_path 391, 403 What has focus: the deepest node whose focus_within holds, or the node path, or <widget>
    shapes, flatten, flatten_all 422, 415, 608 Flatten the last output's shapes
    galley_of, galleys_of, placed_galleys, text_color, part_rect, section_of 624, 635, 645, 479, 662, 681 Painted-text queries by content
    fill_of, box_at, ring_at, textured, turn 347, 454, 467, 432, 444 Paint queries for rects and meshes
    sweep 523 Records a timeline while one parameter steps
    last_drawn, layout_rect 591, 602 Continuity lookups

    Private copies in the test files

    Each one is a kittest primitive followed by a hard-coded number of frames. The numbers differ from file to file.

    • Key press, then N frames.
      • 4 frames: choices.rs:134, commands.rs:270 (with modifiers), mount.rs:225 (with modifiers), numbers.rs:45.
      • 5 frames, through a local settle: menu.rs:123, select.rs:134.
      • 12 frames: modal.rs:46 (press_key, via settle).
      • 4 frames: overlay_input.rs:922.
      • Other counts: owned_number.rs:115 and vlist_nav.rs:85 run 8, slider_header.rs:104 runs 6, splitter.rs:151 runs 3 (with modifiers), swatch_picker.rs:37 runs 5, table.rs:160 runs 3.
      • In all, 14 copies.
    • Tab until a path has focus. Each copy is a loop of 8, 12 or 16 Tabs that panics with the path it never reached:
      • choices.rs:139, menu.rs:421, modal.rs:215, numbers.rs:34, overlay_input.rs:803, owned_choice.rs:113, owned_number.rs:104, select.rs:159, splitter.rs:140.
      • Variants: table.rs:179 (tab_in), modal.rs:418 (tab_into), swatch_picker.rs:42 (tab_to_trigger), focus.rs:56 and modal.rs:541 (tab), form_demo.rs:61 (tab_stops).
    • A local settle that runs a fixed number of frames. None of them waits for quiet:
      • 5 frames: menu.rs:119, select.rs:130.
      • 12 frames: modal.rs:36, table.rs:156.
      • Other counts: overlay_input.rs:342 runs 4, ports.rs:26 runs 3, chat_shell_demo.rs:663 runs 10, tooltips.rs:1153 runs delay plus grace.
    • Waiting on the clock.
    • Click. Most copies are hover_over plus press_and_release plus N frames:
      • interaction.rs:82 takes (x, y) and uses drag_at/drop_at.
      • mount.rs:863 and mount.rs:869 (click_on by path suffix).
      • modal.rs:40 and overlay_input.rs:346 (click_at), then settle.
      • overlay_input.rs:1259 and overlay.rs:498 run no hover frames.
      • owned_choice.rs:607, toggle_group.rs:105 (by label), value_widgets.rs:79 (click_node plus 12 frames).
      • menu.rs:152 (secondary_click), slider_header.rs:232 (click_twice apart: Duration), owned.rs:559 (press_at, press only), interaction.rs:76 (hover).
    • Focus by clicking: prims.rs:97, modal.rs:205 (asserts the precondition). Focus by request: hit_route.rs:471 (request_focus, asserts the precondition).
    • Type. Event::Text, then N frames:
      • 3 frames: form_demo.rs:48, hello.rs:34.
      • Other counts: prims.rs:92 runs 2, slider_header.rs:99 runs 4.
      • Click a field and type: hello.rs:282 and form_demo.rs:54 (fill).
      • Click, then assert focus and typed text: blur_cause.rs:84 (typing), field_focus.rs:63 (typing), commands.rs:279 (start_typing).
    • Drag and lift. "Lift" is press, then +6 and +12 past the threshold, with no release. Its copies:
      • y offsets with 2 frames: dnd_gallery.rs:103, dnd_reorder.rs:66.
      • y offsets with 3 frames: dnd_preview.rs:135, layout_dnd.rs:75.
      • x offsets: dnd_zones.rs:70.
      • dnd_gallery.rs:953 (lift_from).
      • Drags that end in drop_at: dnd_handle.rs:167 (press_and_move) with dnd_handle.rs:180 (release), splitter.rs:125/135, and overlay.rs:513 (drag, a copy of support::drag).
      • Pointer moves: dnd_gallery.rs:115 (pointer_to), dnd_reorder.rs:78 (move_to_row).
    • Window, wheel and touch.
      • overlay_input.rs:521 (window_focus(bool)) sets input.focused, sends WindowFocused and asserts the precondition. blur_cause.rs:100 (blur_the_window) only sends the event.
      • Wheel: modal.rs:51, mount.rs:1030, chat_shell_demo.rs:969.
      • Touch: hit_route.rs:192, markdown.rs:270.
      • Files: dnd_gallery.rs:147/157 and dnd_zones.rs:81/91 (hover_files/drop_files, two identical copies).
    • Node lookups over Rig::nodes.
      • has: menu.rs:128, select.rs:139, overlay.rs:1213, clipboard_example.rs:37, collapsible.rs:119.
      • By path suffix: mount.rs:852 (rect_at, unique) and dnd_zones.rs:47 (find, through the continuity timeline).
      • The notify.rs shown.
      • Many one-off rect, centre and row_rect helpers.
    • Painted text by content. tooltips.rs:100 (painted) and owned_number.rs:587 (shows) are the same function. Others:
      • hello.rs:39 (painted_text, all texts), prims.rs:456, widgets.rs:90.
      • tooltips.rs:546 (galley_of, a third copy), spans.rs:106.
      • tooltips.rs:88/1146/1302 (is_shown, tip_painted, is_shown_in).
    • Harness constructors. 122 private functions in 80 files (1,368 lines) wrap support::harness*. Most add size, base text, a first run_steps(2..4), and sometimes a style prepare. 16 files build their own Harness::builder(): overlay.rs (World), interaction.rs, blur_cause.rs, select.rs, snapshots.rs, draw.rs and others.

    Size. In all there are 276 helper functions and about 2,500 lines:

    Kind Helpers Lines
    Harness constructors 122 1,368
    Key, chord and Tab 32 214
    Click, hover and pointer 29 194
    Painted text 23 215
    Node lookup 21 142
    Drag and lift 13 124
    Window, wheel and touch 12 111
    Type 10 67
    Settle and wait 14 75

    The call sites:

    • click_node 311, rect_of 650, focused_path 133
    • run_steps 1,074, key_press 211, hover_at 138
    • harness.state().app 710
    • #[test] functions: 1,618

    What the survey shows:

    1. No one in eggshell settles. Every "settle" runs a fixed number of frames, and the counts are 3, 4, 5, 6, 8, 10 or 12, depending on who wrote the file.
    2. Rig copies the frame out as (path, rect) and (path, id) lists because Placed::draw(self) consumes the frame. So has, rect_of, the suffix finds and the focus lookups are all written against that copy and not against Query.

    The consumer's rig (338 lines, 26 tests), mapped to the driver

    Rig Driver
    click(path_suffix) click(Target::suffix(..)), or click(d.path(K).at(..)) with typed keys
    drag(from, to) drag(from, to)
    type_text type_text
    press(chord), key press(impl Into<Press>), which takes a Key, a KeyboardShortcut or a Chord
    select_all select_all()
    window_focus(bool) window_focus(WindowFocus::Blurred)
    Read a node by path suffix rect(Target), find(Target), frame().at(..)
    painted, shows, fits painted().text(..), painted().shows(..), PaintedText::fits()
    settle() settle(), with a cap

    1. The Driver API

    1a. The prerequisite: a frame that outlives its draw

    Placed<A> holds two kinds of thing. Its query data (nodes, by_id, prims, roots, root, the kept handle and the ctx) has no closures. Its draw, drag, dismiss and window closures do. draw(self, ..) drops both.

    The query data moves into a new public type, testing::PlacedFrame:

    • Placed<A> holds a PlacedFrame beside its closures.
    • Every query that Placed has today (at, try_at, overlay(s), expect_overlay, menu_open(_with), diff, overflowing, node, rect, nodes, shell) is defined once on PlacedFrame. Placed<A> forwards to it.
    • Query<'p> already reads only nodes, prims and by_id, so it is unchanged.

    When a driver asks for it, draw moves the frame into the LayoutState's kept slot instead of dropping it. Nothing is cloned, and a normal frame pays nothing.

    This removes the reason Rig keeps its own copy. Headless, the driver and a frame-drawing closure then answer through the same Query.

    1b. Construction

    // eggshell_ui::testing, behind the `driver` feature (see Q1)
    use std::time::Duration;
    use egui_kittest::{Harness, HarnessBuilder};
    
    pub struct Driver<A: 'static> { /* Harness<'static, Stage<A>>, After, settle cap, Reports */ }
    
    /// The harness state: the app, its LayoutState and how a frame is drawn. Opaque.
    pub struct Stage<A> { /* .. */ }
    
    impl<A: 'static> Driver<A> {
        /// The driver builds, lays out and draws `view` of `app` each frame, as an app's root does.
        pub fn new(
            app: A,
            view: impl for<'f> FnMut(&mut Builder<'_, 'f, A>, &'f A) + 'static,
        ) -> DriverBuilder<A>;
    
        /// For a view that draws the whole frame itself (scroll areas, dnd frames, a bar beside it).
        /// The driver still reads the frame through the LayoutState it passes in.
        pub fn frame(
            app: A,
            frame: impl FnMut(&mut egui::Ui, &mut A, &mut LayoutState) + 'static,
        ) -> DriverBuilder<A>;
    }
    
    impl<A: 'static> DriverBuilder<A> {
        pub fn size(self, size: egui::Vec2) -> Self;                // default 800×600
        pub fn theme(self, theme: egui::Theme) -> Self;
        pub fn pixels_per_point(self, scale: PixelsPerPoint) -> Self;
        pub fn step(self, step: Duration) -> Self;                   // the clock; default 1/60 s (Q4)
        pub fn motion(self, motion: Animation) -> Self;              // Animation::Full (default) | Reduced (Q5)
        pub fn base_text(self, base: TextStyle) -> Self;
        pub fn setup(self, setup: impl FnOnce(&egui::Context) + 'static) -> Self; // style, fonts, record()
        pub fn after(self, after: After) -> Self;                    // After::Settle (default) | Frames(n) (Q2)
        pub fn settle_within(self, cap: Duration) -> Self;           // default 2 s of clock
        pub fn reports(self, reports: Reports) -> Self;              // Reports::Guarded (default) | Unchecked (§4)
        /// Start from a preconfigured kittest builder: `testing::screenshot::builder(scale, theme)?`.
        pub fn with_harness(self, builder: HarnessBuilder<Stage<A>>) -> Self;
        /// Builds the harness through `HarnessBuilder::build_ui_state`, runs the first frame and settles.
        pub fn build(self) -> Driver<A>;
    }
    
    pub enum Animation { Full, Reduced }
    pub enum After { Settle, Frames(usize) }
    pub enum Reports { Guarded, Unchecked }
    pub enum WindowFocus { Focused, Blurred }

    The clock. egui moves input.time forward by predicted_dt each frame, and kittest sets predicted_dt to its step_dt, so frame n is at n × step on every run. The driver takes a Duration and converts it to kittest's f32 seconds only where it calls with_step_dt. It never calls try_run_realtime, which would sleep.

    The defaults match how an app runs rather than kittest's defaults. kittest zeroes animation_time, which eggshell reads as reduced motion. Its 0.25 s step breaks double clicks. Its max_steps of 4 panics on any transition.

    1c. Addressing a node

    pub enum Target {
        Path(Path),               // typed keys from the root: d.path(Part::Card).at(Part::Save)
        Suffix(String),           // the readable path ends with this; exactly one node must match
        Role(egui::accesskit::Role, String), // resolved through kittest's get_by_role_and_label
        Text(String),             // the one node whose text is this, as Query::text
        Id(egui::Id),
        Point(egui::Pos2),
    }
    impl From<Path> for Target, From<egui::Pos2> for Target, From<egui::Id> for Target;
    impl Target { pub fn suffix(s: &str) -> Self; pub fn role(r: Role, name: &str) -> Self; pub fn text(t: &str) -> Self; }
    
    /// An owned key path. The driver knows its layout's root id, so each `at` hashes its key with
    /// `child_id` straight away, exactly as `Query::at` does. It does not borrow the frame,
    /// so `d.click(d.path(K))` compiles.
    pub struct Path { /* steps: Vec<(readable, Id)> */ }
    impl<A> Driver<A> { pub fn path<K: Key>(&self, key: K) -> Path; }
    impl Path { pub fn at<K: Key>(self, key: K) -> Path; }

    A target is resolved against the last frame when the action runs.

    • A miss panics. The message is Query::at's: the path asked for, then what exists below the deepest step found. A path walks the frame through Query, so the message is the same text.
    • Target::Role reuses kittest's AccessKit query and its "more than one match" panic. It does not search the AccessKit tree a second time.
    • A pointer action asserts its precondition: the point it would press is inside the window. A node scrolled or placed off screen fails with its rect. It is never clicked at a point that egui clips.

    1d. Actions

    Each action queues its events with kittest's own methods (hover_at, drag_at, drop_at, event, key_press_modifiers). It runs one frame per event through harness.step(), then applies the driver's After policy. Every action returns &mut Self, so actions chain.

    impl<A: 'static> Driver<A> {
        // time
        pub fn frames(&mut self, n: usize) -> &mut Self;
        pub fn advance(&mut self, by: Duration) -> &mut Self;     // ceil(by / step) frames: tooltip delays, toast dwell
        pub fn settle(&mut self) -> &mut Self;                    // panics past the cap; see 1f
        pub fn try_settle(&mut self) -> Result<Settled, Unsettled>;
        pub fn now(&self) -> Duration;                            // clock time since build
    
        // pointer: the gestures eggshell's support already uses, so migrated tests send the same events
        pub fn hover(&mut self, at: impl Into<Target>) -> &mut Self;
        pub fn click(&mut self, at: impl Into<Target>) -> &mut Self;            // = support::click_node
        pub fn click_with(&mut self, at: impl Into<Target>, button: PointerButton, modifiers: Modifiers) -> &mut Self;
        pub fn double_click(&mut self, at: impl Into<Target>) -> &mut Self;     // two clicks inside egui's window
        pub fn press(&mut self, keys: impl Into<Press>) -> &mut Self;           // Key | KeyboardShortcut | Chord
        pub fn pointer_down(&mut self, at: impl Into<Target>) -> &mut Self;     // = support::press without its frames
        pub fn pointer_up(&mut self, at: impl Into<Target>) -> &mut Self;
        pub fn drag(&mut self, from: impl Into<Target>, to: impl Into<Target>) -> &mut Self; // = support::drag
        pub fn lift(&mut self, from: impl Into<Target>, past: Vec2) -> &mut Self; // press and carry `past`, in two moves; no release
        pub fn carry_to(&mut self, to: impl Into<Target>) -> &mut Self;
        pub fn wheel(&mut self, at: impl Into<Target>, delta: Vec2) -> &mut Self;
    
        // keyboard
        pub fn type_text(&mut self, text: &str) -> &mut Self;
        pub fn select_all(&mut self) -> &mut Self;                // press(Modifiers::COMMAND + A)
        pub fn tab_to(&mut self, target: impl Into<Target>) -> &mut Self; // Tab until focus is there; panics after one lap of Tab stops
    
        // window and platform
        pub fn window_focus(&mut self, focus: WindowFocus) -> &mut Self;  // sets input.focused and sends WindowFocused
        pub fn hover_files(&mut self, files: &[std::path::PathBuf]) -> &mut Self;
        pub fn drop_files(&mut self, files: &[std::path::PathBuf]) -> &mut Self;
        pub fn resize(&mut self, size: Vec2) -> &mut Self;
        pub fn set_theme(&mut self, theme: egui::Theme) -> &mut Self;
        pub fn focus(&mut self, target: impl Into<Target>) -> &mut Self;  // a programmatic focus request, as hit_route.rs:471
        pub fn event(&mut self, event: egui::Event) -> &mut Self;         // the escape hatch, through the same queue
    
        // the app
        pub fn app(&self) -> &A;
        pub fn app_mut(&mut self) -> &mut A;                      // the next frame sees the change
        pub fn shell(&self) -> Shell;
        pub fn ctx(&self) -> &egui::Context;
        pub fn harness(&self) -> &Harness<'static, Stage<A>>;     // kittest queries, screenshot::render
        pub fn harness_mut(&mut self) -> &mut Harness<'static, Stage<A>>;
    }

    press takes Into<Press>. A Chord refuses a bare Esc or Enter on purpose (commands.rs:150), and tests press those keys constantly, so press also takes a plain Key and KeyboardShortcut. The type system stays honest: it does not invent chords.

    1e. Queries

    impl<A: 'static> Driver<A> {
        pub fn frame(&self) -> &PlacedFrame;                 // at / try_at / text / overlay / expect_overlay / menu_open / overflowing / diff
        pub fn rect(&self, target: impl Into<Target>) -> Rect;          // panics with candidates
        pub fn find(&self, target: impl Into<Target>) -> Option<Rect>;
        pub fn exists(&self, target: impl Into<Target>) -> bool;
        pub fn focused(&self) -> Option<Focused>;             // Focused::Node(path) | Focused::Widget { within: path }
        pub fn painted(&self) -> Painted<'_>;                 // the last output's shapes, groups flattened
        pub fn reports(&self) -> Vec<Report>;
        pub fn expect_reported(&mut self, problem: Problem) -> Report; // panics if absent; takes it so the guard passes
    }
    
    impl<'d> Painted<'d> {
        pub fn texts(&self) -> impl Iterator<Item = PaintedText<'d>>;
        pub fn text(&self, text: &str) -> Option<PaintedText<'d>>;   // the first in paint order
        pub fn all(&self, text: &str) -> Vec<PaintedText<'d>>;
        pub fn shows(&self, text: &str) -> bool;
        pub fn expect(&self, text: &str) -> PaintedText<'d>;          // panics, listing what was painted
    }
    
    pub struct PaintedText<'d> { /* galley, pos, clip rect, colour */ }
    impl PaintedText<'_> {
        pub fn text(&self) -> &str; pub fn rect(&self) -> Rect; pub fn clip(&self) -> Rect;
        pub fn color(&self) -> Color32; pub fn galley(&self) -> &egui::Galley;
        pub fn rows(&self) -> usize; pub fn elided(&self) -> bool;
        pub fn part_rect(&self, part: &str) -> Option<Rect>;          // support::part_rect
        /// One row, not elided, and inside its clip rect: the consumer's `fits`, and #374's predicate.
        pub fn fits(&self) -> bool;
    }

    Assertions or Option. There is one rule, the one Query already follows:

    • A plain name (rect, expect, expect_reported, an action on a missing target, settle) is an assertion helper. It panics with #[track_caller] and #[expect(clippy::panic, reason = "an assertion fails the test")], and its message lists the candidates.
    • find, try_*, text and exists return Option or bool and never panic.
    • Nothing outside testing panics.

    1f. settle with a cap

    settle runs frames until nothing asks for an immediate repaint. It stops there or at the cap, whichever comes first.

    It reuses kittest's own loop. The driver builds its harness with with_max_steps(cap / step) and calls harness.run_ok(). That call never steps past max_steps (kittest's run, by contrast, runs extra diagnostic frames before it panics).

    When run_ok returns None, try_settle returns an error:

    pub struct Unsettled { pub frames: usize, pub clock: Duration, pub causes: Vec<egui::RepaintCause> }

    The error carries ctx.repaint_causes(). settle panics with:

    did not settle within 2s (120 frames of 16.7ms); still repainting: [eggshell_ui::transition at src/transition.rs:…]

    So a spinner that animates forever fails in two seconds of clock, saying where the repaint comes from. It never loops.

    kittest counts only immediate repaints. A tooltip delay or a toast dwell asks for repaint_after and so ends a settle early. Those waits use advance(Duration), which is what rest_for_tooltip, tooltips::wait and notify::wait do today. The docs say so, with a doctest.

    2. How it relates to kittest's Harness

    It wraps kittest. It does not sit beside kittest or replace it.

    • The driver owns a Harness<'static, Stage<A>> built through HarnessBuilder::build_ui_state.
    • Every event goes through kittest's queue, and every frame through harness.step() / run_steps / run_ok. The driver never calls ctx.run or begin_pass itself, so there is no second event pump.
    • harness() and harness_mut() stay open, so these keep working unchanged on a driver: kittest's Queryable (get_by_role_and_label(..).click()), the accessibility check, testing::screenshot::render, and kittest's snapshot API.

    Headless stays as it is, for layout without input. It and the driver now share PlacedFrame and Query, so a layout test and a behaviour test ask the same questions in the same words.

    "Beside" was rejected. Free functions or an extension trait on Harness cannot own the policy (After, the cap, the report guard), cannot hold the frame, and leave every caller to remember full_motion and the step.

    "Replace" was rejected. It would reproduce kittest's AccessKit tree and event handling.

    The feature. egui_kittest is optional today and Linux-only (screenshots). The driver needs it on every native target and without wgpu, so:

    • driver = ["dep:egui_kittest"] is added, and the egui_kittest dependency moves out of the Linux-only table.
    • screenshots keeps egui_kittest/wgpu and its Linux gate.
    • eggshell's own tests/it enables driver through a dev-dependency on itself (eggshell-ui = { path = ".", features = ["driver"] }). So cargo test needs no flag.

    3. Migrating eggshell's own tests

    The rule: test outcomes do not change.

    • Each PR records cargo test --workspace before and after, as the sorted test … ok|FAILED|ignored lines, and diffs them. The diff must be empty.
    • The 1,618 test names are untouched.

    How it stays behaviour-preserving:

    • The driver's gestures are defined to be eggshell's existing ones. click is support::click_node: a 3-frame hover, press, a frame, release, a frame. drag is support::drag, and lift is the dnd lift.
    • So a migrated call sends the same events in the same frames.
    • Each file's private trailing count becomes that file's After::Frames(n). settle (until quiet) is not substituted for a fixed count in the migration.
    • Where one file used two counts (owned_number: Tab 2, press 8; splitter: Tab 2, press 3), the odd one keeps an explicit .frames(n).
    • Turning the fixed counts into settle() is a later, separate change. Each test it flips is listed there.

    support/mod.rs keeps only what is eggshell-specific:

    • The things around the view: Bar, Page, Companion and the shadcn apply. They become one support::driver(size, base_text, app, view) -> DriverBuilder<A> built on Driver::frame. The bar's last stop is kept in a shared cell, so past_bar keeps working.
    • sweep and the rect, ring and mesh paint queries (box_at, ring_at, fill_of, textured, turn).
    • last_drawn and layout_rect.

    What goes away:

    • From support/mod.rs: the six harness* constructors, both frame_harness*, Rig/FrameRig with their nodes/ids copies, rect_of, id_of, hover_over, hover_node, press_and_release, click_node, press, release, drag, rest_for_tooltip, focused_node, focused_path, full_motion, shapes/flatten/flatten_all, and galley_of/galleys_of/placed_galleys/text_color/part_rect. They move into the driver or Painted.
    • From the test files, every copy listed in §0, except the domain helpers: open_file, lap, highlighted and others, which are one-line compositions of driver calls and stay as named steps of their file.

    Size, estimated from the survey:

    • About 150 of the 276 helpers and about 1,100 of their 2,500 lines go. The constructors shrink to one support::driver(..) call plus their real setup.
    • support/mod.rs goes from 704 lines to about 250.
    • The call sites change mechanically: harness.state().app becomes d.app(), click_node(&mut harness, P) becomes d.click(Target::suffix(P)), and rect_of becomes d.rect(..).
    • Net about −1,500 lines in tests/it, against about +900 in the library (including its own tests).

    Left alone:

    • snapshots.rs, because its goldens are pixels and regenerating one is an acceptance step.
    • screenshot.rs, overlay.rs's World/Layers (raw egui areas, not a layout), draw.rs, contract.rs and the fuzz harness. They test below the driver.
    • Any of them can adopt it later, file by file.

    Two behaviour risks are flagged now:

    • blur_cause.rs:100 sends WindowFocused(false) without setting input.focused. The driver's window_focus sets both, as overlay_input.rs:521 does. If the blur_cause tests change outcome, that file keeps d.event(WindowFocused(false)).
    • interaction.rs:82 clicks with drag_at/drop_at, not PointerButton events. It keeps that sequence through pointer_down/pointer_up if click's events change any of its outcomes.

    4. What builds on it

    #301, the report guard.

    • A Driver built with Reports::Guarded, the default, runs assert_no_reports when it is dropped. It checks std::thread::panicking() first, so a failing test is not turned into an abort.
    • A test that expects a report claims it with d.expect_reported(Problem::X), which takes the matching reports. That needs a crate-internal take_reported(ctx, problem) beside take_reports. A test that does not care about reports builds its driver with Reports::Unchecked.
    • The guard does not check after each settle, as the consumer's rig does. A report raised by a click would then fail the test before the test could claim it.
    • Drop runs at the end of every test, which gives the same coverage.
    • Today, 24 tests call assert_no_reports by hand, and those calls go away.

    #374, the text audit.

    • The audit needs what was painted: an overrun of the clip, or text shaved under a point, is only known from the output's clip rects. So it builds on Painted, not on Placed.
    • Wrap and elision are known from layout too, so the layout-only subset can also answer for Headless.
    • The proposal is Driver::text_findings() -> Vec<TextFinding>, which joins each PaintedText to its node in PlacedFrame, with PaintedText::fits() as the one predicate. The consumer's fits and the audit then cannot disagree.
    • The scenario loop is for theme { for size { d.set_theme(t).resize(s).settle(); findings.extend(d.text_findings()) } }. It reports and does not fail, as Text audit: Placed::text_findings() for wrapped, clipped or elided text #374 says.

    5. The PR split

    PR Content Size Behaviour
    A PlacedFrame split out of Placed. Its queries are defined once and Placed forwards. draw hands the frame to the LayoutState on request ~250 lines moved, +60 Unchanged; no test changes
    B testing::Driver behind driver: Target/Path, actions, queries, Painted/PaintedText, settle/advance, the report guard. Doctests, plus tests/it/driver.rs, which proves each action through a real view: a click increments, a drag moves a splitter, typing reaches a text_field, select_all, a blur closes a menu, a tooltip opens after advance and not after settle, a forever-spinner fails settle with its cause, a missing target panics with its candidates ~600 lib + ~300 tests New API only
    C support rebuilt on the driver (reports Unchecked), and the files named in #373 migrated: interaction, commands, blur_cause, choices, hit_route, focus, numbers, owned, owned_choice, owned_number, prims, form_demo, hello, value_widgets, toggle_group, swatch_picker, splitter, slider_header, table, vlist_nav −900 / +500 Outcomes unchanged (diffed)
    D Overlays, motion and frame-drawing views: menu, select, modal, overlay_input, tooltips, notify (after #382 lands), collapsible, presence, the dnd files, layout_dnd, chat_shell_demo, scroll −800 / +450 Outcomes unchanged (diffed)
    E The rest, mostly constructor swaps, and the old support constructors deleted −600 / +400 Outcomes unchanged (diffed)
    F The report guard on for eggshell's own tests. Every test that then fails is listed with its report and either fixed or given expect_reported small An intended behaviour change, enumerated

    #374 follows B and can run in parallel with C to E.

    Breaking changes: none.

    • The public methods of Placed keep their signatures, and draw is unchanged.
    • driver is an added feature. Moving egui_kittest out of the Linux-only table changes no default build.

    This touches no UI, so there is nothing for you to try by hand. The consumer's 338-line rig can move onto the driver once B is released.

    Questions

    1. Feature or always on? One choice is an opt-in driver feature that a consumer enables in its dev-dependencies. The other is making egui_kittest a plain dependency, so testing::Driver is always there. Recommendation: the driver feature. It keeps kittest and accesskit_consumer out of release builds. It is the same shape as screenshots.
    2. What runs after an action? One choice is a policy on the driver (After::Settle by default, After::Frames(n) to change it). The other is explicit chaining at each call (d.click(x).settle()), with actions running only their event frames. Recommendation: the policy. The consumer's rig settles implicitly, and every eggshell helper embeds a count. Explicit chaining makes "forgot to settle" a silent mid-state read.
    3. The report guard (testing: a harness guard that asserts no reports on drop #301) on by default in the driver, with expect_reported / Reports::Unchecked to opt out, and turned on for eggshell's own tests in its own PR (F). Recommendation: yes, to both.
    4. The default step. Recommendation: 1/60 s, a real frame, at which double clicks work. kittest's 0.25 s breaks double clicks, and the rig's 0.05 s is arbitrary. eggshell's own tests pass the rig's 0.05 s explicitly to keep outcomes.
    5. The default motion. Recommendation: Animation::Full, as an app runs and as the rig does. kittest's zero means reduced motion.
    6. Where Text audit: Placed::text_findings() for wrapped, clipped or elided text #374 lives. The issue says Placed::text_findings(). Recommendation: Driver::text_findings(), because clip overruns are only known from paint, with a layout-only subset on Placed for Headless.
    7. Path-suffix strings. The consumer addresses nodes by suffix. Recommendation: offer Target::suffix with uniqueness enforced, but use typed d.path(K).at(..) in the docs and in eggshell's own new tests. Suffixes are what the migration maps rect_of("…") onto.
    8. The name of the closure-free frame. Recommendation: PlacedFrame. The alternatives are Frame, which reads as egui::Frame in egui code, and Scene.
  3. samitbasu commented on Nov 18, 2026

    @samitbasu
    OwnerAuthor

    Decisions (user, 2026-11-18):

    • An opt-in driver feature; eggshell's tests enable it via a dev-dependency.
    • A driver-wide settle-by-default policy, with a cap that fails by naming the repaint causes; timed waits use advance(Duration).
    • The report guard (testing: a harness guard that asserts no reports on drop #301) is on by default, and turned on for eggshell's own tests in a separate PR (newly failing tests listed).
    • The rest of the note is accepted: PlacedFrame first; a 1/60 s step; full motion; Driver::text_findings() for Text audit: Placed::text_findings() for wrapped, clipped or elided text #374; unique path-suffix targets, with typed paths documented first; migration with test outcomes diffed before and after.
    • PRs: A, B, C–E, F, per the note.
  4. added 6 commits that reference this issue on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    consumerv0.1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions