Skip to content

Commit

Permalink
Tests: Add ignored TagLib OGA FLAC tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA committed Mar 24, 2023
1 parent 4443714 commit ad7d4b3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
Binary file added tests/taglib/data/segfault.oga
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/taglib/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ mod test_id3v1;
mod test_info;
mod test_mp4;
mod test_mpeg;
mod test_ogaflac;
mod test_speex;
mod test_wav;
mod test_wavpack;
mod test_xiphcomment;
mod test_wav;
45 changes: 45 additions & 0 deletions tests/taglib/test_ogaflac.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
use crate::temp_file;
use lofty::flac::FlacFile;
use lofty::ogg::VorbisComments;
use lofty::{Accessor, AudioFile, ParseOptions};
use std::io::{Seek, SeekFrom};

#[test]
#[ignore] // TODO: We don't support FLAC in OGA
fn test_framing_bit() {
let mut file = temp_file!("tests/taglib/data/empty_flac.oga");

{
let mut f = FlacFile::read_from(&mut file, ParseOptions::new()).unwrap();
file.rewind().unwrap();

let mut vorbis_comments = VorbisComments::new();
vorbis_comments.set_artist(String::from("The Artist"));
f.set_vorbis_comments(vorbis_comments);
f.save_to(&mut file).unwrap();
}
file.rewind().unwrap();
{
let f = FlacFile::read_from(&mut file, ParseOptions::new()).unwrap();
assert_eq!(
f.vorbis_comments().unwrap().artist().as_deref(),
Some("The Artist")
);

assert_eq!(file.seek(SeekFrom::End(0)).unwrap(), 9134);
}
}

#[test]
#[ignore] // TODO
fn test_fuzzed_file() {
let mut file = temp_file!("tests/taglib/data/segfault.oga");
let f = FlacFile::read_from(&mut file, ParseOptions::new());
assert!(f.is_err());
}

#[test]
#[ignore]
fn test_split_packets() {
// Marker test, Lofty does not retain the packet information
}

0 comments on commit ad7d4b3

Please sign in to comment.