Compositions: reject zero and negative frame rates instead of panicking
comp.new / comp.settings passed `frameRate` straight to FrameRate::from_f64, so 0 (or anything below 0.0005) became a 0/1 rate and the next frame-duration computation divided by zero, killing the process (and an MCP session with its unsaved project); a negative rate was accepted as-is. Scripts hit it via addComp(..., 0) or comp.frameRate = 0. Return a parameter error like renderQueue.add's frameRate check does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4bfb689f19
commit
780419c235
@@ -301,6 +301,17 @@ fn comp_settings_anchor_start_timecode_renderer() {
|
||||
assert_eq!(c.renderer, crate::project::Renderer::Advanced3D);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn comp_rejects_zero_and_negative_frame_rates() {
|
||||
let mut s = Session::default();
|
||||
for fps in [0.0, -30.0, 0.0001] {
|
||||
assert!(s.execute("comp.new", json!({"frameRate": fps})).is_err(), "{fps}");
|
||||
}
|
||||
s.execute("comp.new", json!({"frameRate": 30, "duration": 1})).unwrap();
|
||||
assert!(s.execute("comp.settings", json!({"frameRate": 0})).is_err());
|
||||
assert_eq!(s.active_comp().unwrap().frame_rate, crate::time::FrameRate::FPS_30);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn render_queue_add_accepts_documented_settings_when_checked() {
|
||||
let mut s = demo();
|
||||
|
||||
Reference in New Issue
Block a user