#![allow(clippy::unwrap_used, reason = "allow in test files")]
#![allow(clippy::undocumented_unsafe_blocks, reason = "allow in test files")]
use super::*;
#[test]
fn mvgof_struct_fields() {
let level_count = 2;
let width = NonZeroUsize::new(64).unwrap();
let height = NonZeroUsize::new(48).unwrap();
let pel = Subpel::Full;
let hpad = 8;
let vpad = 8;
let yuv_mode = MVPlaneSet::YPLANE;
let x_ratio_uv = NonZeroU8::new(1).unwrap();
let y_ratio_uv = NonZeroU8::new(1).unwrap();
let bits_per_sample = NonZeroU8::new(8).unwrap();
let pitch = (
NonZeroUsize::new(80).unwrap(),
Some(NonZeroUsize::new(80).unwrap()),
Some(NonZeroUsize::new(80).unwrap()),
);
let result = MVGroupOfFrames::new(
level_count,
width,
height,
pel,
hpad,
vpad,
yuv_mode,
x_ratio_uv,
y_ratio_uv,
bits_per_sample,
pitch,
1,
);
assert!(result.is_ok(), "Should create MVGroupOfFrames successfully");
let gof = result.unwrap();
assert_eq!(gof.level_count, level_count);
assert_eq!(gof.frames.len(), level_count);
assert_eq!(gof.pel, pel);
assert_eq!(gof.x_ratio_uv, x_ratio_uv);
assert_eq!(gof.y_ratio_uv, y_ratio_uv);
assert_eq!(gof.width[0], width);
assert_eq!(gof.height[0], height);
assert_eq!(gof.hpad[0], hpad);
assert_eq!(gof.vpad[0], vpad);
assert!(!gof.frames.is_empty());
for frame in &gof.frames {
assert!(!frame.planes.is_empty(), "Each frame should have planes");
}
}
#[test]
fn mvgof_different_level_counts() {
for level_count in [1, 2, 3, 5] {
let width = NonZeroUsize::new(64).unwrap();
let height = NonZeroUsize::new(48).unwrap();
let pel = Subpel::Full;
let hpad = 8;
let vpad = 8;
let yuv_mode = MVPlaneSet::YPLANE;
let x_ratio_uv = NonZeroU8::new(1).unwrap();
let y_ratio_uv = NonZeroU8::new(1).unwrap();
let bits_per_sample = NonZeroU8::new(8).unwrap();
let pitch = (
NonZeroUsize::new(80).unwrap(),
Some(NonZeroUsize::new(80).unwrap()),
Some(NonZeroUsize::new(80).unwrap()),
);
let result = MVGroupOfFrames::new(
level_count,
width,
height,
pel,
hpad,
vpad,
yuv_mode,
x_ratio_uv,
y_ratio_uv,
bits_per_sample,
pitch,
1,
);
assert!(result.is_ok(), "Should create with {} levels", level_count);
let gof = result.unwrap();
assert_eq!(gof.frames.len(), level_count);
assert_eq!(gof.level_count, level_count);
}
}