Add FLAC::Picture support to Xiph Comment

This commit is contained in:
Sander Jansen
2015-05-16 14:10:24 -05:00
parent 7bbf5a2e79
commit 0c14bd0ed0
3 changed files with 130 additions and 11 deletions

View File

@ -21,6 +21,7 @@ class TestOGG : public CppUnit::TestFixture
CPPUNIT_TEST(testDictInterface1);
CPPUNIT_TEST(testDictInterface2);
CPPUNIT_TEST(testAudioProperties);
CPPUNIT_TEST(testPicture);
CPPUNIT_TEST_SUITE_END();
public:
@ -134,6 +135,33 @@ public:
CPPUNIT_ASSERT_EQUAL(112000, f.audioProperties()->bitrateNominal());
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrateMinimum());
}
void testPicture()
{
ScopedFileCopy copy("empty", ".ogg");
string newname = copy.fileName();
Vorbis::File *f = new Vorbis::File(newname.c_str());
FLAC::Picture *newpic = new FLAC::Picture();
newpic->setType(FLAC::Picture::BackCover);
newpic->setWidth(5);
newpic->setHeight(6);
newpic->setColorDepth(16);
newpic->setNumColors(7);
newpic->setMimeType("image/jpeg");
newpic->setDescription("new image");
newpic->setData("JPEG data");
f->tag()->addPicture(newpic);
f->save();
delete f;
f = new Vorbis::File(newname.c_str());
List<FLAC::Picture *> lst = f->tag()->pictureList();
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), lst.size());
delete f;
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestOGG);