Merge pull request #7784 from dotCooCoo/fix/a-nan-spot-tint-from-a-file-reaches-plate

Print: a spot or Registration tint that is not a finite number prints no ink
This commit is contained in:
BFlat
2026-11-15 15:44:07 +07:00
committed by GitHub
3 changed files with 46 additions and 4 deletions
+11
View File
@@ -662,6 +662,17 @@ fn a_spot_gradient_stop_prints_its_process_plates() {
assert_eq!(first(json!({"output": {"mode": "separations", "spotsToProcess": true}})), [25.0, 10.0, 64.0, 5.0]);
}
#[test]
fn a_spot_gradient_stop_whose_tint_is_not_a_number_prints_no_spot_ink() {
let mut mixed = GradientStop::new(0.0, Color::cmyk(0.25, 0.1, 0.8, 0.05));
(mixed.swatch, mixed.tint, mixed.plates) = (Some("Gold".into()), f32::NAN, Some([0.25, 0.0, 0.4, 0.0]));
let g = GradientPaint::new(Gradient::new(GradientKind::Linear, vec![mixed, GradientStop::new(1.0, Color::cmyk(0.0, 0.0, 0.0, 0.0))]));
let d = gold_gradient_doc(g);
let first = |v| gradient_plates(&d, v).into_iter().map(|(s, _)| s).collect::<Vec<_>>();
assert_eq!(first(json!({"output": {"mode": "separations"}})), [25.0, 0.0, 40.0, 0.0, 0.0], "Cyan, Magenta, Yellow, Black, Gold");
assert_eq!(first(json!({"output": {"mode": "separations", "spotsToProcess": true}})), [25.0, 0.0, 40.0, 0.0]);
}
#[test]
fn a_freeform_gradients_points_separate_into_plates() {
let mut g = GradientPaint::new(Gradient::new(GradientKind::Freeform, vec![GradientStop::new(0.0, Color::cmyk(0.0, 0.0, 0.0, 1.0))]));