Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Address review findings on the new test and fix

eliets2c73bf309870b
diff --git a/crates/develop/src/lib.rs b/crates/develop/src/lib.rs
index f27aa9c23..acdf4836c 100644
--- a/crates/develop/src/lib.rs
+++ b/crates/develop/src/lib.rs
@@ -158,8 +158,13 @@ impl DevelopSettings {
}
Section::Color => self.wb.mode = WbMode::AsShot,
Section::Detail => self.enhance.denoise_on = None,
- // the creative profile is not a control: the chosen look goes back to the default one
- Section::Profile => self.profile.id = Profile::default().id,
+ // the creative profile is not a control: the chosen look goes back to the default one,
+ // and so does the camera's own local tone mapping
+ Section::Profile => {
+ let d = Profile::default();
+ self.profile.id = d.id;
+ self.profile.camera_local_tone = d.camera_local_tone;
+ }
_ => {}
}
}
@@ -330,6 +335,15 @@ mod tests {
assert_eq!(s.profile.amount, 100.0);
}
+ #[test]
+ fn resetting_the_profile_section_clears_the_camera_local_tone() {
+ // the camera's local tone mapping is not a control either: a Profile reset switches it off
+ let mut s = DevelopSettings::default();
+ s.profile.camera_local_tone = true;
+ s.reset_section(Section::Profile);
+ assert!(!s.profile.camera_local_tone);
+ }
+
#[test]
fn section_toggles() {
let mut s = DevelopSettings::default();