fix(shell): coordinate startup cover and tab stills

This commit is contained in:
CRTkafa 2026-09-30 12:25:46 +07:00
parent 01f2ec0417
commit 5a2e959763
13 changed files with 442 additions and 52 deletions

View file

@ -80,6 +80,10 @@ pub struct Placements {
}
impl Placements {
pub fn was_visible(&self, label: &str) -> bool {
self.tabs.get(label).is_some_and(|placed| placed.visible)
}
/// Records `label` at `rect`/`visible` and says what differs from its last placement (a child
/// never placed before differs in both).
pub fn place(&mut self, label: &str, rect: Rect, visible: bool) -> Changed {
@ -144,10 +148,14 @@ mod tests {
#[test]
fn a_recreated_webview_is_placed_again() {
let mut p = Placements::default();
assert!(!p.was_visible("tab-a"));
p.place("tab-a", (5.0, 92.0, 680.0, 803.0), false);
assert!(!p.was_visible("tab-a"));
p.forget("tab-a");
// A fresh webview starts visible: hiding it must not be skipped as "unchanged".
assert_eq!(p.place("tab-a", (5.0, 92.0, 680.0, 803.0), false), Changed { bounds: true, visible: true });
p.place("tab-a", (5.0, 92.0, 680.0, 803.0), true);
assert!(p.was_visible("tab-a"));
}
#[test]