LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #592
Brandon Thomas2421f2223b8d
diff --cc crates/ui-egui/src/tests_panels.rsindex 8016aa112,fd0d81157..9aa84ad81--- a/crates/ui-egui/src/tests_panels.rs+++ b/crates/ui-egui/src/tests_panels.rs@@@ -1097,22 -1097,45 +1097,65 @@@ fn date_and_keyword_rows_show_their_phoassert_eq!(h.app.session.filter, lightcraft_catalog::Filter::default(), "{key}");}+/// Issue #501: use the actual context-menu button on the populated demo folder.+#[test]+fn deleting_a_populated_album_folder_from_its_menu_is_undoable() {+ let mut h = demo([1400.0, 900.0], json!({"view": "photoGrid", "leftPanel": true}));+ let folder = h.app.session.catalog.albums().find(|a| a.folder && a.name == "Travel 2026").unwrap().id;+ assert!(!h.app.session.catalog.album_children(Some(folder)).is_empty());+ let before = h.app.session.catalog.to_snapshot();+ let photo_count = h.app.session.catalog.photos().count();+ right_click(&mut h, &format!("source:folder:{}", folder.0));+ click(&mut h, &format!("albumDelete:{}", folder.0));+ assert!(h.app.session.catalog.album(folder).is_none());+ assert_eq!(h.app.session.catalog.photos().count(), photo_count);+ assert!(!popup_open(&h));+ h.app.run("edit.undo", json!({})).unwrap();+ h.step();+ h.step();+ assert_eq!(h.app.session.catalog.to_snapshot(), before);+ assert!(has(&h, &format!("source:folder:{}", folder.0)));+}+++ /// A menu command's toast shows, however long the app has been running: commands made their+ /// toasts with a fresh context, whose clock is at 0, so by the app's clock they were already over+ /// (Auto Advance On, Imported presets, …).+ #[test]+ fn a_menu_commands_toast_shows_after_a_while() {+ let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() });+ let mut h = crate::headless::Headless::new(app, [1000.0, 700.0], 1.0);+ for _ in 0..600 {+ h.step();+ }+ let r = h.request("engine.execute", serde_json::json!({"command": "view.autoAdvance"}), std::time::Duration::from_secs(10));+ assert_eq!(r["ok"], true, "{r}");+ h.step();+ h.step();+ assert!(h.app.ui.toast.as_ref().is_some_and(|t| t.0.starts_with("Auto Advance")), "{:?}", h.app.ui.toast);+ }++ /// Auto-Tag from Tracklog's toast shows too: it was stamped by a clock of its own, which starts at+ /// zero, so a while into a session it had always already expired.+ #[test]+ fn the_tracklog_toast_shows_after_a_while() {+ let dir = std::env::temp_dir().join(format!("lc-tracklog-toast-{}", std::process::id()));+ std::fs::create_dir_all(&dir).unwrap();+ let gpx = dir.join("walk.gpx");+ std::fs::write(+ &gpx,+ r#"<?xml version="1.0"?><gpx version="1.1" creator="test" xmlns="http://www.topografix.com/GPX/1/1"><trk><trkseg><trkpt lat="46.0" lon="7.0"><time>2026-05-01T10:00:00Z</time></trkpt></trkseg></trk></gpx>"#,+ )+ .unwrap();+ let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() });+ let mut h = crate::headless::Headless::new(app, [1000.0, 700.0], 1.0);+ for _ in 0..600 {+ h.step();+ }+ let p = serde_json::json!({"command": "photo.tagFromTracklog", "params": {"path": gpx.to_string_lossy(), "offset": 0}});+ let r = h.request("engine.execute", p, std::time::Duration::from_secs(10));+ assert_eq!(r["ok"], true, "{r}");+ h.step();+ h.step();+ assert!(h.app.ui.toast.as_ref().is_some_and(|t| t.0.starts_with("Tagged")), "{:?}", h.app.ui.toast);+ let _ = std::fs::remove_dir_all(&dir);+ }diff --cc docs/whats-new.mdindex 0035ce7da,cd80ae858..c7f59df83--- a/docs/whats-new.md+++ b/docs/whats-new.md@@@ -2,42 -2,14 +2,50 @@@## October 2026+### Smart album rules+- The rule editor's field menu is grouped: Rating, Pick Flag, Color Label and Any Searchable Text at the top, then+ submenus for Source, File, Date, Keywords & People, Description, Camera Info, Location, Size, Develop and Assisted+ Culling.+- New fields: Keyword Count ("2 or more", "exactly 2"…), People and People Count (named faces), Shutter Speed (written+ as 1/250), File Extension, Video Duration, Copy Name, In a Stack, Alt Text, City, State / Province, Country, Long+ Edge, Short Edge, Aspect Ratio (landscape / portrait / square), Cropped and Treatment (in color / black & white).+ Size rules measure the photo as shown: Megapixels now counts the cropped photo, like Long Edge, Short Edge and+ Aspect Ratio (a 24 MP photo cropped to a square is 16 MP).+- Choice values read as words in every language: "Public Domain", "Picked", "Black & White" rather than ids like+ `publicDomain` (rules and agents keep using the ids; `album.ruleFields` adds `choiceLabels`).+- Rule values are checked: a rating of 9, a date like 2026-13 or "banana", a "between" whose dates are the wrong+ way round, "in the last 0 days", a colour label that doesn't exist, "contains" with nothing to look for, an+ album that is gone, or an empty group is reported with its rule ("rule 2.1: no rating 0–5 is 9")+ instead of quietly matching nothing or everything. New date rules start at the current year.+- A smart album can include or exclude another smart album: "Keywords contain travel" and "Album isn't Excluded Photos"+ leaves out whatever Excluded Photos matches, as its rules change. The album picker shows your albums as in the sidebar+ (folders open on click) or finds them as you type part of a name or folder (↑ / ↓ and Enter to pick); albums that+ can't be picked, such as one that would make an album include itself, are greyed with the reason. Esc with a dropdown or calendar open in a dialog+ closes just that.+- Date rules have a calendar button: pick a day, a month or a whole year (Year / Month / Day), in your language; the+ two dates of a "between" can't be picked out of order; Esc closes just the calendar. It picks dates, not times (a+ time is typed, and picking a day replaces one). Typing still works, and "2026-10-01 10:00" (a space for the+ T) now matches.+- Rule problems are shown in your language and name the field the way the menu does ("Title: needs something to look+ for").+- A smart album whose rules no longer check (an album they test was deleted) is marked ⚠ in the sidebar; its tooltip+ says what to fix, and `albums.list` reports `problems`.+- Editing a smart album's name and rules is one step: both or neither, and one undo takes both back+ (`album.setRules` takes `name`).+- The rule editor marks each rule that needs fixing right under it and keeps OK disabled until they are fixed. An+ Album rule is "is" or "isn't" an album, picked with the album picker.+- Yes/no fields (Has Edits, Cropped, Has GPS…) read Yes / No instead of true / false. A rule sent as `"false"` now+ means no (it used to count as yes), and a value that is neither yes nor no is refused.+- Any Searchable Text also finds the state / province, alt text, people and a virtual copy's name.++ ### Keyword lists+ - File ▸ Import Keywords… and Export Keywords… read and write keyword list files as Lightroom Classic does (a keyword+ a line, a tab per level, synonyms in braces, keywords left out of export in brackets). Capture One, darktable, Adobe+ Bridge and Photo Supreme (its Formatted Vocabulary File) use the same files, so keyword lists move between them and+ LightCraft. Importing adds the keywords you don't have, in one undo step; a file it can't read says which line, or+ to save it as UTF-8. Exporting warns about keywords Capture One won't import, and names any keyword the format can't+ hold (such as a name in brackets), which it leaves out so the file always reads back.+### Keyword sets- Keyword Set ▸ Edit Set… edits a set's nine keywords in place, one field per ⌥ key, and renames it (or saves the edits as a newset). An empty field leaves its key empty instead of moving the keywords after it; editing Recent Keywords and naming