Skip to content

Commit 96fe3b9

Browse files
committed
Tests: Add ignored TagLib OGA FLAC tests
1 parent 93130e5 commit 96fe3b9

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

tests/taglib/data/segfault.oga

120 Bytes
Binary file not shown.

tests/taglib/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ mod test_id3v1;
1010
mod test_info;
1111
mod test_mp4;
1212
mod test_mpeg;
13+
mod test_ogaflac;
1314
mod test_speex;
15+
mod test_wav;
1416
mod test_wavpack;
1517
mod test_xiphcomment;
16-
mod test_wav;

tests/taglib/test_ogaflac.rs

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
use crate::temp_file;
2+
use lofty::flac::FlacFile;
3+
use lofty::ogg::VorbisComments;
4+
use lofty::{Accessor, AudioFile, ParseOptions};
5+
use std::io::{Seek, SeekFrom};
6+
7+
#[test]
8+
#[ignore] // TODO: We don't support FLAC in OGA
9+
fn test_framing_bit() {
10+
let mut file = temp_file!("tests/taglib/data/empty_flac.oga");
11+
12+
{
13+
let mut f = FlacFile::read_from(&mut file, ParseOptions::new()).unwrap();
14+
file.rewind().unwrap();
15+
16+
let mut vorbis_comments = VorbisComments::new();
17+
vorbis_comments.set_artist(String::from("The Artist"));
18+
f.set_vorbis_comments(vorbis_comments);
19+
f.save_to(&mut file).unwrap();
20+
}
21+
file.rewind().unwrap();
22+
{
23+
let f = FlacFile::read_from(&mut file, ParseOptions::new()).unwrap();
24+
assert_eq!(
25+
f.vorbis_comments().unwrap().artist().as_deref(),
26+
Some("The Artist")
27+
);
28+
29+
assert_eq!(file.seek(SeekFrom::End(0)).unwrap(), 9134);
30+
}
31+
}
32+
33+
#[test]
34+
#[ignore] // TODO
35+
fn test_fuzzed_file() {
36+
let mut file = temp_file!("tests/taglib/data/segfault.oga");
37+
let f = FlacFile::read_from(&mut file, ParseOptions::new());
38+
assert!(f.is_err());
39+
}
40+
41+
#[test]
42+
#[ignore]
43+
fn test_split_packets() {
44+
// Marker test, Lofty does not retain the packet information
45+
}

0 commit comments

Comments
 (0)