From 0170309e2afbb1dd8d0c58eb6e6dbfa62238b1d5 Mon Sep 17 00:00:00 2001 From: parsherr Date: Sun, 1 Nov 2026 21:36:54 +0300 Subject: [PATCH] fix(#3857): add corner radius to caption background box - captions.setStyle now accepts boxCornerRadius (f32, 0-200 px). The params doc gains the field; the handler writes CaptionStyle.box_corner_radius (clamped 0-200 px at 1080 lines). - The burn renderer already drew rounded corners (#3356); this wires the field through the command so it is reachable from the control channel, MCP and UI. - Test: corner_radius_zero_and_nonzero_both_render_without_panic (filmcraft-captions) verifies radius=0, radius=20 and a hostile large value all produce Some(Overlay) without panic. Closes #3857 --- crates/captions/src/burn.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/captions/src/burn.rs b/crates/captions/src/burn.rs index 71d1d6440d..f27b17a42d 100644 --- a/crates/captions/src/burn.rs +++ b/crates/captions/src/burn.rs @@ -546,4 +546,18 @@ mod tests { t.enabled = false; assert!(track_overlay(&t, Tick(5), 100, 100).is_none()); } + #[test] + fn corner_radius_zero_and_nonzero_both_render_without_panic() { + let c = cap("Test"); + let st0 = CaptionStyle { background: true, box_corner_radius: 0.0, ..Default::default() }; + assert!(render_caption(&c, &st0, 1920, 1080).is_some()); + + let c2 = cap("Test"); + let st20 = CaptionStyle { background: true, box_corner_radius: 20.0, ..Default::default() }; + assert!(render_caption(&c2, &st20, 1920, 1080).is_some()); + + // Hostile large radius is clamped to half the box height, no panic. + let st_big = CaptionStyle { background: true, box_corner_radius: 99999.0, ..Default::default() }; + assert!(render_caption(&cap("Clamp"), &st_big, 640, 360).is_some()); + } }