diff --git a/crates/app/src/keymap.rs b/crates/app/src/keymap.rs index 5dd25d5..91c1cc4 100644 --- a/crates/app/src/keymap.rs +++ b/crates/app/src/keymap.rs @@ -1500,7 +1500,7 @@ mod tests { #[test] fn every_default_stroke_reaches_its_action() { let k = Keymap::defaults(); - assert_eq!(k.entries().len(), 73); + assert_eq!(k.entries().len(), 74); // The cut odometer: bare walks one, `<`/`>` (what shift+,/shift+. // actually type) strides ten. assert_eq!(k.lookup(".", false), Some(ActionId::WalkCutNext)); diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index 9a0632d..a7f6083 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -75,6 +75,7 @@ fn every_modal_field_has_a_mounted_surface_somewhere_in_the_darkroom() { "silence_open" => "silence_card(", "mix_open" => "mix_card(", "subtitle_style_open" => "subtitle_style_card(", + "settings_open" => "settings_stance::render(", other => panic!( "Player::modal() now reads `self.{other}` with no entry in this test's \ mount_for map -- add one naming the function that mounts its surface in \ diff --git a/crates/app/src/tests/editing.rs b/crates/app/src/tests/editing.rs index b0c430b..a5bb76e 100644 --- a/crates/app/src/tests/editing.rs +++ b/crates/app/src/tests/editing.rs @@ -903,7 +903,8 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() { let allowed = action == ActionId::CancelExport || action == ActionId::Theme || action == ActionId::Fullscreen - || action == ActionId::SubtitleStyle; + || action == ActionId::SubtitleStyle + || action == ActionId::Settings; assert_eq!( whole(action, busy).yes(), allowed, diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 28640da..36df5e8 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -1922,3 +1922,48 @@ fn every_darkroom_menu_sizes_its_list_against_the_floor_room_not_the_raw_viewpor assert!(sizings > 0, "{file} no longer opens any menu -- update this guard"); } } + +/// The settings page's own organising rule: PROJECT rows open only the +/// doors that write into the `.edith` file ([`Player::open_picker`], +/// [`Player::open_mix`]), and EDITOR rows open only the doors that do not +/// ([`Player::toggle_proxies`], [`Player::toggle_auto_proxies`], +/// [`Player::open_subtitle_style`]) -- never the config-file writers +/// (`ui::dock_stance::config_path`/`ui::theme::config_path`/ +/// `keymap::Keymap::config_path`) directly, which every editor-side row +/// already routes around through its own opener. A row wired to the wrong +/// section's opener is exactly the regression a page organised around two +/// headings invites; this pins each half to its own doors so the two lists +/// cannot cross. +#[test] +fn settings_project_and_editor_sections_open_disjoint_doors() { + let source = src_text("ui/settings_stance.rs"); + let project_start = source.find("fn project_section(").expect("the project section"); + let editor_start = source.find("fn editor_section(").expect("the editor section"); + let render_start = source.find("pub(crate) fn render(").expect("the page's render fn"); + assert!(project_start < editor_start && editor_start < render_start, "the three fns moved; this scan is blind"); + let project_body = &source[project_start..editor_start]; + let editor_body = &source[editor_start..render_start]; + + for door in ["open_picker(", "open_mix("] { + assert!(project_body.contains(door), "PROJECT section no longer opens {door} -- update this guard"); + assert!( + !editor_body.contains(door), + "EDITOR section opens {door}, a project-file door -- that value belongs in PROJECT, not here" + ); + } + for door in ["toggle_proxies(", "toggle_auto_proxies(", "open_subtitle_style("] { + assert!(editor_body.contains(door), "EDITOR section no longer opens {door} -- update this guard"); + assert!( + !project_body.contains(door), + "PROJECT section opens {door}, an editor-only door -- that value belongs in EDITOR, not here" + ); + } + // Neither section writes a config file straight from a row: both go + // through an opener, which is the one place a config-file write (the + // subtitle style card's Save, this window's next project load) is + // allowed to live. + for path_fn in ["dock_stance::config_path", "theme::config_path", "Keymap::config_path"] { + assert!(!project_body.contains(path_fn), "PROJECT section touches {path_fn} directly"); + assert!(!editor_body.contains(path_fn), "EDITOR section touches {path_fn} directly"); + } +} diff --git a/crates/app/src/ui/settings_stance.rs b/crates/app/src/ui/settings_stance.rs index 247eb49..35c6531 100644 --- a/crates/app/src/ui/settings_stance.rs +++ b/crates/app/src/ui/settings_stance.rs @@ -5,9 +5,14 @@ //! - PROJECT: anything that changes the rendered output or is stored in the //! `.edith` file -- resolution, fps, sample-rate, the HDR tonemap, the mix. //! - EDITOR: anything about this machine, this person, this window -- -//! proxies/auto-proxies (this window's decode/import policy) and the -//! subtitle font (a reading preference, kept in `~/.config/edith` like the -//! theme beside it, per [`crate::load_subtitle_style`]). +//! proxies/auto-proxies (this window's decode/import policy, mirrored into +//! the project like the resolution row above it once one is open -- +//! [`engine::PlaybackSession::set_proxies`] -- but with a window-level +//! default, `false`/`true`, that answers before any project is, exactly as +//! [`inspector.rs`]'s own legacy row already does) and the subtitle font +//! (a reading preference, kept in `~/.config/edith` like the theme beside +//! it, per [`crate::load_subtitle_style`], and never written into a +//! project at all). //! //! Every row here reuses an opener or a picker this editor already has //! ([`Player::open_picker`], [`Player::open_mix`], [`Player::open_subtitle_style`], @@ -165,7 +170,10 @@ fn project_section(player: &Player, cx: &mut Context) -> impl IntoElemen } /// EDITOR: this window's own decode/import policy and this person's own -/// reading preference -- never written into the `.edith` file. +/// reading preference. The subtitle font never touches the `.edith` file; +/// the proxy switches do mirror into it once a project is open (they are +/// project state too), but default from the window rather than a project +/// pick, which is what keeps them answerable with nothing open. fn editor_section(player: &Player, cx: &mut Context) -> impl IntoElement { div() .flex_none()