Added test
This commit is contained in:
37
src/meta.rs
37
src/meta.rs
@@ -1030,5 +1030,42 @@ mod tests {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_remove_picture() {
|
||||||
|
let filename = util::get_filename(1);
|
||||||
|
let dir = String::from(util::TESTFILEDIRECTORY);
|
||||||
|
|
||||||
|
let temp_file = tempfile::tempdir().expect("Could not create test directory");
|
||||||
|
let test_dir = String::from(temp_file.path().to_str().unwrap());
|
||||||
|
let test_filename = String::from("track09.flac");
|
||||||
|
let new_filepath = get_full_path(&test_dir, &test_filename).unwrap();
|
||||||
|
|
||||||
|
// let new_coverart = String::from("Sample Tracks 3 - Other one.png");
|
||||||
|
// let new_cover_art_path = get_full_path(&dir, &new_coverart).unwrap();
|
||||||
|
|
||||||
|
match file_exists(&dir, &filename) {
|
||||||
|
Ok(_) => {
|
||||||
|
let filepath = get_full_path(&dir, &filename).unwrap();
|
||||||
|
|
||||||
|
match util::copy_file(&filepath, &new_filepath) {
|
||||||
|
Ok(_o) => match coverart::remove_coverart(&new_filepath) {
|
||||||
|
Ok(bytes) => {
|
||||||
|
assert_eq!(false, bytes.is_empty(), "This should not be empty");
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {:?}", err);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {:?}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: File does not exist {:?}", err.to_string());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user