Support for ID3v2.2 PIC frames

Patch by Marc Halbruegge
BUG:167786


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994836 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Lukáš Lalinský
2009-07-11 14:27:17 +00:00
parent 39e6891c92
commit 0f11c5ab0c
4 changed files with 94 additions and 9 deletions

View File

@ -38,6 +38,7 @@ class TestID3v2 : public CppUnit::TestFixture
CPPUNIT_TEST(testReadStringField);
CPPUNIT_TEST(testParseAPIC);
CPPUNIT_TEST(testParseAPIC_UTF16_BOM);
CPPUNIT_TEST(testParseAPICv22);
CPPUNIT_TEST(testParseGEOB);
CPPUNIT_TEST(testPOPMtoString);
CPPUNIT_TEST(testParsePOPM);
@ -132,6 +133,25 @@ public:
CPPUNIT_ASSERT_EQUAL(ByteVector("\xff\xd8\xff", 3), f.picture());
}
void testParseAPICv22()
{
ID3v2::FrameFactory *factory = ID3v2::FrameFactory::instance();
ByteVector data = ByteVector("PIC"
"\x00\x00\x08"
"\x00"
"JPG"
"\x01"
"d\x00"
"\x00", 18);
ID3v2::AttachedPictureFrame *frame =
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, TagLib::uint(2)));
CPPUNIT_ASSERT(frame);
CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), frame->mimeType());
CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::FileIcon, frame->type());
CPPUNIT_ASSERT_EQUAL(String("d"), frame->description());
}
// http://bugs.kde.org/show_bug.cgi?id=151078
void testParseGEOB()
{