paint: test NaN dual hardness and spacing fall back to the defaults

CodeRabbit review point: the dual-brush fallbacks in bounded_for_render were not covered.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
vangel76andClaude Sonnet 5.5 committed 2026-11-04 00:18:52 +01:00
1 parent af025e18d5
commit 93d41f434f
1 file changed
+18
+18
View File
@@ -1008,6 +1008,24 @@ mod streaming_tests {
assert_eq!((b.opacity, b.flow, b.spacing), (3.0, f32::NEG_INFINITY, f32::INFINITY));
}
#[test]
fn a_nan_dual_hardness_or_spacing_paints_as_the_default() {
let pts = path();
let mut explicit = BrushSettings { size: 10.0, ..BrushSettings::default() };
explicit.dual_brush.enabled = true;
explicit.dual_brush.size = 6.0;
explicit.dual_brush.hardness = 1.0;
explicit.dual_brush.spacing = 0.25;
let (_, want_dual) = streamed(&explicit, &pts, 1000);
assert!(!want_dual.is_empty());
let mut broken = explicit.clone();
broken.dual_brush.spacing = f32::NAN;
assert_eq!(streamed(&broken, &pts, 1000).1, want_dual);
broken.dual_brush.hardness = f32::NAN;
let b = broken.bounded_for_render();
assert_eq!((b.dual_brush.hardness, b.dual_brush.spacing), (1.0, 0.25));
}
#[test]
fn a_point_without_a_position_does_not_poison_a_smoothed_stroke() {
let mut brush = BrushSettings { size: 8.0, ..BrushSettings::default() };