MCPcopy Create free account
hub / github.com/RustCV/RustCV / fourcc_roundtrip

Function fourcc_roundtrip

rustcv-camera/src/pixel_format.rs:149–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147
148 #[test]
149 fn fourcc_roundtrip() {
150 // Verify that from_fourcc and to_fourcc are inverse operations.
151 // 验证 from_fourcc 和 to_fourcc 互为逆操作。
152 let formats = [
153 (PixelFormat::Mjpeg, fcc::MJPEG, "MJPG"),
154 (PixelFormat::Yuyv, fcc::YUYV, "YUYV"),
155 (PixelFormat::Nv12, fcc::NV12, "NV12"),
156 ];
157 for (fmt, expected_fcc, expected_str) in formats {
158 assert_eq!(fmt.to_fourcc(), expected_fcc);
159 assert_eq!(PixelFormat::from_fourcc(expected_fcc), fmt);
160 assert_eq!(fmt.fourcc_str(), expected_str);
161 }
162 }
163
164 #[test]
165 fn unknown_fourcc_preserved() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected