mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 19:13:28 +00:00
settle chrome: the column bar scopes without an id salt, and the tests drop the deprecated Ui::id and unused mut
This commit is contained in:
@@ -119,9 +119,9 @@ pub(in crate::docking) fn settled_bar(ui: &mut Ui, band: Rect, content: Option<u
|
||||
if !band.is_positive() {
|
||||
return BarRecord::default();
|
||||
}
|
||||
ui.scope_builder(UiBuilder::new().max_rect(band).id_salt("column bar"), |ui| {
|
||||
ui.scope_builder(UiBuilder::new().max_rect(band), |ui| {
|
||||
// Keyed by the scope's id, under its column's: unique among the bars of a scroll area's columns.
|
||||
let lazy = Lazy::new(ui.id(), 0.0).settles(content.is_some());
|
||||
let lazy = Lazy::new(ui.scope_id(), 0.0).settles(content.is_some());
|
||||
let lazy = match content {
|
||||
Some(version) => lazy.content(version),
|
||||
None => lazy,
|
||||
|
||||
@@ -274,7 +274,7 @@ impl DockPanels<usize> for Noted {
|
||||
}
|
||||
|
||||
fn body(&mut self, panel: &usize, ui: &mut Ui, _: &mut BodyCx<'_>) {
|
||||
self.ids.borrow_mut().push((*panel, ui.id()));
|
||||
self.ids.borrow_mut().push((*panel, ui.scope_id()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ fn a_settled_bar_keeps_its_caption_record() {
|
||||
let windows = Windows::new();
|
||||
let host = WindowHost::of(&windows.ctx);
|
||||
let ran = Cell::new(false);
|
||||
let mut frame = || {
|
||||
let frame = || {
|
||||
ran.set(false);
|
||||
windows.frame(vec![], vec![], |ui| {
|
||||
Lazy::new("bar", 0.0).settles(true).content(1).show(ui, |ui| {
|
||||
@@ -103,7 +103,7 @@ fn a_settled_bar_keeps_its_caption_record() {
|
||||
ran.get()
|
||||
};
|
||||
assert!(frame(), "the bar runs in its first frame");
|
||||
let settled = (0..4).map(|_| frame()).last();
|
||||
let settled = (0..4).map(|_| frame()).next_back();
|
||||
assert_eq!(settled, Some(false), "the bar settles");
|
||||
let regions = host.caption_regions(ViewportId::ROOT).expect("the settled bar keeps its parts");
|
||||
assert_eq!(regions.buttons.len() + regions.edges.len() + regions.moves.len(), 3, "every part stays: {regions:?}");
|
||||
|
||||
@@ -446,7 +446,7 @@ fn a_settled_child_runs_when_the_theme_or_density_changes() {
|
||||
});
|
||||
});
|
||||
fixture.settle();
|
||||
let mut frame = |fixture: &mut Fixture| {
|
||||
let frame = |fixture: &mut Fixture| {
|
||||
runs.set(0);
|
||||
fixture.frame(Vec::new());
|
||||
runs.get()
|
||||
@@ -471,7 +471,7 @@ fn a_settled_child_runs_when_the_language_changes() {
|
||||
});
|
||||
});
|
||||
fixture.settle();
|
||||
let mut frame = |fixture: &mut Fixture| {
|
||||
let frame = |fixture: &mut Fixture| {
|
||||
runs.set(0);
|
||||
fixture.frame(Vec::new());
|
||||
runs.get()
|
||||
|
||||
Reference in New Issue
Block a user