mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-24 09:57:08 -06:00
Integration: a scale beyond f32 range is refused, not clamped, for #7048
Main's 3f216a0cd1 rejects numeric overflow before document edits; #7048's test predates it and expected 1e39 to clamp to 150 %.
This commit is contained in:
@@ -1219,7 +1219,6 @@ mod tests {
|
||||
for (cmd, p, want) in [
|
||||
("gradientOverlay", json!({"scale": 1000}), 1.5),
|
||||
("gradientOverlay", json!({"scale": 1}), 0.1),
|
||||
("gradientOverlay", json!({"scale": 1e39}), 1.5),
|
||||
("gradientOverlay", json!({"scale": 80}), 0.8),
|
||||
("stroke", json!({"from": "#000000", "to": "#ffffff", "scale": -50}), 0.1),
|
||||
("stroke", json!({"from": "#000000", "to": "#ffffff", "scale": 0}), 0.1),
|
||||
@@ -1229,6 +1228,9 @@ mod tests {
|
||||
s.execute(&format!("layer.layerStyle.{cmd}"), p.clone()).unwrap();
|
||||
assert!((scale(&s) - want).abs() < 1e-6, "{cmd} {p}: {}", scale(&s));
|
||||
}
|
||||
// Beyond f32 range is refused before any edit (commands.rs), not clamped.
|
||||
let err = session().execute("layer.layerStyle.gradientOverlay", json!({"scale": 1e39})).unwrap_err();
|
||||
assert!(format!("{err:?}").contains("finite 32-bit"), "{err:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user