diff --git a/crates/ui-egui/src/file_dialog/tests.rs b/crates/ui-egui/src/file_dialog/tests.rs index 1237c518bc0..b3b44c731e2 100644 --- a/crates/ui-egui/src/file_dialog/tests.rs +++ b/crates/ui-egui/src/file_dialog/tests.rs @@ -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] diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 5f69a23f953..ad5a147c881 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -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) }