Skip to content

Commit ec4e66f

Browse files
committed
OGG: Add a test for #130
1 parent 87686ac commit ec4e66f

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v2
2323
- name: Dependencies
24-
run: sudo apt-get update && sudo apt-get install -y ffmpeg # Need ffprobe for issue #37
24+
- run: sudo apt-get update && sudo apt-get install -y ffmpeg # Need ffprobe for issue #37
25+
- run: sudo apt-get install -y opus-tools # Need opusinfo for issue #130
2526
- uses: actions-rs/toolchain@v1
2627
with:
2728
profile: minimal

src/tag/mod.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,35 @@ mod tests {
689689
);
690690
}
691691

692+
#[test]
693+
fn issue_130_huge_picture() {
694+
let file_contents = read_path("tests/files/assets/minimal/full_test.opus");
695+
let mut temp_file = tempfile::NamedTempFile::new().unwrap();
696+
temp_file.write_all(&file_contents).unwrap();
697+
temp_file.rewind().unwrap();
698+
699+
let mut tag = Tag::new(TagType::VorbisComments);
700+
701+
// 81KB picture, which is big enough to surpass the maximum page size
702+
let mut picture =
703+
Picture::from_reader(&mut &*read_path("tests/files/assets/issue_37.jpg")).unwrap();
704+
picture.set_pic_type(PictureType::CoverFront);
705+
706+
tag.push_picture(picture);
707+
tag.save_to(temp_file.as_file_mut()).unwrap();
708+
709+
let cmd_output = Command::new("opusinfo")
710+
.arg(temp_file.path().to_str().unwrap())
711+
.output()
712+
.unwrap();
713+
714+
assert!(cmd_output.status.success());
715+
716+
let stderr = String::from_utf8(cmd_output.stderr).unwrap();
717+
718+
assert!(!stderr.contains("WARNING:"));
719+
}
720+
692721
#[test]
693722
fn insert_empty() {
694723
let mut tag = Tag::new(TagType::ID3v2);

0 commit comments

Comments
 (0)