mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-13 22:22:31 +00:00
Add conversion tests
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
parent
b80d8a062f
commit
fb531877ac
1 changed files with 34 additions and 0 deletions
34
tests/conversions.rs
Normal file
34
tests/conversions.rs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
use lofty::{OggFormat, Tag, TagType, Id3Format};
|
||||||
|
|
||||||
|
macro_rules! convert_tag {
|
||||||
|
($tag: ident) => {
|
||||||
|
assert_eq!($tag.title(), Some("Title Updated"));
|
||||||
|
assert_eq!($tag.artist_str(), Some("Artist Updated"));
|
||||||
|
assert_eq!($tag.album_artist_str(), Some("Album Artist Updated"));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_conversions() {
|
||||||
|
let mut tag = Tag::new().read_from_path("tests/assets/a.mp3").unwrap();
|
||||||
|
|
||||||
|
tag.set_title("Title Updated");
|
||||||
|
tag.set_artist("Artist Updated");
|
||||||
|
tag.set_album_artist("Album Artist Updated");
|
||||||
|
convert_tag!(tag);
|
||||||
|
|
||||||
|
let tag = tag.to_dyn_tag(TagType::Ape);
|
||||||
|
convert_tag!(tag);
|
||||||
|
|
||||||
|
let tag = tag.to_dyn_tag(TagType::Mp4);
|
||||||
|
convert_tag!(tag);
|
||||||
|
|
||||||
|
let tag = tag.to_dyn_tag(TagType::RiffInfo);
|
||||||
|
convert_tag!(tag);
|
||||||
|
|
||||||
|
let tag = tag.to_dyn_tag(TagType::Ogg(OggFormat::Vorbis));
|
||||||
|
convert_tag!(tag);
|
||||||
|
|
||||||
|
let tag = tag.to_dyn_tag(TagType::Id3v2(Id3Format::Form));
|
||||||
|
convert_tag!(tag);
|
||||||
|
}
|
Loading…
Reference in a new issue