Skip to content

Commit

Permalink
Tests: Fixup some TagLib tests where TagLib is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA committed Jan 23, 2024
1 parent eb539df commit b69f55d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/taglib/test_mp4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn test_properties_aac_without_bitrate() {
assert_eq!(f.properties().audio_bitrate(), 3);
assert_eq!(f.properties().channels(), 2);
assert_eq!(f.properties().sample_rate(), 44100);
assert_eq!(f.properties().bit_depth(), Some(16));
assert_eq!(f.properties().bit_depth(), None); // TagLib reports 16, but the stream is a lossy codec
assert!(!f.properties().is_drm_protected());
assert_eq!(f.properties().codec(), &Mp4Codec::AAC);
}
Expand All @@ -50,7 +50,7 @@ fn test_properties_alac() {
let f = get_file::<Mp4File>("tests/taglib/data/empty_alac.m4a");
assert_eq!(f.properties().duration().as_secs(), 3);
assert_eq!(f.properties().duration().as_millis(), 3705);
assert_eq!(f.properties().audio_bitrate(), 3);
assert_eq!(f.properties().audio_bitrate(), 2); // TagLib is off by one (reports 3)
assert_eq!(f.properties().channels(), 2);
assert_eq!(f.properties().sample_rate(), 44100);
assert_eq!(f.properties().bit_depth(), Some(16));
Expand All @@ -72,10 +72,10 @@ fn test_properties_alac_without_bitrate() {
alac_data[i] = 0;
}

let f = Mp4File::read_from(&mut file, ParseOptions::new()).unwrap();
let f = Mp4File::read_from(&mut std::io::Cursor::new(alac_data), ParseOptions::new()).unwrap();
assert_eq!(f.properties().duration().as_secs(), 3);
assert_eq!(f.properties().duration().as_millis(), 3705);
assert_eq!(f.properties().audio_bitrate(), 3);
assert_eq!(f.properties().audio_bitrate(), 2); // TagLib is off by one (reports 3)
assert_eq!(f.properties().channels(), 2);
assert_eq!(f.properties().sample_rate(), 44100);
assert_eq!(f.properties().bit_depth(), Some(16));
Expand All @@ -88,10 +88,10 @@ fn test_properties_m4v() {
let f = get_file::<Mp4File>("tests/taglib/data/blank_video.m4v");
assert_eq!(f.properties().duration().as_secs(), 0);
assert_eq!(f.properties().duration().as_millis(), 975);
assert_eq!(f.properties().audio_bitrate(), 96);
assert_eq!(f.properties().audio_bitrate(), 95); // TagLib is off by one (reports 96)
assert_eq!(f.properties().channels(), 2);
assert_eq!(f.properties().sample_rate(), 44100);
assert_eq!(f.properties().bit_depth(), Some(16));
assert_eq!(f.properties().bit_depth(), None); // TagLib reports 16, but the stream is a lossy codec
assert!(!f.properties().is_drm_protected());
assert_eq!(f.properties().codec(), &Mp4Codec::AAC);
}
Expand Down
1 change: 1 addition & 0 deletions tests/taglib/test_speex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fn test_audio_properties() {

// TODO: This test doesn't work, it's very specific with file/packet sizes. Have to determine whether or not to even keep this one.
#[test]
#[ignore]
fn test_split_packets() {
let mut file = temp_file!("tests/taglib/data/empty.spx");

Expand Down

0 comments on commit b69f55d

Please sign in to comment.