R7.2: the settings window draws no app menus or update banner
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b12858c7f0
commit
03e8e9bcb3
9 files changed
+88
-6
No files matched your search
@@ -53,3 +53,44 @@ fn each_app_shows_its_own_sections(cx: &mut TestAppContext) {
|
||||
assert_eq!(shown, keys, "{app:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A main window's frame.
|
||||
struct Main(gpui::FocusHandle);
|
||||
|
||||
impl gpui::Render for Main {
|
||||
fn render(&mut self, _: &mut gpui::Window, _: &mut gpui::Context<Self>) -> impl gpui::IntoElement {
|
||||
crate::shell::Shell::new("main", &self.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// How far below the title bar the content starts.
|
||||
fn below_title(cx: &mut TestAppContext, window: gpui::AnyWindowHandle) -> gpui::Pixels {
|
||||
let mut shown = gpui::VisualTestContext::from_window(window, cx);
|
||||
for _ in 0..3 {
|
||||
shown.update(|window, _| window.refresh());
|
||||
shown.run_until_parked();
|
||||
}
|
||||
let title = shown.debug_bounds("shell-title").expect("a title bar");
|
||||
shown.debug_bounds("shell-body").expect("a body").origin.y - title.bottom()
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn only_the_main_window_carries_menus_and_updates(cx: &mut TestAppContext) {
|
||||
installed(cx);
|
||||
cx.update(|cx| {
|
||||
let menus = crate::commands::menus(AppId::Mark, &crate::commands::OPENING, false, Vec::new(), cx);
|
||||
cx.set_menus(menus);
|
||||
});
|
||||
let main = cx.add_window(|_, cx| Main(cx.focus_handle()));
|
||||
let menus = below_title(cx, main.into());
|
||||
// macOS keeps menus in the system bar.
|
||||
match cfg!(target_os = "macos") {
|
||||
true => assert_eq!(menus, gpui::px(0.0), "no menu row on macOS"),
|
||||
false => assert!(menus > gpui::px(0.0), "the main window shows the menus"),
|
||||
}
|
||||
cx.update(crate::updates::offer_for_tests);
|
||||
let main = cx.add_window(|_, cx| Main(cx.focus_handle()));
|
||||
assert!(below_title(cx, main.into()) > menus, "the main window shows the update");
|
||||
let settings = cx.add_window(|window, cx| SettingsView::new(AppId::Mark, window, cx));
|
||||
assert_eq!(below_title(cx, settings.into()), gpui::px(0.0), "settings repeats neither");
|
||||
}
|
||||
Reference in new issue
Block a user