Support ID3v2 GRP1 frame introduced with iTunes 12.5.4.42, #903. (#904)

This commit is contained in:
Urs Fleisch
2019-05-17 13:15:48 +02:00
committed by Stephen F. Booth
parent 7470f92a67
commit 79bb1428c0
3 changed files with 36 additions and 6 deletions

View File

@ -110,6 +110,7 @@ class TestID3v2 : public CppUnit::TestFixture
CPPUNIT_TEST(testPropertyInterface);
CPPUNIT_TEST(testPropertyInterface2);
CPPUNIT_TEST(testPropertiesMovement);
CPPUNIT_TEST(testPropertyGrouping);
CPPUNIT_TEST(testDeleteFrame);
CPPUNIT_TEST(testSaveAndStripID3v1ShouldNotAddFrameFromID3v1ToId3v2);
CPPUNIT_TEST(testParseChapterFrame);
@ -966,6 +967,33 @@ public:
tag.addFrame(parsedFrameMvin);
}
void testPropertyGrouping()
{
ID3v2::Tag tag;
ID3v2::TextIdentificationFrame *frameGrp1 = new ID3v2::TextIdentificationFrame("GRP1");
frameGrp1->setText("Grouping");
tag.addFrame(frameGrp1);
PropertyMap properties = tag.properties();
CPPUNIT_ASSERT(properties.contains("GROUPING"));
CPPUNIT_ASSERT_EQUAL(String("Grouping"), properties["GROUPING"].front());
ByteVector frameDataGrp1("GRP1"
"\x00\x00\x00\x09"
"\x00\x00"
"\x00"
"Grouping", 19);
CPPUNIT_ASSERT_EQUAL(frameDataGrp1, frameGrp1->render());
ID3v2::FrameFactory *factory = ID3v2::FrameFactory::instance();
ID3v2::TextIdentificationFrame *parsedFrameGrp1 =
dynamic_cast<ID3v2::TextIdentificationFrame *>(factory->createFrame(frameDataGrp1));
CPPUNIT_ASSERT(parsedFrameGrp1);
CPPUNIT_ASSERT_EQUAL(String("Grouping"), parsedFrameGrp1->toString());
tag.addFrame(parsedFrameGrp1);
}
void testDeleteFrame()
{
ScopedFileCopy copy("rare_frames", ".mp3");