Fix handling of lowercase 'metadata_block_picture' fields in Vorbis comments.

Also refactored some redundant code for parsing pictures.
This commit is contained in:
Tsuda Kageyu
2016-11-11 00:07:32 +09:00
parent f9a747dceb
commit b98a984b66
3 changed files with 71 additions and 69 deletions

Binary file not shown.

View File

@ -47,6 +47,7 @@ class TestXiphComment : public CppUnit::TestFixture
CPPUNIT_TEST(testClearComment);
CPPUNIT_TEST(testRemoveFields);
CPPUNIT_TEST(testPicture);
CPPUNIT_TEST(testLowercaseFields);
CPPUNIT_TEST_SUITE_END();
public:
@ -192,6 +193,23 @@ public:
}
}
void testLowercaseFields()
{
const ScopedFileCopy copy("lowercase-fields", ".ogg");
{
Vorbis::File f(copy.fileName().c_str());
List<FLAC::Picture *> lst = f.tag()->pictureList();
CPPUNIT_ASSERT_EQUAL(String("TEST TITLE"), f.tag()->title());
CPPUNIT_ASSERT_EQUAL(String("TEST ARTIST"), f.tag()->artist());
CPPUNIT_ASSERT_EQUAL((unsigned int)1, lst.size());
f.save();
}
{
Vorbis::File f(copy.fileName().c_str());
CPPUNIT_ASSERT(f.find("METADATA_BLOCK_PICTURE") > 0);
}
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestXiphComment);