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, ...).
This commit is contained in:
aiongg
2026-11-12 14:32:40 +00:00
parent 0bb46ce6e8
commit eb850635e7
2 changed files with 17 additions and 1 deletions
+3 -1
View File
@@ -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) }
}
+14
View File
@@ -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");
}
}