From dd07d15aa36b3871b1c0dfd948a691d87368f1db Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Sun, 1 Nov 2026 03:52:24 -0600 Subject: [PATCH] Replace Color: check the unsampled black with a lifting pass (CodeRabbit review on tests.rs:888) Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/adjust_cmds/tests.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/engine/src/cmd/adjust_cmds/tests.rs b/crates/engine/src/cmd/adjust_cmds/tests.rs index 36d4dcf21e..162524367d 100644 --- a/crates/engine/src/cmd/adjust_cmds/tests.rs +++ b/crates/engine/src/cmd/adjust_cmds/tests.rs @@ -895,11 +895,18 @@ fn replace_color_follows_the_click_order_as_color_range_does() { s.execute("image.adjustments.replaceColor", p).unwrap(); let replaced: Vec = at.iter().enumerate().map(|(i, &(x, y))| changed(rgba(&s, x, y), before[i]) > 0.1).collect(); s.execute("edit.undo", json!({})).unwrap(); + // Darkening leaves black black whether or not it's matched: lighten to see whether it is. + p = clicks.clone(); + p["lightness"] = json!(50); + s.execute("image.adjustments.replaceColor", p).unwrap(); + let lifted = changed(rgba(&s, 40, 16), before[3]) > 0.1; + s.execute("edit.undo", json!({})).unwrap(); s.execute("select.colorRange", clicks).unwrap(); let sel = doc(&s).selection.clone().unwrap(); let covered: Vec = at.iter().map(|&(x, y)| sel.read_region(Rect::from_xywh(x, y, 1, 1))[0] > 0.5).collect(); assert_eq!(covered, [true, true, true, false], "Color Range: the light grey is added back after the subtraction"); assert_eq!(replaced, covered, "Replace Color matches what Color Range covers for the same clicks"); + assert_eq!(lifted, covered[3], "Replace Color matches black as Color Range does"); } /// FredApps review on #10443: Localized Color Clusters with several samples. A matching colour