LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LR-IMP-ADD-DIALOG: resolve upstream tracking conflicts and document tests
tylerphotosb76eaf1dfeba
diff --cc crates/ui-egui/src/import.rsindex 65f0f1467,e851463d1..7c202c1a7--- a/crates/ui-egui/src/import.rs+++ b/crates/ui-egui/src/import.rs@@@ -1345,10 -1312,9 +1345,11 @@@ pub fn body(app: &mut LightcraftApp, ui});}++/// Draw one review tile with a density-aware preview, selection control and importability badge.fn candidate_cell(app: &mut LightcraftApp, ui: &mut egui::Ui, d: &mut ImportDialog, i: usize, rect: Rect) {let t = Tokens::get(ui.ctx());- let c = d.candidates[i].clone();+ let Some(c) = d.candidates.get(i).cloned() else { return };+ let Ok(slot_index) = u32::try_from(i) else { return };let ok = d.importable(i);let img = Rect::from_min_size(rect.min, vec2(rect.width(), rect.width()));let resp = ui.interact(img, egui::Id::new(("import-cell", i)), Sense::click());@@@ -1623,17 -1581,6 +1624,18 @@@ fn field<R>(ui: &mut egui::Ui, label: &mod tests {use super::*;++ /// Bucket selection covers tile size, display density and hostile numeric preferences.+ #[test]+ fn import_thumb_edges_follow_size_and_display_density() {+ assert_eq!(thumb_edge(116.0, 1.0), 192);+ assert_eq!(thumb_edge(320.0, 1.0), 384);+ assert_eq!(thumb_edge(320.0, 2.0), 768);+ assert_eq!(thumb_edge(320.0, 3.0), 1024);+ assert_eq!(thumb_edge(320.0, f32::MAX), 1024);+ assert_eq!(thumb_edge(f32::NAN, f32::NAN), 192);+ assert_eq!(thumb_edge(116.0, -1.0), 192);+ }+#[test]fn grid_height_follows_the_window() {// the grid takes what the options and buttons leave, in whole pointsdiff --cc crates/ui-egui/src/tests_folder_drop.rsindex 4d37f5709,9b4cb860a..c498e5922--- a/crates/ui-egui/src/tests_folder_drop.rs+++ b/crates/ui-egui/src/tests_folder_drop.rs@@@ -50,13 -50,8 +50,13 @@@ fn widget(h: &Headless, id: &str) -> Oph.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r)}++/// Match FolderNode widget ids, whose paths use forward slashes on every platform.+fn folder_id(prefix: &str, dir: &Path) -> String {- // FolderNode paths (and their widget ids) use forward slashes on every platform.+ format!("{prefix}:{}", dir.to_string_lossy().replace('\\', "/"))+}+fn folder_row(h: &Headless, dir: &Path) -> Option<Rect> {- widget(h, &format!("source:libfolder:{}", dir.to_string_lossy()))+ widget(h, &folder_id("source:libfolder", dir))}fn id_of(h: &Headless, file: &str) -> u64 {diff --cc crates/ui-egui/src/tests_import_thumbnails.rsindex cdf178826,000000000..1e0b669d8mode 100644,000000..100644--- a/crates/ui-egui/src/tests_import_thumbnails.rs+++ b/crates/ui-egui/src/tests_import_thumbnails.rs@@@ -1,149 -1,0 +1,159 @@@+//! Import review sizes change the real grid and its preview resolution, preserving culling.++use std::time::Duration;++use serde_json::json;++use crate::headless::Headless;+use crate::import::ImportDialog;+use crate::render::Slot;+use crate::state::{Dialog, UiState};+use crate::{LightcraftApp, Services};+use lightcraft_engine::import::ImportCandidate;++const T: Duration = Duration::from_secs(30);+++/// An isolated import dialog with real preview jobs and a disposable procedural source file.+struct Review {+ h: Headless,+ dir: std::path::PathBuf,+}++impl Review {++ /// Open sixty candidates at the requested display density, including duplicate/error badges.+ fn new(scale: f32) -> Self {+ let dir = std::env::temp_dir().join(format!("lc-import-thumbnails-{}-{}", std::process::id(), lightcraft_preview::next_tick()));+ std::fs::create_dir_all(&dir).unwrap();+ let image = lightcraft_raster::Rgba8 {+ width: 1600,+ height: 1200,+ data: (0..1600 * 1200).map(|i| [((i % 1600) / 7) as u8, ((i / 1600) / 5) as u8, 100, 255]).collect(),+ };+ let bytes = lightcraft_codecs::encode_png(&lightcraft_codecs::EncodeImage::rgba8(&image), &Default::default()).unwrap();+ let path = dir.join("original.png");+ std::fs::write(&path, &bytes).unwrap();+ let mut candidates: Vec<_> = (0..60)+ .map(|i| ImportCandidate {+ path: path.to_string_lossy().into(),+ name: format!("a-long-photo-name-{i:02}.png"),+ format: "PNG".into(),+ width: 1600,+ height: 1200,+ file_size: bytes.len() as u64,+ ..Default::default()+ })+ .collect();+ candidates[1].duplicate = Some("content".into());+ candidates[2].error = Some("Unreadable test candidate".into());+ let mut app = LightcraftApp::new(lightcraft_engine::Session::new().with_fs(), Services::default());+ app.ui.dialog = Some(Dialog::Import { opts: Box::new(ImportDialog::new(candidates)) });+ let mut h = Headless::new(app, [1366.0, 1000.0], scale);+ assert!(h.settle(T));+ Self { h, dir }+ }+++ /// Find an automation widget, failing the test if the dialog no longer exposes it.+ fn rect(&self, id: &str) -> egui::Rect {+ self.h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("missing {id}"))+ }+++ /// Snapshot every candidate's checked state while requiring the review to remain open.+ fn checks(&self) -> Vec<bool> {+ let Some(Dialog::Import { opts }) = &self.h.app.ui.dialog else { panic!("import review closed") };+ opts.checked.clone()+ }+++ /// Drive the real control dispatcher and fail on any unsuccessful response.+ fn request(&mut self, method: &str, params: serde_json::Value) {+ let response = self.h.request(method, params, T);+ assert_eq!(response["ok"], true, "{method}: {response}");+ }+++ /// Set thumbnail size through its command and wait for the resulting previews to settle.+ fn size(&mut self, size: f32) {+ self.request("engine.execute", json!({"command": "view.importThumbSize", "params": {"size": size}}));+ assert!(self.h.settle(T));+ }+}++impl Drop for Review {++ /// Release import preview jobs before removing the temporary source directory.+ fn drop(&mut self) {+ self.h.app.ui.dialog = None;+ self.h.app.renderer.forget_imports();+ self.h.settle(T);+ let _ = std::fs::remove_dir_all(&self.dir);+ }+}+++/// Pointer input must resize and reflow tiles without changing culling, badges or saved size.+#[test]+fn import_thumbnail_slider_reflows_without_changing_selection_or_badges() {+ let mut review = Review::new(1.0);+ assert_eq!(review.rect("import:0").width(), 116.0);+ review.request("ui.clickWidget", json!({"id": "import:0"}));+ let checked = review.checks();+ assert!(!checked[0] && !checked[1] && !checked[2]);+ // Real pointer input on the slider, including its end stops.+ review.request("ui.clickWidget", json!({"id": "slider:importThumbSize", "fx": 0.0}));+ assert!(review.h.settle(T));+ assert_eq!(review.rect("import:0").width(), 80.0);+ let slider = review.rect("slider:importThumbSize");+ review.request("ui.dragWidget", json!({"id": "slider:importThumbSize", "toX": slider.right(), "toY": slider.center().y}));+ assert!(review.h.settle(T));+ assert_eq!(review.rect("import:0").width(), 320.0);+ assert_eq!(review.checks(), checked);+ let text = review.h.painted_text().join("\n");+ assert!(text.contains("Duplicate") && text.contains("Unreadable"), "badges remain visible: {text}");+ assert!(review.rect("import:3").top() > review.rect("import:0").top(), "larger tiles wrap into more rows");+ review.size(80.0);+ assert_eq!(review.rect("import:3").top(), review.rect("import:0").top());+ assert_eq!(review.checks(), checked);+ // The preference survives closing/reopening the review and a settings round trip.+ let saved = serde_json::to_value(&review.h.app.ui).unwrap();+ let restored: UiState = serde_json::from_value(saved).unwrap();+ assert_eq!(restored.sanitized().import_thumb_size, 80.0);+}+++/// Dense displays need sharper previews; shrinking reuses them and scrolling bounds retention.+#[test]+fn import_thumbnail_previews_upgrade_for_density_and_stay_bounded_when_scrolling() {+ let mut review = Review::new(2.0);+ assert_eq!(review.h.app.renderer.textures[&Slot::Import(0)].size, [384, 288]);+ review.size(320.0);+ assert_eq!(review.h.app.renderer.textures[&Slot::Import(0)].size, [768, 576]);+ // Shrinking keeps the sharp preview instead of replacing it with a smaller decode.+ let sharp = review.h.app.renderer.textures[&Slot::Import(0)].key;+ review.size(116.0);+ assert_eq!(review.h.app.renderer.textures[&Slot::Import(0)].key, sharp);+ review.size(320.0);+ // Scrolling a large card retains only the nearby tiles and drops obsolete requests.+ review.request("ui.hoverWidget", json!({"id": "import:0"}));+ review.request("ui.scroll", json!({"dy": -20000.0}));+ assert!(review.h.settle(T));+ assert!(!review.h.app.renderer.textures.contains_key(&Slot::Import(0)));+ let imports: Vec<_> = review.h.app.renderer.textures.keys().filter_map(|s| if let Slot::Import(i) = s { Some(*i) } else { None }).collect();+ assert!(!imports.is_empty() && imports.len() < 20, "bounded visible previews: {imports:?}");+ for i in imports {+ assert!(review.h.app.widgets.iter().any(|(w, _)| w == &format!("import:{i}")));+ }+}+++/// Invalid commands preserve the setting; legacy and non-finite preferences restore safely.+#[test]+fn import_thumbnail_size_rejects_bad_commands_and_restores_old_preferences() {+ let mut app = LightcraftApp::new(lightcraft_engine::Session::new(), Services::default());+ assert_eq!(app.run("view.importThumbSize", json!({})).unwrap()["size"], 116.0);+ for bad in [json!("large"), json!(null), json!([120]), json!(1e300)] {+ assert!(app.run("view.importThumbSize", json!({"size": bad})).is_err());+ assert_eq!(app.ui.import_thumb_size, 116.0);+ }+ assert_eq!(app.run("view.importThumbSize", json!({"size": -10})).unwrap()["size"], 80.0);+ assert_eq!(app.run("view.importThumbSize", json!({"size": 1e6})).unwrap()["size"], 320.0);+ let legacy: UiState = serde_json::from_value(json!({})).unwrap();+ assert_eq!(legacy.import_thumb_size, 116.0);+ for bad in [f32::NAN, f32::INFINITY, f32::NEG_INFINITY] {+ let state = UiState { import_thumb_size: bad, ..Default::default() }.sanitized();+ assert_eq!(state.import_thumb_size, 116.0);+ }+}diff --cc docs/gaps.mdindex aae2389fb,1b4a385fa..2de817113--- a/docs/gaps.md+++ b/docs/gaps.md@@@ -1,6 -1,6 +1,6 @@@# Gaps: where LightCraft falls short of Lightroom- > **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-17 · **Change:** minor (import grid thumbnail size adjustable; gap 30 tracks the remaining pre-import loupe, #2056)-> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-15 · **Change:** minor (gap 15: Print Page Options — page numbers, page info, crop marks)++> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-18 · **Change:** minor (import grid thumbnail size adjustable; gap 30 tracks the remaining pre-import loupe, #2056; upstream Print Page Options and camera updates retained)Every known shortfall, one entry each, ranked by user impact (how many Lightroom users hit it, andhow hard it blocks them), then by effort. **Agents pick work from the top** (the first entry nobody is@@@ -81,7 -77,8 +81,9 @@@ Beta-blocking gaps (B) total **~230–4| Date | Change | Summary ||---|---|---|+| 2026-10-17 | minor | Import thumbnail-size slider (part of #2056); gap 30 records the remaining pre-import loupe and keyboard culling |+ | 2026-10-18 | patch | Gap 1: six X-Trans CMOS 4 Fujifilm bodies (X-T30 …) take the X-T3's spectral matrices instead of the neutral matrix |+ | 2026-10-15 | minor | Gap 15 shrinks: the Page panel's Page Options (Page Numbers, Page Info, Crop Marks) print on Single Image and Contact Sheet pages; identity plate, watermark, photo info, Cut Guides, direct printing and JPEG output remain || 2026-10-14 | minor | Gap 26: at 100k photos stack and album lookups are indexed, so an "In a Stack" or "Album" smart album counts in ~14 ms (was 0.6–2.7 s); open time unchanged || 2026-10-14 | minor | Gap 10: Camera-coverage sweep (#1327): 30 models verified on 40 CC0 files (coverage.py 515 → 545 verified); sensor verification does not establish colour parity (#1277) || 2026-10-14 | minor | Gap 21: de, es, fr, ja and uk catalogs filled (97–99%); 55–90 h → 40–70 h |diff --cc docs/parity-checklist.mdindex da25ec019,4e0531793..b8d8438ef--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -1,6 -1,6 +1,6 @@@# Lightroom parity checklist- > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (import grid thumbnail-size slider, #2056; status and summary counts unchanged) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-15 · **Change:** minor (LRC-PRINT-PAGE: Print Page Options) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6++> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-18 · **Change:** minor (import grid thumbnail-size slider, #2056; upstream Print Page Options and raw/export updates retained; status and summary counts unchanged) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what wehave and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good@@@ -797,7 -797,10 +797,11 @@@ Latin stays upright. Advanced Japanese| Date | Change | Summary ||---|---|---|+| 2026-10-17 | minor | LR-IMP-ADD-DIALOG: import grid thumbnail-size slider, density-aware previews, bounded visible textures and preserved culling; remaining loupe tracked in gap 30 (#2056); status and summary counts unchanged |+ | 2026-10-14 | patch | LR-EXP-TYPE: opaque 8-bit PNG/TIFF/WebP use RGB; transparent exports retain alpha (#1670). Statuses and feature counts unchanged. |+ | 2026-10-15 | minor | LRC-PRINT-PAGE: Page Options (Page Numbers, Page Info, Crop Marks) on Single Image and Contact Sheet pages, in the Print dialog, `print.set` and templates; still 🟡 (no identity plate, watermark, photo info or Cut Guides) |+ | 2026-10-15 | minor | LR-IMP-FORMATS: Hasselblad 3FR and FFF show their uncompressed RGB preview (no JPEG in these files) in the grid and loupe until developed, and as the stand-in when a file fails to decode; status unchanged (🟡) |+ | 2026-10-15 | minor | LR-IMP-FORMATS: a Hasselblad FFF develops with the camera's colour matrix from the original 3FR header it embeds (tag `0xC51B`) instead of the neutral matrix; status unchanged (🟡) || 2026-10-12 | minor | LR-EDIT-OPTICS-PROFILE: Sony ARW shading, CA and distortion tables decoded with settings and provenance (raw IFD, `SR2SubIFD` fallback); applied corrections unchanged (ILCE-7RM4A and ILCE-7RM6 distortion); status unchanged (🟡) || 2026-10-14 | minor | LR-IMP-CAMERA-COVERAGE: Camera-coverage sweep (#1327): 30 models verified on 40 CC0 files (coverage.py 515 → 545 verified); sensor verification does not establish colour parity (#1277); status unchanged (🟡) || 2026-10-13 | minor | LR-MERGE-PANO: a panorama's DNG takes its `AsShotNeutral` from the median of its frames' vendor white-balance multipliers (CR2, NEF, ARW…) instead of the first frame's tags, and frames now carry the multipliers (issue #1144); status unchanged (✅) |