Skip to content

Commit b693c7e

Browse files
committed
Fix read_colr unit tests for the per-colour_type signature change
The per-colour_type colr change made read_colr take colour_type as an argument that the caller reads first, but the read_colr_nclx and read_colr_nclx_missing_full_range_flag tests, merged from the nclx full_range_flag tolerance change, still called it with the old two-argument signature, breaking the lib test build. Read colour_type from the box before each call, mirroring read_ipco and read_video_sample_entry.
1 parent c049244 commit b693c7e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

mp4parse/src/tests.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,8 @@ fn read_colr_nclx() {
16421642
let mut iter = super::BoxIter::new(&mut stream);
16431643
let mut stream = iter.next_box().unwrap().unwrap();
16441644
assert_eq!(stream.head.name, super::BoxType::ColourInformationBox);
1645-
match super::read_colr(&mut stream, ParseStrictness::Strict).unwrap() {
1645+
let colour_type = super::be_u32(&mut stream).unwrap().to_be_bytes();
1646+
match super::read_colr(&mut stream, colour_type, ParseStrictness::Strict).unwrap() {
16461647
super::ParsedColourInformation::Supported(super::ColourInformation::Nclx(nclx)) => {
16471648
assert_eq!(nclx.colour_primaries, 1);
16481649
assert_eq!(nclx.transfer_characteristics, 1);
@@ -1668,7 +1669,8 @@ fn read_colr_nclx_missing_full_range_flag() {
16681669
let mut stream = make_stream();
16691670
let mut iter = super::BoxIter::new(&mut stream);
16701671
let mut stream = iter.next_box().unwrap().unwrap();
1671-
let colr = super::read_colr(&mut stream, strictness)
1672+
let colour_type = super::be_u32(&mut stream).unwrap().to_be_bytes();
1673+
let colr = super::read_colr(&mut stream, colour_type, strictness)
16721674
.expect("nclx missing full_range_flag should parse outside Strict");
16731675
match colr {
16741676
super::ParsedColourInformation::Supported(super::ColourInformation::Nclx(nclx)) => {
@@ -1684,7 +1686,8 @@ fn read_colr_nclx_missing_full_range_flag() {
16841686
let mut stream = make_stream();
16851687
let mut iter = super::BoxIter::new(&mut stream);
16861688
let mut stream = iter.next_box().unwrap().unwrap();
1687-
match super::read_colr(&mut stream, ParseStrictness::Strict) {
1689+
let colour_type = super::be_u32(&mut stream).unwrap().to_be_bytes();
1690+
match super::read_colr(&mut stream, colour_type, ParseStrictness::Strict) {
16881691
Err(Error::InvalidData(s)) => assert_eq!(s, Status::ColrBadSize),
16891692
Ok(_) => panic!("nclx missing full_range_flag should be rejected under Strict"),
16901693
Err(e) => panic!("unexpected error {:?}", e),

0 commit comments

Comments
 (0)