diff --git a/crates/layers/tests/it/panel_reveal.rs b/crates/layers/tests/it/panel_reveal.rs index ff8f90525..59d691d35 100644 --- a/crates/layers/tests/it/panel_reveal.rs +++ b/crates/layers/tests/it/panel_reveal.rs @@ -106,14 +106,21 @@ impl Rig { self.fixture.by_label(name).expect("the row is drawn").rect } - /// One frame that reveals `id`, with what it reported; asserts that the frame ran once and measured no row twice. + /// One frame that reveals `id`, with what it reported; asserts that the frame ran once and measured no row twice but + /// the rows the lead moves between. fn reveal(&mut self, id: u32, groups: Groups) -> Vec> { self.seen.borrow_mut().clear(); self.reveal.set(Some((id, groups))); self.fixture.idle(1); assert_eq!(self.fixture.passes(), 1, "a reveal runs its frame once"); let measures = craft_ui::runtime::measure::row_measures(self.fixture.ctx()); - assert!(measures.iter().all(|(_, count)| *count == 1), "a reveal measures no row twice: {measures:?}"); + // The lead moves to the revealed row: the row it leaves, measured before the move, is measured again with its + // new state, as is the revealed row when the pass measured it before the move. + let again = measures.iter().filter(|(_, count)| *count == 2).count(); + assert!( + measures.iter().all(|(_, count)| *count <= 2) && again <= 2, + "a reveal measures again only the rows the lead moves between: {measures:?}" + ); self.seen.borrow_mut().drain(..).collect() } diff --git a/crates/ui-patterns/tests/it/docking/runs.rs b/crates/ui-patterns/tests/it/docking/runs.rs index 8da246af1..c0b77acfb 100644 --- a/crates/ui-patterns/tests/it/docking/runs.rs +++ b/crates/ui-patterns/tests/it/docking/runs.rs @@ -296,20 +296,22 @@ fn a_tab_switch_runs_only_its_group() { assert_eq!(ran(&fixture), 0, "and they settle at it: {:?}", memo_runs(&fixture)); } -/// A new label for one panel runs only its group's tab row: the other groups' menus, which name it, are built only -/// while open. +/// A new label for one panel runs only its group's tab row, once: the other groups' menus, which name it, are built +/// only while open. #[trial] fn a_label_change_runs_only_its_groups_chrome() { let MemoDock { mut fixture, labels, .. } = memo_dock(side_by_side(3), None); labels.borrow_mut()[4] = "Renamed".to_owned(); fixture.frame(Vec::new()); let rows_ran = frame_ran_ids(&fixture, "TabRow"); - assert!( - rows_ran.len() == 2 && rows_ran[0] == rows_ran[1], - "only the third group's tab row ran: its real run, then one measuring run in the discard pass's sizing pass: {:?}", + assert_eq!( + rows_ran.len(), + 1, + "only the third group's tab row ran, once: it measures the new label before it places its tabs: {:?}", frame_memo_runs(&fixture) ); - assert_eq!(memo_of(&fixture, "TabRow"), (0, 3), "the last pass replays every tab row: {:?}", memo_runs(&fixture)); + assert_eq!(fixture.passes(), 1, "the frame runs once"); + assert_eq!(memo_of(&fixture, "TabRow"), (1, 2), "the other tab rows replay: {:?}", memo_runs(&fixture)); assert_eq!(body_runs(), Vec::::new(), "no body ran"); assert!(fixture.texts().iter().any(|text| text.text == "Renamed"), "the tab shows the new label"); fixture.idle(SETTLE).frame(Vec::new());