From 79bb1428c0482966cdafd9b6e1127e98b4637fbf Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Fri, 17 May 2019 13:15:48 +0200 Subject: Support ID3v2 GRP1 frame introduced with iTunes 12.5.4.42, #903. (#904) --- tests/test_id3v2.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests') diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index 7d94af06..8c6f67dc 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -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(factory->createFrame(frameDataGrp1)); + CPPUNIT_ASSERT(parsedFrameGrp1); + CPPUNIT_ASSERT_EQUAL(String("Grouping"), parsedFrameGrp1->toString()); + + tag.addFrame(parsedFrameGrp1); + } + void testDeleteFrame() { ScopedFileCopy copy("rare_frames", ".mp3"); -- cgit v1.2.3