LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LR-PREF-GENERAL: the Settings window is one size on every tab, and nothing in it runs off the side
Nathaniel Ledford5863025e5067
diff --git a/crates/ui-egui/src/headless.rs b/crates/ui-egui/src/headless.rsindex acd513e98..3f63a4a9b 100644--- a/crates/ui-egui/src/headless.rs+++ b/crates/ui-egui/src/headless.rs@@ -3362,7 +3362,7 @@ mod tests {}/// Switching Settings tabs keeps the window's top edge (and its tab row) where it is and never makes it- /// narrower, though the tabs are of different heights and widths.+ /// narrower or taller, though the tabs hold different amounts: the window is one size on every tab.#[test]fn settings_tabs_keep_the_window_in_place() {let mut h = demo([1300.0, 820.0]);@@ -3381,7 +3381,7 @@ mod tests {assert!(now.width() >= first.width() - 1.0, "{tab}: width {} → {}", first.width(), now.width());heights.push(now.height());}- assert!(heights.iter().any(|h| (h - first.height()).abs() > 20.0), "the tabs differ in height: {heights:?}");+ assert!(heights.iter().all(|h| (h - first.height()).abs() < 1.0), "the tabs keep the height of {}: {heights:?}", first.height());}/// Settings → Import → "Show the import review when a camera or card is connected": a card thatdiff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 1b2517907..5226e8419 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -81,6 +81,8 @@ mod tests_dialog_fit;#[cfg(test)]mod tests_dialog_primary;#[cfg(test)]+mod tests_dialog_settings;+#[cfg(test)]mod tests_dialogs;#[cfg(test)]mod tests_edit_layout;diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rsindex 894ad2bd5..347e8716e 100644--- a/crates/ui-egui/src/panels/dialogs.rs+++ b/crates/ui-egui/src/panels/dialogs.rs@@ -1084,7 +1084,9 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) {}Dialog::Merge { opts } => crate::merge::body(app, ui, opts),Dialog::Import { opts } => crate::import::body(app, ui, opts),- Dialog::Settings { tab } => crate::panels::settings::body(app, ui, tab),+ // (Settings is never taller than `body_max`, so the scroll area round it never+ // scrolls: its tab bar stays put and its pages scroll by themselves)+ Dialog::Settings { tab } => crate::panels::settings::window(app, ui, tab, body_max),Dialog::SamModel { error, .. } => sam_model_body(app, ui, error.as_deref()),Dialog::KeywordTag {editing,diff --git a/crates/ui-egui/src/panels/settings.rs b/crates/ui-egui/src/panels/settings.rsindex 2f844f4ae..0ec907e9e 100644--- a/crates/ui-egui/src/panels/settings.rs+++ b/crates/ui-egui/src/panels/settings.rs@@ -36,21 +36,10 @@ const CACHE_SIZES: [u32; 5] = [512, 1024, 2048, 4096, 8192];const LABEL_W: f32 = 150.0;-/// The dialog body for `tab` (the tab bar switches `tab`).-pub fn body(app: &mut LightcraftApp, ui: &mut egui::Ui, tab: &mut String) {+/// The page of `tab` (the tab bar in [`window`] switches `tab`).+pub fn body(app: &mut LightcraftApp, ui: &mut egui::Ui, tab: &str) {let t = Tokens::get(ui.ctx());- ui.set_width((ui.ctx().content_rect().width() - 64.0).clamp(240.0, 560.0));- ui.horizontal_wrapped(|ui| {- ui.spacing_mut().item_spacing.x = 4.0;- for (id, label) in TABS {- if crate::widgets::text_button(ui, &format!("settingsTab-{id}"), label, tab == id).clicked() {- *tab = id.to_string();- }- }- });- ui.separator();- ui.add_space(2.0);- match tab.as_str() {+ match tab {"import" => import_tab(app, ui, &t),"performance" => performance_tab(app, ui, &t),"display" => display_tab(app, ui, &t),@@ -62,6 +51,108 @@ pub fn body(app: &mut LightcraftApp, ui: &mut egui::Ui, tab: &mut String) {}}+/// The widest the Settings window's content gets, and the tallest its pages get: the window is+/// one size on every tab, so it stays where it is as the tabs are gone through.+const PAGE_SIZE: egui::Vec2 = egui::vec2(560.0, 640.0);++/// The least room in which a page scrolls by itself. In a window with less (far below the+/// desktop minimum), the tabs and the page scroll together in the dialog's own scroll area.+const PAGE_MIN_HEIGHT: f32 = 120.0;++/// The Settings window's content: the tab bar, which stays put, above the page of `tab`+/// ([`body`]), which scrolls when it is taller than the room for it, with a scroll handle that+/// shows without the pointer on it. `max_height` is the room the app window leaves for both: the+/// two together never take more, so the scroll area every dialog is drawn in has nothing to+/// scroll (but for a window with less than [`PAGE_MIN_HEIGHT`] for the page, where that area+/// scrolls the two together). Every page gets the same room whatever it holds, and each keeps a+/// scroll position of its own. Nothing here is wider than the window from 640 pt of app window+/// up: a row's controls wrap ([`row`]) and paths are shortened ([`path_label`]).+pub fn window(app: &mut LightcraftApp, ui: &mut egui::Ui, tab: &mut String, max_height: f32) {+ ui.set_width((ui.ctx().content_rect().width() - 64.0).clamp(240.0, PAGE_SIZE.x));+ let top = ui.cursor().top();+ ui.horizontal_wrapped(|ui| {+ ui.spacing_mut().item_spacing = egui::vec2(4.0, 4.0);+ for (id, label) in TABS {+ if crate::widgets::text_button(ui, &format!("settingsTab-{id}"), label, tab == id).clicked() {+ *tab = id.to_string();+ }+ }+ });+ ui.separator();+ // (a point less than the room left, so rounding never makes the dialog's own scroll area scroll)+ let room = max_height - (ui.cursor().top() - top) - 1.0;+ if room < PAGE_MIN_HEIGHT {+ body(app, ui, tab.as_str());+ register(ui.ctx(), "settings:page", ui.min_rect());+ return;+ }+ let height = room.min(PAGE_SIZE.y);+ // A page that goes on below shows its scroll handle all the time: without it, a page a line+ // or two too long looks cut off, not scrollable.+ ui.spacing_mut().scroll.dormant_handle_opacity = 0.6;+ let page = egui::ScrollArea::vertical()+ .id_salt(("settings-page", tab.as_str()))+ .max_height(height)+ .min_scrolled_height(height)+ .auto_shrink([false, false])+ .show(ui, |ui| {+ ui.add_space(2.0);+ body(app, ui, tab.as_str());+ // (what the page took: wider than the room for it would mean a control is cut off)+ register(ui.ctx(), "settings:page", ui.min_rect());+ });+ register(ui.ctx(), "settings:pageRoom", page.inner_rect);+}++/// `path` shortened to fit `max` (as `width` measures it) by dropping leading folders, after+/// either kind of separator, so that its end stays (`…/Pictures/Library`,+/// `…\Pictures\Library`): the end says which folder it is. A last folder too long by itself+/// loses its end ([`crate::widgets::elide_head`]).+fn elide_path(path: &str, max: f32, width: impl Fn(&str) -> f32) -> String {+ if width(path) <= max {+ return path.to_string();+ }+ // (a separator at the very end is not where a name starts: `…/` alone would say nothing)+ let end = path.trim_end_matches(['/', '\\']).len();+ let mut rest = path;+ while let Some(i) = rest.find(['/', '\\']).filter(|i| path.len() - rest.len() + i + 1 < end) {+ let separator = if rest.get(i..).is_some_and(|r| r.starts_with('\\')) { '\\' } else { '/' };+ rest = rest.get(i + 1..).unwrap_or("");+ let shorter = format!("…{separator}{rest}");+ if width(&shorter) <= max {+ return shorter;+ }+ }+ let name = rest.trim_end_matches(['/', '\\']);+ // (nothing but separators: never an empty label)+ if name.is_empty() { "…".to_string() } else { crate::widgets::elide_head(name, max, width) }+}++/// A folder or file path on one line in the room left in its row (`text:{id}`): shortened from+/// the front when it is too long ([`elide_path`]), with all of it in a tooltip then. `after` is+/// the width of what follows it on the line (a button, a note) and its spacing: the path leaves+/// that room, so those never wrap onto a second line.+fn path_label(ui: &mut egui::Ui, id: &str, path: &str, font: egui::FontId, color: egui::Color32, after: f32) {+ let shown =+ elide_path(path, (ui.available_width() - after).max(0.0), |s| ui.painter().layout_no_wrap(s.to_string(), font.clone(), color).size().x);+ // (`truncate` is the last resort, for a room narrower than "…")+ let r = ui.add(egui::Label::new(RichText::new(&shown).font(font).color(color)).truncate().show_tooltip_when_elided(false));+ register(ui.ctx(), format!("text:{id}"), r.rect);+ if shown != path {+ r.on_hover_text(path);+ }+}++/// The width of `text` in the style `style`, and the gap before it: what a label takes in a row.+fn label_width(ui: &egui::Ui, text: &str, style: egui::TextStyle) -> f32 {+ ui.painter().layout_no_wrap(text.to_string(), style.resolve(ui.style()), egui::Color32::WHITE).size().x + ui.spacing().item_spacing.x+}++/// The same for a button, which has padding either side of its text.+fn button_width(ui: &egui::Ui, text: &str) -> f32 {+ label_width(ui, text, egui::TextStyle::Button) + 2.0 * ui.spacing().button_padding.x+}+pub(super) fn heading(ui: &mut egui::Ui, t: &Tokens, text: &str) {ui.add_space(4.0);ui.label(RichText::new(crate::i18n::tr(text)).font(t.semibold(12.5)).color(t.text));@@ -71,9 +162,17 @@ pub(super) fn row<R>(ui: &mut egui::Ui, t: &Tokens, label: &str, add: impl FnOncui.horizontal(|ui| {ui.allocate_ui_with_layout(egui::vec2(LABEL_W, 24.0), egui::Layout::left_to_right(egui::Align::Center), |ui| {ui.set_min_width(LABEL_W);- ui.label(RichText::new(crate::i18n::tr(label)).color(t.text_label));+ // (a label longer than its column wraps in it; it does not push the controls along)+ ui.add(egui::Label::new(RichText::new(crate::i18n::tr(label)).color(t.text_label)).wrap());});- add(ui)+ // The controls wrap in the room beside the label, each further line starting under the+ // first control, so a row with many choices grows down and never widens the window.+ let wrapped = egui::Layout::left_to_right(egui::Align::Center).with_main_wrap(true);+ ui.allocate_ui_with_layout(egui::vec2(ui.available_width(), 24.0), wrapped, |ui| {+ ui.spacing_mut().item_spacing.y = 4.0;+ add(ui)+ })+ .inner}).inner}@@ -119,7 +218,7 @@ fn general_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {None => crate::i18n::tr("In memory — nothing is saved").to_string(),};row(ui, t, crate::i18n::tr("Location"), |ui| {- ui.label(RichText::new(location).color(t.text));+ path_label(ui, "settingsLocation", &location, egui::TextStyle::Body.resolve(ui.style()), t.text, 0.0);});row(ui, t, "", |ui| {let can = app.services.pick_folder.is_some();@@ -374,7 +473,17 @@ fn import_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {heading(ui, t, crate::i18n::tr("Auto Import"));hint(ui, t, crate::i18n::tr("Photos that arrive in this folder (tethering, a scanner, a sync app) are added as soon as they're complete."));row(ui, t, crate::i18n::tr("Watched folder"), |ui| {- ui.label(RichText::new(d.auto_folder.clone().unwrap_or_else(|| crate::i18n::tr("Off").into())).color(t.text));+ match &d.auto_folder {+ Some(folder) => path_label(+ ui,+ "settingsAutoFolder",+ folder,+ egui::TextStyle::Body.resolve(ui.style()),+ t.text,+ button_width(ui, crate::i18n::tr("Choose…")) + button_width(ui, crate::i18n::tr("Turn Off")),+ ),+ None => drop(ui.label(RichText::new(crate::i18n::tr("Off")).color(t.text))),+ }let can = app.services.pick_folder.is_some();let r = ui.add_enabled(can, egui::Button::new(crate::i18n::tr("Choose…")));register(ui.ctx(), "button:settingsAutoFolder", r.rect);@@ -510,8 +619,18 @@ fn smart_previews(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {let available = loc["available"].as_bool().unwrap_or(true);let custom = loc["custom"].as_bool().unwrap_or(false);row(ui, t, crate::i18n::tr("Folder"), |ui| {- let text = format!("{path}{}", if custom { "" } else { " (library default)" });- ui.add(egui::Label::new(RichText::new(text.clone()).color(if available { t.text } else { t.reject })).truncate()).on_hover_text(text);+ path_label(+ ui,+ "settingsSmartFolder",+ &path,+ egui::TextStyle::Body.resolve(ui.style()),+ if available { t.text } else { t.reject },+ if custom { 0.0 } else { label_width(ui, "(library default)", egui::TextStyle::Body) },+ );+ if !custom {+ let r = ui.label(RichText::new("(library default)").color(t.text));+ register(ui.ctx(), "text:settingsSmartDefault", r.rect);+ }});let (count, bytes) = (loc["count"].as_u64().unwrap_or(0), loc["bytes"].as_u64().unwrap_or(0));if available {@@ -627,7 +746,7 @@ fn display_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {let info = d.describe();if !screen {row(ui, t, crate::i18n::tr("File"), |ui| {- ui.label(RichText::new(&d.path).size(11.0).color(t.text_dim));+ path_label(ui, "settingsDisplayFile", &d.path, egui::FontId::proportional(11.0), t.text_dim, 0.0);});}row(ui, t, crate::i18n::tr("Type"), |ui| {@@ -748,44 +867,29 @@ fn duration_slider(app: &mut LightcraftApp, ui: &mut egui::Ui, id: &str, key: &s}}-/// Width of the Slideshow tab's settings column (the slide preview is beside it).-const SLIDESHOW_COLUMN_W: f32 = 480.0;-+/// The Slideshow tab: the slide preview, then the settings, in one column the width of the page+/// (the page scrolls; a column beside the preview would be wider than the window).fn slideshow_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {- // the settings scroll on the left, the composed slide stays in view on the right- let top_down = egui::Layout::top_down(egui::Align::Min);- // as tall as the window allows (the dialog's title, tabs and Close button take ~260 pt)- let tall = (ui.ctx().content_rect().height() - 260.0).clamp(300.0, 760.0);- ui.horizontal_top(|ui| {- ui.allocate_ui_with_layout(egui::vec2(SLIDESHOW_COLUMN_W, tall), top_down, |ui| {- ui.set_width(SLIDESHOW_COLUMN_W);- egui::ScrollArea::vertical().id_salt("settingsSlideshowScroll").max_height(tall).auto_shrink([false, true]).show(ui, |ui| {- super::slide_templates::section(app, ui, t);- ui.add_space(6.0);- playback_section(app, ui, t);- ui.add_space(6.0);- super::slide_layout::sections(app, ui, t);- ui.add_space(6.0);- super::slide_overlays::sections(app, ui, t);- ui.add_space(6.0);- super::slide_titles::sections(app, ui, t);- ui.add_space(6.0);- export_section(app, ui, t);- });- });- ui.add_space(12.0);- ui.allocate_ui_with_layout(egui::vec2(super::slide_layout::PREVIEW_W, tall), top_down, |ui| {- ui.set_width(super::slide_layout::PREVIEW_W);- super::slide_layout::preview(app, ui, t)- });- });+ super::slide_layout::preview(app, ui, t);+ ui.add_space(6.0);+ super::slide_templates::section(app, ui, t);+ ui.add_space(6.0);+ playback_section(app, ui, t);+ ui.add_space(6.0);+ super::slide_layout::sections(app, ui, t);+ ui.add_space(6.0);+ super::slide_overlays::sections(app, ui, t);+ ui.add_space(6.0);+ super::slide_titles::sections(app, ui, t);+ ui.add_space(6.0);+ export_section(app, ui, t);}/// Export: PDF, JPEG sequence or video of the slideshow (View ▸ Export Slideshow…).fn export_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {heading(ui, t, crate::i18n::tr("Export"));let running = app.session.slideshow_export.as_ref().is_some_and(|r| r.running());- ui.horizontal(|ui| {+ ui.horizontal_wrapped(|ui| {for (id, label, format) in [("slideshowExportPdf", "Export PDF…", "pdf"),("slideshowExportJpeg", "Export JPEG…", "jpeg"),@@ -1416,3 +1520,48 @@ mod tests {let _ = std::fs::remove_dir_all(&dir);}}++#[cfg(test)]+mod path_tests {+ use super::elide_path;++ /// Width = characters, so a limit of 20 is "20 characters".+ fn fit(path: &str, max: usize) -> String {+ elide_path(path, max as f32, |s| s.chars().count() as f32)+ }++ #[test]+ fn a_path_that_fits_is_left_alone() {+ assert_eq!(fit("/Users/me/Pictures", 18), "/Users/me/Pictures");+ assert_eq!(fit("", 5), "");+ }++ #[test]+ fn leading_folders_go_first_and_the_end_stays() {+ assert_eq!(fit("/Users/me/Pictures/Library", 20), "…/Pictures/Library");+ assert_eq!(fit("/Users/me/Pictures/Library", 10), "…/Library");+ }++ /// Windows paths: `Path::display` gives backslashes there.+ #[test]+ fn a_path_with_backslashes_keeps_its_end_too() {+ assert_eq!(fit(r"C:\Users\me\Pictures\Library", 20), r"…\Pictures\Library");+ assert_eq!(fit(r"C:\Users\me/Pictures\Library", 10), r"…\Library");+ }++ #[test]+ fn a_last_folder_too_long_by_itself_loses_its_end() {+ assert_eq!(fit("/Users/me/a-very-long-folder-name", 8), "a-very-…");+ assert_eq!(fit("no-separator-at-all", 8), "no-sepa…");+ assert_eq!(fit("/Users/Фотографии-из-отпуска", 8), "Фотогра…");+ }++ #[test]+ fn a_separator_at_the_end_is_not_where_the_name_starts() {+ assert_eq!(fit("/Users/me/Pictures/Library/", 11), "…/Library/");+ assert_eq!(fit("/Users/me/a-very-long-folder-name/", 8), "a-very-…");+ assert_eq!(fit(r"C:\Users\me\Library\", 11), r"…\Library\");+ assert_eq!(fit("///", 2), "…");+ assert_eq!(fit(r"\\server\share\folder", 15), r"…\share\folder");+ }+}diff --git a/crates/ui-egui/src/panels/slide_layout.rs b/crates/ui-egui/src/panels/slide_layout.rsindex 62f7626c3..08b361441 100644--- a/crates/ui-egui/src/panels/slide_layout.rs+++ b/crates/ui-egui/src/panels/slide_layout.rs@@ -22,7 +22,7 @@ use crate::widgets::register;/// Seconds the layout must stay unchanged before the preview is rendered again.pub const DEBOUNCE: f64 = 0.15;-/// The preview's width in points.+/// The preview's greatest width in points (less where the room is narrower).pub const PREVIEW_W: f32 = 300.0;#[derive(Clone, Copy)]@@ -170,19 +170,40 @@ pub fn preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {let look = template.as_ref().map_or_else(|| SlideLook::of(&app.session), |t| t.look.clone());let s = look.layout.clone();let overlays = look.overlays.clone();+ // The room for the preview is the settings' own shape, whichever template is pointed at: the+ // page below it must not move as the pointer goes over the templates (it would leave the+ // row it is over). A template of another shape is drawn as large as fits in that room.let ratio = s.aspect.ratio(screen_aspect(ui.ctx())) as f32;- let h = (PREVIEW_W / ratio).clamp(80.0, 320.0);- let (rect, _) = ui.allocate_exact_size(vec2(PREVIEW_W, h), Sense::hover());+ let own = SlideLook::of(&app.session).layout.aspect.ratio(screen_aspect(ui.ctx())) as f32;+ let w = ui.available_width().clamp(1.0, PREVIEW_W);+ let room_h = (w / own).clamp(80.0, 320.0);+ let (room, _) = ui.allocate_exact_size(vec2(w, room_h), Sense::hover());+ let (fit_w, fit_h) = if ratio >= w / room_h { (w, w / ratio) } else { (room_h * ratio, room_h) };+ let rect = Rect::from_center_size(room.center(), vec2(fit_w, fit_h));+ let h = rect.height();+ let w = rect.width();register(ui.ctx(), "slideshow:preview", rect);- let p = ui.painter_at(rect.expand(1.0));+ let p = ui.painter_at(room.expand(1.0));p.rect_stroke(rect, 0.0, Stroke::new(1.0, t.text_dim.gamma_multiply(0.5)), egui::StrokeKind::Outside);super::slide_titles::preview_choice(ui);if let Some(tpl) = &template {+ // (said over the bottom of the preview and not below it, which would move the page)let name = if tpl.builtin { crate::i18n::tr(&tpl.name).to_string() } else { tpl.name.clone() };- ui.label(egui::RichText::new(crate::i18n::tr_format!("Template preview: {name}", name = name)).size(11.0).color(t.accent));+ let mut said = crate::i18n::tr_format!("Template preview: {name}", name = name).to_string();if !tpl.description.is_empty() {- hint(ui, t, &tpl.description);+ said = format!("{said}\n{}", tpl.description);}+ let galley = ui.painter().layout(said, t.font(11.0), Color32::WHITE, (room.width() - 8.0).max(1.0));+ let band = Rect::from_min_size(+ pos2(room.left(), (room.bottom() - galley.size().y - 6.0).max(room.top())),+ vec2(room.width(), galley.size().y + 6.0),+ );+ let paint = ui+ .ctx()+ .layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::new("settingsSlideshowTemplateSaid")))+ .with_clip_rect(room.intersect(ui.clip_rect()));+ paint.rect_filled(band, 0.0, Color32::from_black_alpha(190));+ paint.galley(pos2(band.left() + 4.0, band.top() + 3.0), galley, Color32::WHITE);}if let Some(title) = super::slide_titles::preview_shows(ui.ctx()) {title_preview(app, ui, t, rect, title, &look);@@ -194,7 +215,7 @@ pub fn preview(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {return;};let ppp = ui.ctx().pixels_per_point();- let (pw, ph) = (((PREVIEW_W * ppp).round() as usize).max(16), ((h * ppp).round() as usize).max(16));+ let (pw, ph) = (((w * ppp).round() as usize).max(16), ((h * ppp).round() as usize).max(16));// the overlays and what they show of the photo (its rating, its metadata) change it toolet shown = app.session.catalog.photo(id).filter(|_| overlays.any()).map_or(0, |p| {use std::hash::{Hash, Hasher};diff --git a/crates/ui-egui/src/tests_dialog_settings.rs b/crates/ui-egui/src/tests_dialog_settings.rsnew file mode 100644index 000000000..98df06a0d--- /dev/null+++ b/crates/ui-egui/src/tests_dialog_settings.rs@@ -0,0 +1,359 @@+//! The Settings window is one size in one place whatever tab is open, and lies inside the app+//! window: a row with more choices than fit wraps, a label longer than its column wraps, a long+//! folder path is cut short (its tooltip has all of it), and the tabs stay put while a page scrolls.+//!+//! Before, a wide row widened the whole window: General was 970 points wide and the other tabs+//! about 600, the window moved up and down between tabs, and in a 900 point wide app window the+//! row labels and the Close button of General were cut off at the left.++use std::time::Duration;++use serde_json::json;++use crate::headless::Headless;+use crate::panels::settings::TABS;+use crate::{LightcraftApp, Services};++const T: Duration = Duration::from_secs(20);++/// The app window sizes tried: roomy, the desktop minimum, and smaller than that.+const SIZES: [[f32; 2]; 3] = [[1600.0, 1000.0], [900.0, 560.0], [640.0, 480.0]];++fn headless(session: lightcraft_engine::Session, size: [f32; 2]) -> Headless {+ let mut h = Headless::new(LightcraftApp::new(session, Services::default()), size, 1.0);+ // let the first renders finish (a render still running at exit can crash in GPU teardown)+ h.settle(T);+ h+}++fn demo(size: [f32; 2]) -> Headless {+ headless(lightcraft_engine::Session::with_demo(), size)+}++/// Given Settings open on `tab`, drawn until its layout has settled.+fn show(h: &mut Headless, tab: &str) {+ let r = h.request("engine.execute", json!({"command": "app.settings", "params": {"tab": tab}}), T);+ assert_eq!(r["ok"], true, "app.settings {tab}: {r}");+ h.settle(T);+ for _ in 0..4 {+ h.step();+ }+}++/// A folder under the system's temporary one, removed again when the test ends, passed or not.+struct TempFolder(std::path::PathBuf);++impl TempFolder {+ fn new(tag: &str) -> Self {+ let dir = std::env::temp_dir().join(format!("lc-ui-{tag}-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&dir);+ Self(dir)+ }+}++impl Drop for TempFolder {+ fn drop(&mut self) {+ let _ = std::fs::remove_dir_all(&self.0);+ }+}++fn rect(h: &Headless, id: &str) -> egui::Rect {+ h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("no widget {id}"))+}++/// The controls the Settings window registers on the tab that is open (and its tab buttons).+fn controls(h: &Headless) -> Vec<(String, egui::Rect)> {+ let named = |id: &str| id.split_once(':').is_some_and(|(_, name)| name.starts_with("settings") || name.starts_with("theme"));+ h.app.widgets.iter().filter(|(id, _)| named(id)).cloned().collect()+}++fn same(a: egui::Rect, b: egui::Rect) -> bool {+ (a.min - b.min).abs().max_elem() < 0.5 && (a.max - b.max).abs().max_elem() < 0.5+}++#[test]+fn the_window_keeps_its_size_and_place_from_tab_to_tab() {+ for size in SIZES {+ let mut h = demo(size);+ // Given the first tab, when every other tab is opened in turn+ show(&mut h, "general");+ let first = rect(&h, "dialog:window");+ for (tab, _) in TABS {+ show(&mut h, tab);+ // Then the window has not moved or changed size+ let now = rect(&h, "dialog:window");+ assert!(same(first, now), "{size:?}: Settings is {now:?} on {tab}, and was {first:?} on general");+ }+ // And going back to the first tab finds it as it was+ show(&mut h, "general");+ assert!(same(first, rect(&h, "dialog:window")), "{size:?}: general again");+ }+}++#[test]+fn every_tab_keeps_its_controls_inside_the_window() {+ for size in SIZES {+ let mut h = demo(size);+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, h.size);+ for (tab, _) in TABS {+ // When a tab is opened+ show(&mut h, tab);+ // Then the Settings window lies inside the app window+ let window = rect(&h, "dialog:window");+ assert!(screen.contains_rect(window), "{size:?} {tab}: Settings {window:?} runs off the {screen:?} window");+ // And no control reaches past its left or right edge+ // (the page is everything the tab drew, whether or not it has a name of its own; a+ // control past the room for it would be clipped there, inside the window's margin)+ let (page, room) = (rect(&h, "settings:page"), rect(&h, "settings:pageRoom"));+ assert!(+ page.left() >= room.left() - 0.5 && page.right() <= room.right() + 0.5,+ "{size:?} {tab}: the page {page:?} is wider than the room for it {room:?}"+ );+ assert!(window.contains_rect(room), "{size:?} {tab}: the page's room {room:?} is inside Settings {window:?}");+ for (id, r) in controls(&h) {+ let within = if id.contains("settingsTab-") { window } else { room };+ assert!(r.left() >= within.left() - 0.5 && r.right() <= within.right() + 0.5, "{size:?} {tab}: {id} {r:?} is outside {within:?}");+ }+ }+ }+}++#[test]+fn a_row_of_many_choices_wraps_under_itself() {+ // Given an app window too narrow for the languages in one line+ let mut h = demo([900.0, 560.0]);+ show(&mut h, "general");+ let languages: Vec<egui::Rect> = (0..crate::i18n::Locale::ALL.len()).map(|i| rect(&h, &format!("button:settingsLanguage-{i}"))).collect();+ // Then they take more than one line+ let first = languages[0];+ assert!(languages.iter().any(|r| r.top() > first.bottom()), "the languages wrap: {languages:?}");+ // And each further line starts under the first choice, not under the row's label+ for r in languages.iter().filter(|r| r.top() > first.bottom()) {+ assert!(r.left() >= first.left() - 0.5, "{r:?} starts left of the first language {first:?}");+ }+ assert!(+ languages.iter().filter(|r| r.top() > first.bottom()).any(|r| (r.left() - first.left()).abs() < 0.5),+ "a wrapped line starts at the first choice"+ );+}++#[test]+fn a_label_longer_than_its_column_leaves_the_controls_in_line() {+ // Given Performance, whose "Forget unchanged photos" label is wider than the label column+ let mut h = demo([1600.0, 1000.0]);+ show(&mut h, "performance");+ // Then its choices start where the choices of a short label do+ let (short, long) = (rect(&h, "button:settingsPreview-0"), rect(&h, "button:settingsForgetLocal-0"));+ assert!((short.left() - long.left()).abs() < 0.5, "Preview size starts at {} and Forget unchanged photos at {}", short.left(), long.left());+}++#[test]+fn a_long_library_folder_is_cut_short_and_its_tooltip_has_all_of_it() {+ // Given a library in a folder with a very long path+ let base = TempFolder::new("settings-window");+ let dir =+ base.0.join("photographs-from-2019-to-2026-kept-on-the-second-external-drive-that-nobody-wants-to-type-twice").join("the-master-library");+ std::fs::create_dir_all(&dir).unwrap();+ let mut session = lightcraft_engine::Session::new().with_fs();+ session.open_library(&dir, true).unwrap();+ let path = dir.display().to_string();++ let mut h = headless(session, [1600.0, 1000.0]);+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, h.size);+ // When Settings opens on General, which shows where the library is+ show(&mut h, "general");+ let general = rect(&h, "dialog:window");+ show(&mut h, "display");+ // Then the window is as wide as on a tab without a path+ assert!(same(general, rect(&h, "dialog:window")), "General is {general:?} with a long path, Display is {:?}", rect(&h, "dialog:window"));+ show(&mut h, "general");+ assert!(screen.contains_rect(general), "Settings {general:?} runs off the {screen:?} window");+ // And the path is cut short, inside the window+ let location = rect(&h, "text:settingsLocation");+ let room = rect(&h, "settings:pageRoom");+ assert!(location.right() <= room.right() + 0.5, "the path {location:?} stays inside the room for the page {room:?}");+ let texts = h.painted_text();+ assert!(!texts.iter().any(|text| text.contains(&path)), "the whole path is not drawn in the row");+ // And what is left of it is its end, which says which library this is+ let name = "the-master-library";+ assert!(path.ends_with(name));+ assert!(+ texts.iter().any(|text| text.starts_with('…') && text.ends_with(name)),+ "the row keeps the end of the path: {:?}",+ texts.iter().filter(|t| t.contains("library")).collect::<Vec<_>>()+ );+ // And resting the pointer on it shows the whole path+ assert_eq!(h.request("ui.hoverWidget", json!({"id": "text:settingsLocation"}), T)["ok"], true);+ assert!(h.step_until(T, |h| h.painted_text().iter().any(|text| text.contains(&path))), "the tooltip has the whole path");++ // And the same holds for the folder Auto Import watches, which stays on one line+ let watched = h.app.run("library.autoImport", json!({"folder": path}));+ assert!(watched.is_ok(), "{watched:?}");+ show(&mut h, "import");+ // (the row is at the foot of the page: scrolled to, so that it is drawn however long the page is)+ let window = rect(&h, "dialog:window");+ h.request("ui.move", json!({"x": window.center().x, "y": window.center().y}), T);+ for _ in 0..6 {+ h.request("ui.scroll", json!({"dy": -400.0}), T);+ h.step();+ }+ h.settle(T);+ let (folder, room) = (rect(&h, "text:settingsAutoFolder"), rect(&h, "settings:pageRoom"));+ assert!(room.intersects(folder), "the watched folder {folder:?} is in view in {room:?}");+ assert!(folder.height() < 24.0 && folder.right() <= room.right(), "the watched folder {folder:?} is one line inside {room:?}");+ assert!(h.painted_text().iter().any(|text| text.starts_with('…') && text.ends_with(name)), "and keeps its end");+ // And Choose… stays on that line, inside the room, whatever length the path is cut to: the+ // path takes what the button leaves (the folders' names vary, so the cut falls everywhere)+ for n in 0..14 {+ let path = format!("{path}/{}/{name}", "d".repeat(2 + 3 * n));+ std::fs::create_dir_all(&path).unwrap();+ assert!(h.app.run("library.autoImport", json!({"folder": path})).is_ok());+ h.settle(T);+ for _ in 0..4 {+ h.step();+ }+ let (folder, button) = (rect(&h, "text:settingsAutoFolder"), rect(&h, "button:settingsAutoFolder"));+ assert!(button.right() <= room.right() + 0.5, "Choose… {button:?} is inside {room:?} (path of {n})");+ assert!((button.center().y - folder.center().y).abs() < 6.0, "Choose… {button:?} is on the line of the path {folder:?} (path of {n})");+ assert!(folder.right() <= button.left(), "the path {folder:?} ends before Choose… {button:?} (path of {n})");+ }+ // And so does "(library default)" after the smart previews folder (on Performance, at the foot of+ // the page), which is cut the same way+ show(&mut h, "performance");+ let window = rect(&h, "dialog:window");+ h.request("ui.move", json!({"x": window.center().x, "y": window.center().y}), T);+ for _ in 0..6 {+ h.request("ui.scroll", json!({"dy": -400.0}), T);+ h.step();+ }+ h.settle(T);+ let room = rect(&h, "settings:pageRoom");+ let (smart, note) = (rect(&h, "text:settingsSmartFolder"), rect(&h, "text:settingsSmartDefault"));+ assert!(room.intersects(smart) && room.intersects(note), "the smart previews folder {smart:?} {note:?} is in view in {room:?}");+ assert!(note.right() <= room.right() + 0.5, "(library default) {note:?} is inside {room:?}");+ assert!((note.center().y - smart.center().y).abs() < 6.0, "(library default) {note:?} is on the line of the path {smart:?}");+ assert!(smart.right() <= note.left(), "the path {smart:?} ends before (library default) {note:?}");+ drop(h);+}++#[test]+fn a_short_path_is_shown_whole_and_has_no_tooltip() {+ // Given the in-memory library, whose Location is a short sentence+ let mut h = demo([1600.0, 1000.0]);+ show(&mut h, "general");+ assert!(h.painted_text().iter().any(|text| text == "In memory — nothing is saved"), "it is all there");+ let before = h.painted_text().len();+ // When the pointer rests on it+ assert_eq!(h.request("ui.hoverWidget", json!({"id": "text:settingsLocation"}), T)["ok"], true);+ let _ = h.step_until(Duration::from_secs(2), |h| h.painted_text().len() > before);+ // Then nothing more is drawn: there is nothing a tooltip could add+ assert_eq!(h.painted_text().len(), before, "no tooltip for a path that is all there");+}++/// How many pixels of `rect` are not `colour` (one pixel per point here).+fn other_than(image: &egui::ColorImage, rect: egui::Rect, colour: egui::Color32) -> usize {+ let [w, h] = image.size;+ let (x0, x1) = (rect.left().round().max(0.0) as usize, (rect.right().round().max(0.0) as usize).min(w));+ let (y0, y1) = (rect.top().round().max(0.0) as usize, (rect.bottom().round().max(0.0) as usize).min(h));+ (y0..y1).flat_map(|y| (x0..x1).map(move |x| (x, y))).filter(|(x, y)| image.pixels[y * w + x] != colour).count()+}++#[test]+fn a_page_that_goes_on_below_shows_a_scroll_handle_without_the_pointer_on_it() {+ let mut h = demo([900.0, 560.0]);+ let chrome = crate::theme::Tokens::get(&h.view.ctx).chrome;+ // (the pointer is nowhere near the window)+ h.request("ui.move", json!({"x": 5.0, "y": 5.0}), T);+ let handle = |h: &Headless| {+ let room = rect(h, "settings:pageRoom");+ other_than(&h.paint(), egui::Rect::from_min_max(egui::pos2(room.right() - 6.0, room.top()), room.max), chrome)+ };+ // Given Import, which is taller than the room a 560 pt tall app window has for it+ show(&mut h, "import");+ assert!(rect(&h, "settings:page").height() > rect(&h, "settings:pageRoom").height());+ // Then a handle is drawn at the page's right edge+ assert!(handle(&h) > 40, "Import shows a scroll handle ({} px)", handle(&h));+ // And Display, which fits, has none+ show(&mut h, "display");+ assert!(rect(&h, "settings:page").height() <= rect(&h, "settings:pageRoom").height());+ assert_eq!(handle(&h), 0, "Display has nothing to scroll");+}++#[test]+fn a_window_too_short_for_a_page_of_its_own_scrolls_tabs_and_page_together() {+ // Given an app window far below the desktop minimum+ let mut h = demo([900.0, 220.0]);+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, h.size);+ show(&mut h, "import");+ let window = rect(&h, "dialog:window");+ assert!(screen.contains_rect(window), "Settings {window:?} is inside the {screen:?} window");+ let (tab, page) = (rect(&h, "button:settingsTab-import"), rect(&h, "check:settings.perCamera"));+ // When it is scrolled+ h.request("ui.move", json!({"x": window.center().x, "y": window.center().y}), T);+ for _ in 0..3 {+ h.request("ui.scroll", json!({"dy": -120.0}), T);+ h.step();+ }+ h.settle(T);+ // Then the tabs and the page move as one, so every setting can still be reached+ let (tab_now, page_now) = (rect(&h, "button:settingsTab-import"), rect(&h, "check:settings.perCamera"));+ assert!(page_now.top() < page.top() - 50.0, "the page scrolled: {page:?} -> {page_now:?}");+ assert!(((tab.top() - tab_now.top()) - (page.top() - page_now.top())).abs() < 0.5, "tabs and page moved together");+ assert!(same(window, rect(&h, "dialog:window")), "the window did not move");+}++#[test]+fn the_tabs_stay_put_while_a_page_scrolls() {+ // Given a page taller than the window has room for+ let mut h = demo([900.0, 560.0]);+ show(&mut h, "import");+ let window = rect(&h, "dialog:window");+ let tabs: Vec<egui::Rect> = TABS.iter().map(|(id, _)| rect(&h, &format!("button:settingsTab-{id}"))).collect();+ let page_before = rect(&h, "check:settings.perCamera");+ // When the page is scrolled+ h.request("ui.move", json!({"x": window.center().x, "y": window.center().y}), T);+ for _ in 0..3 {+ h.request("ui.scroll", json!({"dy": -120.0}), T);+ h.step();+ }+ h.settle(T);+ // Then the page moved+ let page_after = rect(&h, "check:settings.perCamera");+ assert!(page_after.top() < page_before.top() - 50.0, "the page scrolled: {page_before:?} -> {page_after:?}");+ // And the tabs and the window did not+ for ((id, _), before) in TABS.iter().zip(tabs) {+ assert!(same(before, rect(&h, &format!("button:settingsTab-{id}"))), "tab {id} moved");+ }+ assert!(same(window, rect(&h, "dialog:window")), "the window moved");+}++#[test]+fn each_tab_remembers_how_far_it_was_scrolled() {+ let mut h = demo([900.0, 560.0]);+ show(&mut h, "interface");+ let fresh = rect(&h, "button:settingsAppearance-0");+ // Given Import scrolled down+ show(&mut h, "import");+ let window = rect(&h, "dialog:window");+ let top = rect(&h, "check:settings.perCamera").top();+ h.request("ui.move", json!({"x": window.center().x, "y": window.center().y}), T);+ for _ in 0..3 {+ h.request("ui.scroll", json!({"dy": -120.0}), T);+ h.step();+ }+ h.settle(T);+ let scrolled = rect(&h, "check:settings.perCamera").top();+ assert!(scrolled < top - 50.0);+ // When another tab is opened, it starts at its top+ show(&mut h, "interface");+ let mode = rect(&h, "button:settingsAppearance-0");+ assert!(same(fresh, mode), "Interface is at its top, as when first opened: {fresh:?} -> {mode:?}");+ // And Import is where it was left+ show(&mut h, "import");+ assert!((rect(&h, "check:settings.perCamera").top() - scrolled).abs() < 0.5, "Import is where it was left");+ // And it is still there when Settings is closed and opened again (documented in What's New)+ assert_eq!(h.request("ui.dialog.cancel", json!({}), T)["ok"], true);+ h.settle(T);+ show(&mut h, "import");+ assert!((rect(&h, "check:settings.perCamera").top() - scrolled).abs() < 0.5, "Import is where it was left after a reopen");+}diff --git a/crates/ui-egui/src/tests_slideshow.rs b/crates/ui-egui/src/tests_slideshow.rsindex 24aa0d728..911902ab2 100644--- a/crates/ui-egui/src/tests_slideshow.rs+++ b/crates/ui-egui/src/tests_slideshow.rs@@ -258,20 +258,28 @@ fn a_photo_deleted_while_it_plays_does_not_stall_the_slideshow() {h.settle(SETTLE);}-/// Scroll the Settings ▸ Slideshow column until widget `id` is in view (near its top): the-/// sections are taller than the dialog.+/// Scroll the Settings ▸ Slideshow page until widget `id` is in view (in the middle of the room+/// for the page): the sections are taller than the dialog.fn reveal(h: &mut Headless, id: &str) {let find = |h: &Headless, w: &str| h.app.widgets.iter().find(|(i, _)| i == w).map(|(_, r)| *r);for _ in 0..40 {h.step();- let col = find(h, "slideshow:preview").expect("the Slideshow settings are open");+ let room = find(h, "settings:pageRoom").expect("the Slideshow settings are open");let dy = match find(h, id) {- Some(w) if w.center().y >= col.top() + 10.0 && w.center().y <= col.top() + 340.0 => return,- Some(w) => (col.top() + 80.0 - w.center().y).clamp(-500.0, 500.0),+ Some(w) if w.center().y >= room.top() + 10.0 && w.center().y <= room.bottom() - 10.0 => {+ // (in view and still: the page eases to where it was scrolled to)+ for _ in 0..3 {+ h.step();+ }+ if find(h, id).is_some_and(|now| (now.center().y - w.center().y).abs() < 0.5) {+ return;+ }+ continue;+ }+ Some(w) => (room.center().y - w.center().y).clamp(-500.0, 500.0),None => -300.0,};- // (the pointer over the settings column, left of the preview)- let r = h.request("ui.hoverWidget", json!({"id": "slideshow:preview", "fx": -1.0, "fy": 0.5}), T);+ let r = h.request("ui.hoverWidget", json!({"id": "settings:pageRoom"}), T);assert_eq!(r["ok"], true, "{r}");let r = h.request("ui.scroll", json!({"dy": dy}), T);assert_eq!(r["ok"], true, "{r}");@@ -373,6 +381,8 @@ fn settings_shows_the_slide_layout_and_a_live_preview() {run(&mut h, "slideshow.layout", json!({"margins": 0.2, "backdropColor": "#00ff00"}));assert!(h.step_until(SETTLE, |h| h.app.renderer.textures.get(&Slot::SlidePreview).map(|t| t.key) != before));h.step();+ // (the preview scrolls with the page: back to it)+ reveal(&mut h, "slideshow:preview");let rect = h.app.widgets.iter().find(|(id, _)| id == "slideshow:preview").map(|(_, r)| *r).unwrap();let img = h.paint();let c = painted(&img, (rect.left() + 3.0) as usize, (rect.center().y) as usize);@@ -592,6 +602,7 @@ fn settings_shows_the_titles_and_the_preview_shows_a_title_screen() {assert_eq!(crate::panels::slide_titles::preview_shows(&h.view.ctx), Some(lightcraft_engine::slideshow::Title::Intro));run(&mut h, "slideshow.titles", json!({"intro": {"color": "#ff8000", "content": "none"}}));assert!(h.step_until(SETTLE, |h| h.app.renderer.textures.get(&Slot::SlidePreview).is_some_and(|t| t.photo == PhotoId(0))));+ reveal(&mut h, "slideshow:preview");assert!(h.step_until(SETTLE, |h| {let rect = h.app.widgets.iter().find(|(id, _)| id == "slideshow:preview").map(|(_, r)| *r).unwrap();let img = h.paint();@@ -606,6 +617,7 @@ fn settings_shows_the_titles_and_the_preview_shows_a_title_screen() {h.step();assert!(has(&h, "field:slideshowIntroText"));// back to the photo's slide+ reveal(&mut h, "button:settingsSlideshowPreviewShows-0");let r = h.request("ui.clickWidget", json!({"id": "button:settingsSlideshowPreviewShows-0"}), T);assert_eq!(r["ok"], true, "{r}");assert!(h.step_until(SETTLE, |h| h.app.renderer.textures.get(&Slot::SlidePreview).is_some_and(|t| t.photo == first)));@@ -643,6 +655,8 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() {let before = SlideLook::of(&h.app.session);let r = h.request("ui.hoverWidget", json!({"id": "template:builtin:gallery-wall"}), T);assert_eq!(r["ok"], true, "{r}");+ // (the pointer is over the row one frame after it moved there, and the page has settled the next)+ h.step();h.step();assert_eq!(crate::panels::slide_templates::hovered(&h.view.ctx).as_deref(), Some("builtin:gallery-wall"));let grey = |h: &Headless| {@@ -655,16 +669,19 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() {assert_eq!(SlideLook::of(&h.app.session), before, "hovering changes nothing");assert!(h.app.session.slide_templates_previous.is_none());// a click applies it+ reveal(&mut h, "template:builtin:gallery-wall");let r = h.request("ui.clickWidget", json!({"id": "template:builtin:gallery-wall"}), T);assert_eq!(r["ok"], true, "{r}");h.step();assert!(h.app.session.slide_overlays.rating_stars.enabled && h.app.session.slide_layout.stroke_border);assert!(has(&h, "template:previous"), "Previous settings appear");// save as a template of our own+ reveal(&mut h, "field:slideshowTemplateName");let r = h.request("ui.clickWidget", json!({"id": "field:slideshowTemplateName"}), T);assert_eq!(r["ok"], true, "{r}");let r = h.request("ui.text", json!({"text": "Holiday / 2026"}), T);assert_eq!(r["ok"], true, "{r}");+ reveal(&mut h, "button:slideshowTemplateSave");let r = h.request("ui.clickWidget", json!({"id": "button:slideshowTemplateSave"}), T);assert_eq!(r["ok"], true, "{r}");h.step();@@ -673,6 +690,7 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() {assert!(has(&h, "template:user:Holiday _ 2026"));// update it from its menu with changed settingsrun(&mut h, "slideshow.layout", json!({"backdropColor": "#123456"}));+ reveal(&mut h, "template:user:Holiday _ 2026");let r = h.request("ui.clickWidget", json!({"id": "template:user:Holiday _ 2026", "button": "right"}), T);assert_eq!(r["ok"], true, "{r}");h.step();@@ -685,6 +703,7 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() {h.step();assert_eq!(h.app.session.slide_template("user:Holiday _ 2026").unwrap().look.layout.backdrop_color, [0x12, 0x34, 0x56]);// rename it in place+ reveal(&mut h, "template:user:Holiday _ 2026");let r = h.request("ui.clickWidget", json!({"id": "template:user:Holiday _ 2026", "button": "right"}), T);assert_eq!(r["ok"], true, "{r}");h.step();@@ -703,6 +722,7 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() {h.step();assert!(has(&h, "template:user:Summer"), "{:?}", h.app.session.slide_templates().templates.iter().map(|t| t.id.clone()).collect::<Vec<_>>());// delete it (after confirming)+ reveal(&mut h, "template:user:Summer");let r = h.request("ui.clickWidget", json!({"id": "template:user:Summer", "button": "right"}), T);assert_eq!(r["ok"], true, "{r}");h.step();@@ -716,6 +736,7 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() {h.step();assert!(!dir.join("Summer.json").exists());// back to the settings before Gallery Wall+ reveal(&mut h, "template:previous");let r = h.request("ui.clickWidget", json!({"id": "template:previous"}), T);assert_eq!(r["ok"], true, "{r}");h.step();diff --git a/docs/whats-new.md b/docs/whats-new.mdindex cffff83e2..2f143d6a6 100644--- a/docs/whats-new.md+++ b/docs/whats-new.md@@ -2,6 +2,20 @@## 2026-10-21+### Settings window+- Settings is one size on every tab and stays where it is as you go through them; before, each tab made its own+ size and the tabs moved under the pointer. The tabs stay in place while a long page scrolls, a page that goes on+ below shows a scroll handle without the pointer on it, and each page remembers where it was scrolled to, also when Settings is closed and opened again.+- Nothing in Settings runs off the side any more. A row with more choices than fit (the languages on General) wraps+ onto further lines and a long label wraps in its column, where both used to widen the window: in a small+ LightCraft window the labels and the Close button of General ended up off screen.+- The Slideshow tab is one column like the other tabs, with the slide preview first, instead of a column beside the+ preview that made Settings much wider on that tab. Pointing at a template no longer pushes its rows out from+ under the pointer, and the Export buttons wrap.+- A long folder (General ▸ Library ▸ Location, the folder Auto Import watches, the smart previews folder, a monitor+ profile's file) is shortened to its last folders ("…/Pictures/Library") on one line; rest the pointer on it for+ the whole path.+### Sharper resampling in HDR and panorama merges- Merged photos (HDR and panorama) are resampled with a sharper filter (Lanczos-3 instead of bilinear). Moving aphoto by half a pixel used to lose a third of its finest detail; now it keeps most of it, without halos around