diff --git a/crates/ui-contract/src/runtime/env/shell.rs b/crates/ui-contract/src/runtime/env/shell.rs index 3d0b70fa5f..411a22787d 100644 --- a/crates/ui-contract/src/runtime/env/shell.rs +++ b/crates/ui-contract/src/runtime/env/shell.rs @@ -122,6 +122,9 @@ struct Inner { edges: [bool; 3], tabs: bool, panels_hidden: bool, + /// In standard screen mode the user hid the editor's chrome with Tab: the docks, rails and floating panels of the + /// body hide with the shell's bars, while the body itself and the document tabs stay. + chrome_hidden: bool, regions: ShellRegions, float_bounds: Rect, region: Option, @@ -197,6 +200,7 @@ impl ShellCx { edges: [false; 3], tabs: true, panels_hidden: false, + chrome_hidden: false, regions, float_bounds, region: None, @@ -224,6 +228,13 @@ impl ShellCx { self } + /// The editor's chrome is hidden: the user pressed Tab in standard screen mode, so the shell's bars and rails are + /// gone and the body's docks, rails and floating panels go with them, while the body and the document tabs stay. + pub fn with_chrome_hidden(mut self, hidden: bool) -> Self { + Arc::make_mut(&mut self.inner).chrome_hidden = hidden; + self + } + /// The Tab reveal is on or off. pub fn with_tab_reveal(mut self, on: bool) -> Self { Arc::make_mut(&mut self.inner).tab_reveal = on; @@ -280,11 +291,18 @@ impl ShellCx { self.inner.panels_hidden } - /// Whether the dock at `edge` shows: in normal mode and during the Tab reveal unless the panels are hidden, and the - /// `Start` and `End` docks also while that edge's reveal is on, in body-only mode or while the panels are hidden. + /// Whether the user hid the editor's chrome with Tab in standard screen mode: the shell's bars are gone and the + /// body's docks and floating panels hide with them, while the body and the document tabs stay. + pub fn chrome_hidden(&self) -> bool { + self.inner.chrome_hidden + } + + /// Whether the dock at `edge` shows: in normal mode and during the Tab reveal unless the panels are hidden or the + /// editor's chrome is, and the `Start` and `End` docks also while that edge's reveal is on, in body-only mode or + /// while the panels are hidden. pub fn dock_visible(&self, edge: super::PaneEdge) -> bool { let inner = &*self.inner; - let base = !inner.panels_hidden && (inner.mode == BodyMode::Normal || inner.tab_reveal); + let base = !inner.panels_hidden && !inner.chrome_hidden && (inner.mode == BodyMode::Normal || inner.tab_reveal); base || match edge { super::PaneEdge::Start => self.edge_revealed(RevealEdge::Start), super::PaneEdge::End => self.edge_revealed(RevealEdge::End), @@ -293,9 +311,9 @@ impl ShellCx { } /// Whether floating frames show: in normal mode; in body-only mode only during the Tab reveal; never while the - /// panels are hidden. + /// panels are hidden or the editor's chrome is. pub fn floating_visible(&self) -> bool { - !self.inner.panels_hidden && (self.inner.mode == BodyMode::Normal || self.inner.tab_reveal) + !self.inner.panels_hidden && !self.inner.chrome_hidden && (self.inner.mode == BodyMode::Normal || self.inner.tab_reveal) } /// The same skeleton with its revealed rects registered under `id`, which stays the same across passes. Without @@ -344,17 +362,19 @@ impl ShellCx { } /// Are slots shown by a reveal (Tab or edge) on this pass? Only body-only mode reveals with Tab; an edge reveals in - /// body-only mode and while the panels are hidden. + /// body-only mode, while the panels are hidden, and while the editor's chrome is. pub fn revealed(&self) -> bool { let inner = &*self.inner; let body_only = inner.mode == BodyMode::Only; - (body_only && inner.tab_reveal) || ((body_only || inner.panels_hidden) && inner.edges.iter().any(|on| *on)) + let hides_docks = body_only || inner.panels_hidden || inner.chrome_hidden; + (body_only && inner.tab_reveal) || (hides_docks && inner.edges.iter().any(|on| *on)) } - /// Is the edge reveal on for `edge`? False while the panels show in normal mode, and during the Tab reveal. + /// Is the edge reveal on for `edge`? False while the panels show in normal mode with the editor's chrome shown, + /// and during the Tab reveal. pub fn edge_revealed(&self, edge: RevealEdge) -> bool { let inner = &*self.inner; - (inner.mode == BodyMode::Only || inner.panels_hidden) && !inner.tab_reveal && inner.edges[edge.index()] + (inner.mode == BodyMode::Only || inner.panels_hidden || inner.chrome_hidden) && !inner.tab_reveal && inner.edges[edge.index()] } /// The body rect and the shown slots of this pass. @@ -390,12 +410,25 @@ pub struct ShellEntry(#[doc(hidden)] pub Option); impl crate::contract::MemoProps for ShellEntry { fn key(&self, key: &mut crate::contract::MemoKey) { let Some(shell) = &self.0 else { return key.write_u32(0) }; - let Inner { window, mode, tab_reveal, edges, tabs, panels_hidden, regions, float_bounds, region, page_band, reveals: _, dialog: _ } = - &*shell.inner; + let Inner { + window, + mode, + tab_reveal, + edges, + tabs, + panels_hidden, + chrome_hidden, + regions, + float_bounds, + region, + page_band, + reveals: _, + dialog: _, + } = &*shell.inner; key.write_u32(1); key.feed_hash(window); key.feed_hash(&std::mem::discriminant(mode)); - (*tab_reveal, *edges, *tabs, *panels_hidden).key(key); + (*tab_reveal, *edges, *tabs, *panels_hidden, *chrome_hidden).key(key); regions.body.key(key); key.write_u32(regions.slots.len() as u32); for (slot, rect) in ®ions.slots { diff --git a/crates/ui-patterns/tests/it/docking/hidden.rs b/crates/ui-patterns/tests/it/docking/hidden.rs index 1c16b76745..8e9b6063c4 100644 --- a/crates/ui-patterns/tests/it/docking/hidden.rs +++ b/crates/ui-patterns/tests/it/docking/hidden.rs @@ -93,6 +93,22 @@ fn shift_tab_keeps_the_panels_the_host_names_docked_and_floating_and_tab_hides_t assert_eq!(shown_under(tab, true), BTreeSet::from([CANVAS]), "Tab keeps the canvas only, whatever the host names"); } +#[trial] +fn the_standard_chrome_hiding_hides_every_dock_panel_and_floating_window_yet_keeps_the_body() { + let room = Rect::from_min_size(Pos2::ZERO, Vec2::new(400.0, 300.0)); + let chrome = ShellCx::detached(WindowKey::main(), BodyMode::Normal, room).with_chrome_hidden(true); + assert_eq!( + shown_under(chrome.clone(), true), + BTreeSet::from([CANVAS]), + "the standard Tab hides keeps the protected canvas alone, whatever the host names" + ); + assert_eq!( + shown_under(chrome.with_edge_reveal(RevealEdge::Start, true), false), + BTreeSet::from([CANVAS, TOOLBAR]), + "the start edge's reveal shows the start dock alone, as under Tab" + ); +} + #[trial] fn a_revealed_edge_shows_its_dock_alone_under_tab_and_shift_tab() { let room = Rect::from_min_size(Pos2::ZERO, Vec2::new(400.0, 300.0)); diff --git a/crates/ui-shell/src/shell/app_shell.rs b/crates/ui-shell/src/shell/app_shell.rs index 984c07aeca..8c58854932 100644 --- a/crates/ui-shell/src/shell/app_shell.rs +++ b/crates/ui-shell/src/shell/app_shell.rs @@ -327,6 +327,9 @@ struct Placed<'a, S> { title: bool, /// The options bar: it follows the place, and it is the options bar's height at every edge. options: bool, + /// An editor bar or rail: the user's Tab in standard screen mode hides it, while the title and the status bar + /// stay. + bars: bool, /// The slot's name in the shell's words, for a slot of the canvas preset. named: Option Label>, version: VersionFn<'a, S>, @@ -458,6 +461,8 @@ pub struct AppShellOutput { pub struct ChromeState { /// The user hid every panel, tool and bar. pub hidden: bool, + /// In standard screen mode the user hid the editor's bars and rails with Tab; the title and status slots stay. + pub chrome_hidden: bool, /// The panels are hidden while the tools and bars stay. pub panels_hidden: bool, /// The edge whose slots a reveal shows, when one is on. @@ -477,7 +482,12 @@ pub fn chrome_state(ctx: &Context, viewport: ViewportId) -> ChromeState { impl ChromeState { /// What `reveal` says: the one source of a pass's output and of [`chrome_state`]. fn of(reveal: &Reveal) -> Self { - ChromeState { hidden: reveal.hidden(), panels_hidden: reveal.panels_hidden(), revealed: reveal.revealed_edge() } + ChromeState { + hidden: reveal.hidden(), + chrome_hidden: reveal.chrome_hidden(), + panels_hidden: reveal.panels_hidden(), + revealed: reveal.revealed_edge(), + } } } @@ -505,7 +515,9 @@ impl Outcome for AppShellOutput { /// Tab; the pointer at the top, start or end edge shows that edge's slots, unless a button is held or a popup is /// open or `edge_reveal` is off. Revealed slots cover the body and leave its rect as it is. A screen-mode change ends /// a reveal. The shell takes its own window's Tab toggles from the frame state in the pass that records them: in -/// normal mode Tab hides every slot and panel and shows them again. +/// standard screen mode Tab hides the editor's bars and rails (the [`options_bar`](Self::options_bar) and the slots +/// put by [`top`](Self::top), [`bottom`](Self::bottom), [`start`](Self::start) and [`end`](Self::end)) and shows them +/// again, while the title and status slots stay shown; in the other normal-mode screen it hides every slot and panel. /// - **Canvas preset.** [`title_bar_if`](Self::title_bar_if), [`options_bar`](Self::options_bar), /// and [`status`](Self::status) add the slots of a document editor under the keys of [`slots`](super::slots), /// named by `ShellWords`; the toolbar is a panel of the dock, not a slot; each takes the host's `visible` flag, passed every frame. @@ -633,8 +645,16 @@ impl<'a, S> AppShell<'a, S> { /// The title slot with a slot of your own, for a title that follows the host's menu bar flag. pub fn title(mut self, slot: Slot, version: impl Fn(&S) -> Option + 'a, add: impl FnMut(&mut Ui, &mut BodyCx<'_>, &mut S) + 'a) -> Self { - self.title = - Some(Placed { slot, edge: PaneEdge::Top, title: true, options: false, named: None, version: Box::new(version), add: Box::new(add) }); + self.title = Some(Placed { + slot, + edge: PaneEdge::Top, + title: true, + options: false, + bars: false, + named: None, + version: Box::new(version), + add: Box::new(add), + }); self } @@ -649,7 +669,8 @@ impl<'a, S> AppShell<'a, S> { self.title(Slot::new(keys::TITLE).visible(visible).reveal_if(visible), version, add) } - /// The options bar, a top slot keyed `"options"` that reveals in body-only mode. + /// The options bar, a top slot keyed `"options"` that reveals in body-only mode and hides when the user hides the + /// editor's chrome in standard screen mode. pub fn options_bar( mut self, visible: bool, @@ -662,6 +683,7 @@ impl<'a, S> AppShell<'a, S> { edge: PaneEdge::Top, title: false, options: true, + bars: true, named: Some(|words| words.options.clone()), version: Box::new(version), add: Box::new(add), @@ -669,7 +691,8 @@ impl<'a, S> AppShell<'a, S> { self } - /// The status bar, a bottom slot keyed `"status"` that never reveals. + /// The status bar, a bottom slot keyed `"status"` that never reveals and stays shown while the user hides the + /// editor's chrome in standard screen mode. pub fn status(mut self, visible: bool, version: impl Fn(&S) -> Option + 'a, add: impl FnMut(&mut Ui, &mut BodyCx<'_>, &mut S) + 'a) -> Self { let slot = Slot::new(keys::STATUS).visible(visible); self.slots.push(Placed { @@ -677,6 +700,7 @@ impl<'a, S> AppShell<'a, S> { edge: PaneEdge::Bottom, title: false, options: false, + bars: false, named: Some(|words| words.status.clone()), version: Box::new(version), add: Box::new(add), @@ -727,7 +751,7 @@ impl<'a, S> AppShell<'a, S> { version: impl Fn(&S) -> Option + 'a, add: impl FnMut(&mut Ui, &mut BodyCx<'_>, &mut S) + 'a, ) -> Self { - self.slots.push(Placed { slot, edge, title: false, options: false, named: None, version: Box::new(version), add: Box::new(add) }); + self.slots.push(Placed { slot, edge, title: false, options: false, bars: true, named: None, version: Box::new(version), add: Box::new(add) }); self } @@ -818,14 +842,17 @@ impl<'a, S> AppShell<'a, S> { let paged = page.is_some(); let toggles = take_chrome_toggles(&ctx, viewport, &window); if !paged { - kept.reveal.apply(&toggles, host_only, allow_reveal); + kept.reveal.apply(&toggles, host_only, allow_reveal, mode == ScreenMode::Standard); } let only = kept.reveal.only(host_only); + // In standard screen mode the user's Tab hides the editor's bars and rails; those slots hide and reveal + // like they do in body-only mode, while the title and status slots and the body's own parts stay. + let bars = kept.reveal.chrome_hidden(); let pointer = pointer::frame(&ctx); let frozen = !pointer.buttons.is_empty() || any_open(&ctx, OpenFilter::Keys); let rtl = cx.env.direction().is_rtl(); if !paged { - kept.reveal.track(Tracking::new(only, allow_reveal, edge_reveal), Aim::new(pointer.pos, frozen, cx.rect, rtl)); + kept.reveal.track(Tracking::new(only || bars, allow_reveal, edge_reveal), Aim::new(pointer.pos, frozen, cx.rect, rtl)); } // Every shown slot's rect and the body's, before any slot runs. Slots that a reveal shows in body-only mode @@ -833,7 +860,9 @@ impl<'a, S> AppShell<'a, S> { let plan = |is_dropped: bool| { let visible: Vec = slots .iter() - .map(|placed| !bare && !paged && kept.reveal.shows(&placed.slot, placed.edge, only, allow_reveal, mode, is_dropped)) + .map(|placed| { + !bare && !paged && kept.reveal.shows(&placed.slot, placed.edge, only || (bars && placed.bars), allow_reveal, mode, is_dropped) + }) .collect(); let claims: Vec = slots .iter() @@ -844,7 +873,7 @@ impl<'a, S> AppShell<'a, S> { key: placed.slot.key(), edge: placed.edge, extent: placed.extent(&tokens, &kept.measured), - overlay: covers(&placed.slot, only), + overlay: covers(&placed.slot, only || (bars && placed.bars)), }) .collect(); let regions = layout(cx.rect, &claims, rtl); @@ -887,6 +916,7 @@ impl<'a, S> AppShell<'a, S> { .with_tabs(tabs) .with_tab_reveal(kept.reveal.tab()) .with_panels_hidden(chrome.panels_hidden) + .with_chrome_hidden(chrome.chrome_hidden) .with_reveals_key(sub(cx.id, "reveals")); // The room an embedded shell shows: its rect less what a scroll or a parent clips. Its dialogs are contained in // it. @@ -964,7 +994,7 @@ impl<'a, S> AppShell<'a, S> { for (placed, shown) in slots.iter_mut().zip(&visible) { let floats = floating && placed.options; // A floating bar is a layer over the body: it shows with the covering slots in every mode. - if !*shown || if floats { !covering } else { covers(&placed.slot, only) != covering } { + if !*shown || if floats { !covering } else { covers(&placed.slot, only || (bars && placed.bars)) != covering } { continue; } let by_content = placed.sized_by_content(); diff --git a/crates/ui-shell/src/shell/reveal.rs b/crates/ui-shell/src/shell/reveal.rs index ff694122ea..f6db702128 100644 --- a/crates/ui-shell/src/shell/reveal.rs +++ b/crates/ui-shell/src/shell/reveal.rs @@ -13,12 +13,15 @@ pub(crate) const EDGE_REVEAL_STRIP: f32 = 8.0; /// /// - `hidden`: the user hid every panel, tool and bar in normal mode (Tab); the window then behaves as in body-only /// mode, and Tab shows them again. +/// - `chrome`: in standard screen mode the user hid the editor's chrome (Tab): the bars and rails built to hide with it +/// go, the title and status slots stay, and Tab shows them again. The window does not become body-only. /// - `panels_hidden`: the panels are hidden and the tools and bars stay (Shift+Tab). /// - `tab`: in body-only mode, Tab shows the slots built to reveal until the next Tab. /// - `edges`: in body-only mode the pointer at the top, start or end edge shows the slots of that edge. #[derive(Clone, Debug, Default, PartialEq)] pub(crate) struct Reveal { hidden: bool, + chrome: bool, panels_hidden: bool, tab: bool, edges: [bool; 3], @@ -78,14 +81,15 @@ const EDGES: [RevealEdge; 3] = [RevealEdge::Top, RevealEdge::Start, RevealEdge:: impl Reveal { /// Applies the toggles the window's shell took from the frame state in this pass. `host_only` says the screen mode - /// shows the body only; `allow_reveal` is off for a presentation. - pub(crate) fn apply(&mut self, toggles: &[ChromeToggle], host_only: bool, allow_reveal: bool) { + /// shows the body only; `allow_reveal` is off for a presentation; `standard` says the screen mode is Standard, + /// where Tab hides the editor's chrome bars and rails while the window keeps its title and status slots. + pub(crate) fn apply(&mut self, toggles: &[ChromeToggle], host_only: bool, allow_reveal: bool, standard: bool) { for toggle in toggles { - self.toggle(*toggle, host_only, allow_reveal); + self.toggle(*toggle, host_only, allow_reveal, standard); } } - fn toggle(&mut self, toggle: ChromeToggle, host_only: bool, allow_reveal: bool) { + fn toggle(&mut self, toggle: ChromeToggle, host_only: bool, allow_reveal: bool, standard: bool) { match toggle { ChromeToggle::Panels if host_only => { if allow_reveal { @@ -96,20 +100,26 @@ impl Reveal { } } } + ChromeToggle::Panels if standard => { + self.chrome = !(self.chrome || self.panels_hidden); + self.panels_hidden = false; + self.end_reveal(); + } ChromeToggle::Panels => { self.hidden = !(self.hidden || self.panels_hidden); self.panels_hidden = false; self.end_reveal(); } - ChromeToggle::PanelsKeepTools if !host_only && !self.hidden => self.panels_hidden = !self.panels_hidden, + ChromeToggle::PanelsKeepTools if !host_only && !(self.hidden || self.chrome) => self.panels_hidden = !self.panels_hidden, ChromeToggle::ShowPanels => { - if self.hidden || self.panels_hidden { + if self.hidden || self.chrome || self.panels_hidden { self.hidden = false; + self.chrome = false; self.panels_hidden = false; self.end_reveal(); } } - ChromeToggle::Reveal(Some(edge)) if allow_reveal && !self.tab && (self.only(host_only) || self.panels_hidden()) => { + ChromeToggle::Reveal(Some(edge)) if allow_reveal && !self.tab && (self.only(host_only) || self.chrome || self.panels_hidden()) => { self.edges = [false; 3]; self.edges[at(edge)] = true; self.pinned = Some((edge, None)); @@ -125,6 +135,7 @@ impl Reveal { /// Ends the Tab and edge reveal and the user's hiding: every screen-mode change does. pub(crate) fn clear(&mut self) { self.hidden = false; + self.chrome = false; self.panels_hidden = false; self.end_reveal(); } @@ -155,6 +166,12 @@ impl Reveal { self.hidden } + /// Whether the user hid the editor's chrome bars and rails with Tab in standard screen mode; the window's title + /// and status slots, and everything of the body that is not a bar, stay. + pub(crate) fn chrome_hidden(&self) -> bool { + self.chrome + } + /// The edge whose reveal is on, when one is. pub(crate) fn revealed_edge(&self) -> Option { EDGES.into_iter().find(|edge| self.edges[at(*edge)]) diff --git a/crates/ui-shell/tests/it/shell/reveal.rs b/crates/ui-shell/tests/it/shell/reveal.rs index d8592e078c..710310f52c 100644 --- a/crates/ui-shell/tests/it/shell/reveal.rs +++ b/crates/ui-shell/tests/it/shell/reveal.rs @@ -198,7 +198,7 @@ fn chrome_state_reads_the_hiding_the_shell_left_and_show_panels_ends_it() { assert!(!seen.panels_hidden); let seen = tabbed(&mut windows, &mut mode); - assert_eq!(state(&windows), (true, false, None), "Tab hid the chrome"); + assert_eq!(state(&windows), (false, false, None), "Tab hid the chrome in standard mode: the window's own hiding, not the body-only one"); assert!(!seen.panels_hidden && !seen.revealed); tabbed(&mut windows, &mut mode); assert_eq!(state(&windows), (false, false, None), "Tab showed it"); @@ -229,3 +229,113 @@ fn chrome_state_reads_the_hiding_the_shell_left_and_show_panels_ends_it() { "a viewport with no shell reads the default" ); } + +/// What one pass of a full document window's shell showed: the slots it laid out, whether the shell put the +/// window into its body-only hiding, and whether the body saw the chrome hiding. +struct WindowSeen { + slots: Vec<&'static str>, + hidden: bool, + bars: bool, + body_sees_bars: bool, +} + +/// One frame of a document window's shell: a title bar under the host's menu-bar flag, an options bar, a status +/// bar and a tool rail, with a document canvas in the body and nothing focused, so Tab reaches the shell. +fn window_pass(windows: &mut Frames, mode: &mut ScreenMode, events: Vec) -> WindowSeen { + let ctx = windows.ctx.clone(); + let mut seen = WindowSeen { slots: Vec::new(), hidden: false, bars: false, body_sees_bars: false }; + windows.frame(events, |ui| { + let mut body_sees_bars = false; + let out = AppShell::new(WindowKey::main()) + .screen_mode(Bind::bound(&mut *mode)) + .title_bar_if( + true, + |_| Some(0), + |ui, _, _: &mut ()| { + Text::new("Title").show(ui); + }, + ) + .options_bar( + true, + |_| Some(0), + |ui, _, _: &mut ()| { + Text::new("Options").show(ui); + }, + ) + .status( + true, + |_| Some(0), + |ui, _, _: &mut ()| { + Text::new("Status").show(ui); + }, + ) + .start( + Slot::new("tools").reveal(), + |_| Some(0), + |ui, _, _: &mut ()| { + Text::new("Tools").show(ui); + }, + ) + .body(|ui, cx, _| { + body_sees_bars = cx.shell().is_some_and(|shell| shell.chrome_hidden()); + let canvas = ui.scope_id().with("document"); + ui.interact(ui.max_rect(), canvas, Sense::click()); + host_canvas(ui.ctx(), canvas, KeyUse::CANVAS); + }) + .show(ui, &mut ()); + let state = chrome_state(&ctx, ViewportId::ROOT); + seen = WindowSeen { + slots: out.regions.slots.iter().map(|(key, _)| *key).collect(), + hidden: state.hidden, + bars: state.chrome_hidden, + body_sees_bars, + }; + }); + seen +} + +fn window_settled(windows: &mut Frames, mode: &mut ScreenMode) -> WindowSeen { + (0..3).map(|_| window_pass(windows, mode, vec![])).last().expect("three passes") +} + +fn window_tabbed(windows: &mut Frames, mode: &mut ScreenMode) -> WindowSeen { + let key = |pressed| Event::Key { key: Key::Tab, physical_key: None, pressed, repeat: false, modifiers: Modifiers::NONE }; + window_pass(windows, mode, vec![key(true)]); + window_pass(windows, mode, vec![key(false)]); + window_settled(windows, mode) +} + +#[trial] +fn tab_in_standard_hides_the_options_bar_and_rail_and_keeps_the_title_and_status() { + let mut windows = window(); + let mut mode = ScreenMode::Standard; + let settled = window_settled(&mut windows, &mut mode); + assert_eq!(settled.slots, ["title", "options", "status", "tools"], "the document window shows its bars and its rail"); + assert!(!settled.bars && !settled.body_sees_bars, "nothing is hidden"); + let seen = window_tabbed(&mut windows, &mut mode); + assert_eq!(seen.slots, ["title", "status"], "Tab hides the options bar and the rail and keeps the title bar and the status bar"); + assert!(!seen.hidden, "the window does not become body-only: its own chrome stays"); + assert!(seen.bars && seen.body_sees_bars, "the pass and its body read the chrome hiding, so a body with panels hides them too"); + command(&windows, ChromeToggle::Reveal(Some(RevealEdge::Top))); + assert_eq!( + window_settled(&mut windows, &mut mode).slots, + ["title", "options", "status"], + "an edge reveal shows the hidden bar over the body, as it does today" + ); + command(&windows, ChromeToggle::Reveal(None)); + let seen = window_tabbed(&mut windows, &mut mode); + assert_eq!(seen.slots, ["title", "options", "status", "tools"], "Tab again shows what it hid"); + assert!(!seen.hidden && !seen.bars && !seen.body_sees_bars, "and the window is a normal window again"); +} + +#[trial] +fn tab_in_full_screen_with_menu_bar_hides_every_slot_as_before() { + let mut windows = window(); + let mut mode = ScreenMode::FullScreenWithMenuBar; + assert_eq!(window_settled(&mut windows, &mut mode).slots, ["title", "options", "status", "tools"], "the mode keeps the bars and the rail"); + let seen = window_tabbed(&mut windows, &mut mode); + assert!(seen.slots.is_empty(), "Tab there hides every slot, the title bar included, as it does today"); + assert!(seen.hidden, "the window behaves as body-only"); + let seen = window_tabbed(&mut windows, &mut mode); + assert_eq!(seen.slots, ["title", "options", "status", "tools"], "Tab again shows them"); +}