mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 19:14:26 +00:00
test(video): bound Screen Video output and hostile packet handling
This commit is contained in:
@@ -114,3 +114,7 @@ The XML reader in `crates/plist/src/xml.rs` and its base64 compatibility helper
|
||||
## GIMP palette reader
|
||||
|
||||
`crates/palette` extracts the GPL text parser from AniCraft `crates/doc/src/swatch.rs` at `d875a7feb250e6ab06aa28a37fb78a0699e88330` (MIT OR Apache-2.0), introduced by Tanish Manku in `a64130a9da9bdde545463b852d95d6a6774b1dfd` (AniCraft #270). The import preserves Tanish as primary author. Neutral RGB/name adaptation separates application display-name sanitization and the `Untitled` policy; validation tests and integration are subsequent Dylan M. Taylor changes.
|
||||
|
||||
## Screen Video key frames
|
||||
|
||||
`crates/video/src/screen_video.rs` extracts AniCraft `crates/xfl/src/video.rs` codec-3 decoding and its synthetic partial-block fixture, introduced by Tanish Manku in `1f3e603b7ff53a3da364e41ec4da8d43dc83aab0` with pixel-loop cleanup `2b7571363b4b647266df758f95b6e397021cfd4d` (MIT OR Apache-2.0). Import commits preserve Tanish as primary author. Caller-owned bounds and neutral RGBA output separate codec work from the consuming app's FLV first-frame/report policy. Boundary tests and integration are subsequent Dylan M. Taylor changes.
|
||||
|
||||
Generated
+1
@@ -3286,6 +3286,7 @@ dependencies = [
|
||||
"craft-jpeg",
|
||||
"craft-media",
|
||||
"craft-media-testkit",
|
||||
"miniz_oxide 0.8.9",
|
||||
"rav1e",
|
||||
"rayon",
|
||||
"thiserror 2.0.21",
|
||||
|
||||
@@ -99,4 +99,21 @@ mod tests {
|
||||
assert_eq!(&rgba[i..i + 4], &[r, g, b, 255], "({x}, {y})");
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn limits_truncation_and_unchanged_blocks_are_refused() {
|
||||
let p = packet(40, 20, 16, |x, y| [x as u8, y as u8, 7]);
|
||||
assert!(decode_keyframe(&p, 40, 40 * 20 * 4).is_some());
|
||||
assert!(decode_keyframe(&p, 39, usize::MAX).is_none());
|
||||
assert!(decode_keyframe(&p, 40, 40 * 20 * 4 - 1).is_none());
|
||||
for cut in 0..p.len() {
|
||||
let _ = decode_keyframe(&p[..cut], 40, 40 * 20 * 4);
|
||||
}
|
||||
let mut unchanged = p.clone();
|
||||
unchanged[4..6].fill(0);
|
||||
assert!(decode_keyframe(&unchanged, 40, 40 * 20 * 4).is_none());
|
||||
assert!(decode_keyframe(&[0, 0, 0, 0], 40, usize::MAX).is_none());
|
||||
let mut trailing = p.clone();
|
||||
trailing.extend_from_slice(&[1, 2, 3]);
|
||||
assert_eq!(decode_keyframe(&trailing, 40, 3200), decode_keyframe(&p, 40, 3200));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user