From eb850635e72891e150aed57e850f97c703513ea6 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 11 Nov 2026 20:09:49 +0000 Subject: [PATCH] Gallery card: the start Reset compares with is noted after the story's first real run A pass that took a kept measurement, ran only the measuring run or held the story back noted an empty start, so every value the story made counted as a change and Reset showed at rest on most cards of a level (ToggleButton, TipEllipse, CompareTile, CurvesPanel, ...). --- crates/ui-gallery/src/chrome/card.rs | 4 +++- crates/ui-gallery/tests/it/overview.rs | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/ui-gallery/src/chrome/card.rs b/crates/ui-gallery/src/chrome/card.rs index c9a3ce341f..11b3f32b9f 100644 --- a/crates/ui-gallery/src/chrome/card.rs +++ b/crates/ui-gallery/src/chrome/card.rs @@ -337,8 +337,10 @@ impl StoryBody { dialog.shown |= dialog.known && shown; dialog.painted = true; } + // The start is the values after the story's first real run: a pass that took a kept measurement, ran + // only the measuring run or held the story back has not made them yet. + state.note_start(); } - state.note_start(); BodyShown { flow: Some(surface.output.rect) } } diff --git a/crates/ui-gallery/tests/it/overview.rs b/crates/ui-gallery/tests/it/overview.rs index 19fd5fc177..713b502984 100644 --- a/crates/ui-gallery/tests/it/overview.rs +++ b/crates/ui-gallery/tests/it/overview.rs @@ -204,3 +204,17 @@ fn selecting_a_component_glides_its_card_to_the_top() { assert!(arrived, "{}'s card reached the top of the view", target.name); assert!(frames > 2, "the card glided over several frames, not in one: {frames}"); } + +/// A card shows Reset only once its story's values differ from its start: at rest, with no input, no card shows it. +/// Regression: the start was noted on a pass where the story had not run (a kept measurement, a held-back story), +/// so every value the story then made counted as a change, on most cards of a level. +#[trial] +fn a_card_at_rest_shows_no_reset() { + for name in ["ToggleButton", "TipEllipse", "CompareTile", "CurvesPanel", "Menu"] { + let mut gallery = gallery_filtered(level_of(name), name); + let mut fixture = Fixture::new(move |ui| gallery.ui(ui)); + fixture.room(Vec2::new(1400.0, 900.0)).settle().idle(3).settle(); + assert!(fixture.by_label("Open").is_some(), "{name}'s card shows"); + assert!(fixture.by_label("Reset").is_none(), "{name}'s card shows Reset with no input"); + } +}