From bbb529f64b2d81935e15528ee1f0d241baffb7cb Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Mon, 23 Nov 2026 04:43:29 +0700 Subject: [PATCH] test(pipeline): preserve visible local Clarity in RAW development (#4664) * test(pipeline): prove visible mask clarity reaches the render * test: format local clarity regression * test: isolate Clarity scheduler borrow --------- Co-authored-by: Codex --- crates/pipeline/src/tests_local.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/crates/pipeline/src/tests_local.rs b/crates/pipeline/src/tests_local.rs index f91756cf23..d0ae3b40c5 100644 --- a/crates/pipeline/src/tests_local.rs +++ b/crates/pipeline/src/tests_local.rs @@ -1,4 +1,4 @@ -//! Pixel tests of the local (mask) Noise, Moiré and Defringe sliders. +//! Pixel tests of the local (mask) adjustment sliders. use lightcraft_develop::{DevelopSettings, LocalAdjustments, Mask, MaskComponent, MaskOp, MaskShape}; use lightcraft_geom::Point; @@ -45,6 +45,27 @@ fn chroma(p: [u8; 4]) -> f32 { p[0] as f32 - p[2] as f32 } +#[test] +fn local_clarity_changes_only_the_visible_mask() { + // Two identical midtone edges, well inside and well outside the mask. + let src = Rgb32f::from_fn(W, H, |x, _| [if x % (W / 2) < W / 4 { 0.10 } else { 0.28 }; 3]); + let mut s = left_mask(LocalAdjustments::default()); + let neutral = shot(&src, &s); + let clarity_plane = |s: &DevelopSettings| crate::local::plane_sigmas(s, W as f64, W as f64, crate::Quality::Full).clarity; + assert!(clarity_plane(&s).is_none()); + + s.masks[0].adjust.clarity = 100.0; + assert!(clarity_plane(&s).is_some()); + let visible = shot(&src, &s); + let peak = |center| (center - 4..=center + 4).map(|x| visible.get(x, H / 2)[1].abs_diff(neutral.get(x, H / 2)[1])).max().unwrap_or(0); + assert!(peak(W / 4) >= 3, "visible Clarity must move the inside edge by at least 3/255"); + assert!(peak(3 * W / 4) <= 1, "the far outside edge must stay within 1/255"); + + s.masks[0].visible = false; + assert!(clarity_plane(&s).is_none()); + assert!(shot(&src, &s).data == neutral.data, "hidden Clarity must not affect the render"); +} + #[test] fn local_noise_smooths_luminance_noise_inside_the_mask() { let src = Rgb32f::from_fn(W, H, |x, y| [0.18 * (1.0 + 0.12 * noise(x, y, 1)); 3]);