Batch 36: #1510's rename follows the optional name #1665 gave person_from; #1780's test sets #974's preview_checked; rustfmt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-14 22:35:34 -04:00
co-authored by Claude Opus 5.5
parent a740c1f390
commit 211255770f
5 changed files with 20 additions and 11 deletions
+9 -1
View File
@@ -1020,7 +1020,15 @@ mod imp {
s.faces.scanned.insert(b.0);
let old = finished(&s, a, Some(vec![rect]), vec![(rect, Some(unit(&[(2, 1.0)])), rect)]);
let (width, height) = s.catalog.photo(a).map(|p| (p.width, p.height)).unwrap();
let replace = Op::SetContent { id: a, width, height, file_size: 1234, content_hash: Some("edited".into()), preview_only: None };
let replace = Op::SetContent {
id: a,
width,
height,
file_size: 1234,
content_hash: Some("edited".into()),
preview_only: None,
preview_checked: String::new(),
};
s.commit("Reload Changed Files", replace).unwrap();
assert!(s.faces.index.get(a.0, &rect).is_none() && !s.faces.scanned.contains(a.0), "the old file's faces are forgotten");
assert!(needs_search(&s, s.catalog.photo(a).unwrap()), "and the photo is searched again");
+1 -1
View File
@@ -35,8 +35,8 @@ mod prefs;
mod preset_files;
pub mod previews;
mod query;
mod slideshow;
pub mod recheck;
mod slideshow;
mod sync;
mod xmp;
+2 -1
View File
@@ -56,7 +56,8 @@ fn nrw_wb(mn: Option<&makernote::MakerNote>) -> Option<[f32; 3]> {
let (kelvin, r, g1, g2, bl) = (at(0)?, at(1)?, at(2)?, at(3)?, at(4)?);
let sane = |v: u32| (64..=2560).contains(&v);
let mirrored = at(15)? == kelvin;
(mirrored && (2000..=12000).contains(&kelvin) && g1 == 512 && g2.abs_diff(512) <= 8 && sane(r) && sane(bl)).then(|| [r as f32 / 256.0, 1.0, bl as f32 / 256.0])
(mirrored && (2000..=12000).contains(&kelvin) && g1 == 512 && g2.abs_diff(512) <= 8 && sane(r) && sane(bl))
.then(|| [r as f32 / 256.0, 1.0, bl as f32 / 256.0])
}
/// Nikon CropArea is `[left, top, width, height]` in sensor pixels (maker-note tag documentation).
+6 -6
View File
@@ -55,10 +55,10 @@ mod tests_appearance;
#[cfg(test)]
mod tests_before_after;
#[cfg(test)]
mod tests_canvas_keys;
#[cfg(test)]
mod tests_browse_active;
#[cfg(test)]
mod tests_canvas_keys;
#[cfg(test)]
mod tests_compare;
#[cfg(test)]
mod tests_copy_paste_dialogs;
@@ -129,10 +129,10 @@ mod tests_quit_unsaved;
#[cfg(test)]
mod tests_recheck;
#[cfg(test)]
mod tests_sam_setup;
#[cfg(test)]
mod tests_rename_person;
#[cfg(test)]
mod tests_sam_setup;
#[cfg(test)]
mod tests_scroll;
#[cfg(test)]
mod tests_slideshow;
@@ -565,10 +565,10 @@ impl LightcraftApp {
if self.ui.last_person.as_deref().is_some_and(same) {
self.ui.last_person = Some(to.to_string());
}
if let Some((name, photo)) = self.ui.person_from.clone()
if let Some((Some(name), photo)) = self.ui.person_from.clone()
&& same(&name)
{
self.ui.person_from = Some((to.to_string(), photo));
self.ui.person_from = Some((Some(to.to_string()), photo));
}
}
+2 -2
View File
@@ -93,7 +93,7 @@ fn rename_person_from_the_card_and_the_page() {
let Some(Dialog::RenamePerson { to, .. }) = &mut h.app.ui.dialog else { panic!("dialog closed") };
*to = "Ada Lovelace".into();
h.app.ui.last_person = Some("Jane Doe".into());
h.app.ui.person_from = Some(("Jane Doe".into(), ids[0].0));
h.app.ui.person_from = Some((Some("Jane Doe".into()), ids[0].0));
h.app.session.execute("library.filter", &json!({"person": "jane doe"})).unwrap();
h.step();
click(&mut h, "button:dialogOk");
@@ -102,7 +102,7 @@ fn rename_person_from_the_card_and_the_page() {
assert_eq!(stored(&h, ids[1])[0].as_deref(), Some("Ada Lovelace"));
assert_eq!(h.app.ui.person_page.as_deref(), Some("Ada Lovelace"));
assert_eq!(h.app.ui.last_person.as_deref(), Some("Ada Lovelace"));
assert_eq!(h.app.ui.person_from.as_ref().map(|(n, _)| n.as_str()), Some("Ada Lovelace"));
assert_eq!(h.app.ui.person_from.as_ref().and_then(|(n, _)| n.as_deref()), Some("Ada Lovelace"));
assert_eq!(h.app.session.filter.person.as_deref(), Some("Ada Lovelace"));
h.app.session.execute("edit.undo", &json!({})).unwrap();
assert_eq!(stored(&h, ids[0]), vec![Some("Jane Doe".into()), Some("jane doe".into())]);