Save: a plain Save records its Targa answer too

save_in_place_with journalled only the JPEG answer, so a replayed or scripted file.save with
tgaBits replayed at the default bits (CodeRabbit on #7878).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Higgs32584andClaude Opus 5.5 committed 2026-10-19 21:45:07 -04:00
1 parent 8f5ba769e3
commit 3d27feac18
2 files changed
+14 -1

No files matched your search

+9
View File
@@ -1201,6 +1201,15 @@ fn save_of_a_flat_file_asks_after_the_dialog_when_another_app_changed_it() {
assert_eq!(app.session.journal.last(), Some(&("file.save".to_string(), json!({}))), "still recorded as a plain Save");
}
/// A replayed plain Save keeps its Targa answer in the step it records, as well as its JPEG one.
#[test]
fn a_replayed_plain_save_records_its_targa_answer() {
let (mut app, _, written) = jpeg_app(Some("/pics/photo.tga"), false);
app.replay_save("file.save", &json!({"tgaBits": 24})).unwrap();
assert_eq!(*written.borrow(), ["/pics/photo.tga"]);
assert_eq!(app.session.journal.last(), Some(&("file.save".to_string(), json!({"tgaBits": 24}))));
}
/// A script's JPEG Options answer survives the changed-on-disk prompt: Replace writes with it,
/// without asking JPEG Options.
#[test]
+5 -1
View File
@@ -1601,7 +1601,11 @@ impl PhotocraftApp {
return Err(SAVE_OPTIONS_OPEN.into());
}
let r = self.write_save(path, None, choices)?;
self.session.journal.push(("file.save".into(), jpeg_options_ui::plain_save_step(choices.jpeg)));
let mut step = jpeg_options_ui::plain_save_step(choices.jpeg);
if let Some(bits) = choices.tga_bits {
step["tgaBits"] = bits.bits().into();
}
self.session.journal.push(("file.save".into(), step));
Ok(r)
}