diff --git a/tests/picture/format_parsers.rs b/tests/picture/format_parsers.rs index f35b44e4..d69b0699 100644 --- a/tests/picture/format_parsers.rs +++ b/tests/picture/format_parsers.rs @@ -1,4 +1,4 @@ -use lofty::id3::v2::ID3v2Version; +use lofty::id3::v2::{AttachedPictureFrame, ID3v2Version}; use lofty::{Picture, PictureInformation, PictureType, TextEncoding}; use std::fs::File; @@ -28,9 +28,9 @@ fn create_original_picture() -> Picture { fn id3v24_apic() { let buf = get_buf("tests/picture/assets/png_640x628.apic"); - let (pic, _) = Picture::from_apic_bytes(&buf, ID3v2Version::V4).unwrap(); + let apic = AttachedPictureFrame::parse(&buf, ID3v2Version::V4).unwrap(); - assert_eq!(create_original_picture(), pic); + assert_eq!(create_original_picture(), apic.picture); } #[test] @@ -38,10 +38,12 @@ fn as_apic_bytes() { let buf = get_buf("tests/picture/assets/png_640x628.apic"); let original_picture = create_original_picture(); + let apic = AttachedPictureFrame { + encoding: TextEncoding::Latin1, + picture: original_picture, + }; - let original_as_apic = original_picture - .as_apic_bytes(ID3v2Version::V4, TextEncoding::Latin1) - .unwrap(); + let original_as_apic = apic.as_bytes(ID3v2Version::V4).unwrap(); assert_eq!(buf, original_as_apic); } @@ -50,9 +52,9 @@ fn as_apic_bytes() { fn id3v22_pic() { let buf = get_buf("tests/picture/assets/png_640x628.pic"); - let (pic, _) = Picture::from_apic_bytes(&buf, ID3v2Version::V2).unwrap(); + let pic = AttachedPictureFrame::parse(&buf, ID3v2Version::V2).unwrap(); - assert_eq!(create_original_picture(), pic); + assert_eq!(create_original_picture(), pic.picture); } #[test] @@ -60,10 +62,12 @@ fn as_apic_bytes_v2() { let buf = get_buf("tests/picture/assets/png_640x628.pic"); let original_picture = create_original_picture(); + let pic = AttachedPictureFrame { + encoding: TextEncoding::Latin1, + picture: original_picture, + }; - let original_as_pic = original_picture - .as_apic_bytes(ID3v2Version::V2, TextEncoding::Latin1) - .unwrap(); + let original_as_pic = pic.as_bytes(ID3v2Version::V2).unwrap(); assert_eq!(buf, original_as_pic); } diff --git a/tests/tags/conversions.rs b/tests/tags/conversions.rs index 18e3b9c3..085652f7 100644 --- a/tests/tags/conversions.rs +++ b/tests/tags/conversions.rs @@ -1,6 +1,6 @@ // Tests for special case conversions -use lofty::id3::v2::{Frame, FrameFlags, FrameValue, ID3v2Tag, LanguageFrame}; +use lofty::id3::v2::{CommentFrame, Frame, FrameFlags, ID3v2Tag, UnsynchronizedTextFrame}; use lofty::{ItemKey, Tag, TagType, TextEncoding}; #[test] @@ -15,12 +15,12 @@ fn tag_to_id3v2_lang_frame() { id3.get("USLT"), Frame::new( "USLT", - FrameValue::UnSyncText(LanguageFrame { + UnsynchronizedTextFrame { encoding: TextEncoding::UTF8, language: *b"eng", description: String::new(), content: String::from("Test lyrics") - }), + }, FrameFlags::default() ) .ok() @@ -31,12 +31,12 @@ fn tag_to_id3v2_lang_frame() { id3.get("COMM"), Frame::new( "COMM", - FrameValue::Comment(LanguageFrame { + CommentFrame { encoding: TextEncoding::UTF8, language: *b"eng", description: String::new(), content: String::from("Test comment") - }), + }, FrameFlags::default() ) .ok()