Read partially broken files
This commit is contained in:
BIN
tests/fixtures/attempt_1_broken.mp3
vendored
Normal file
BIN
tests/fixtures/attempt_1_broken.mp3
vendored
Normal file
Binary file not shown.
@ -75,6 +75,17 @@ fn test_successful_jpeg_image_embedding() {
|
||||
assert!(tag.pictures().count() > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_successful_jpeg_image_embedding_with_a_broken_file() {
|
||||
let song = Fixture::copy("attempt_1_broken.mp3");
|
||||
let image = Fixture::copy("attempt_1.jpg");
|
||||
|
||||
embed_image(&song, &image).unwrap();
|
||||
|
||||
let tag = read_tag(&song);
|
||||
assert!(tag.pictures().count() > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_successful_png_image_embedding() {
|
||||
let song = Fixture::copy("attempt_1_no_image.mp3");
|
||||
@ -122,6 +133,22 @@ fn test_removing_and_adding_an_image() {
|
||||
assert!(tag.pictures().count() > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_removing_and_adding_an_image_to_a_broken_file() {
|
||||
let song = Fixture::copy("attempt_1_broken.mp3");
|
||||
let image = Fixture::copy("attempt_1.jpg");
|
||||
|
||||
remove_images(&song).unwrap();
|
||||
|
||||
let tag = read_tag(&song);
|
||||
assert!(tag.pictures().count() == 0);
|
||||
|
||||
embed_image(&song, &image).unwrap();
|
||||
|
||||
let tag = read_tag(&song);
|
||||
assert!(tag.pictures().count() > 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extracting_a_jpg_image() {
|
||||
let song = Fixture::copy("attempt_1.mp3");
|
||||
@ -136,6 +163,16 @@ fn test_extracting_a_jpg_image() {
|
||||
assert!(image.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extracting_a_jpg_image_from_a_broken_file() {
|
||||
let song = Fixture::copy("attempt_1_broken.mp3");
|
||||
let image = Fixture::blank("attempt_1.jpg");
|
||||
|
||||
extract_first_image(&song, &image).unwrap();
|
||||
|
||||
assert!(image.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extracting_a_png_image() {
|
||||
let song = Fixture::copy("attempt_1.mp3");
|
||||
|
Reference in New Issue
Block a user