aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUrs Fleisch <ufleisch@users.sourceforge.net>2020-12-30 10:37:11 +0100
committerUrs Fleisch <ufleisch@users.sourceforge.net>2020-12-30 17:37:54 +0100
commitd602ae483ee4ec9115c392a09b841e63d84518a7 (patch)
tree18a7357f336dab2fe80805e9b373e68c5f9af76d /tests
parent30d839538d4330f63e9e21e26bcdfb331b802740 (diff)
Read ID3v2.3 genres with multiple references to ID3v1 genres (#988)
As described in id3v2.3.0.txt (4.2.1, TCON), now multiple genres are possible, e.g. "(51)(39)". Additionally, support the keywords RX and CR.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_id3v2.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp
index dd260c0f..d202191e 100644
--- a/tests/test_id3v2.cpp
+++ b/tests/test_id3v2.cpp
@@ -101,6 +101,7 @@ class TestID3v2 : public CppUnit::TestFixture
CPPUNIT_TEST(testSaveUTF16Comment);
CPPUNIT_TEST(testUpdateGenre23_1);
CPPUNIT_TEST(testUpdateGenre23_2);
+ CPPUNIT_TEST(testUpdateGenre23_3);
CPPUNIT_TEST(testUpdateGenre24);
CPPUNIT_TEST(testUpdateDate22);
CPPUNIT_TEST(testDowngradeTo23);
@@ -686,7 +687,7 @@ public:
// "Refinement" is different from the ID3v1 genre
ID3v2::FrameFactory *factory = ID3v2::FrameFactory::instance();
ByteVector data = ByteVector("TCON" // Frame ID
- "\x00\x00\x00\x13" // Frame size
+ "\x00\x00\x00\x0d" // Frame size
"\x00\x00" // Frame flags
"\x00" // Encoding
"(4)Eurodisco", 23); // Text
@@ -703,6 +704,29 @@ public:
CPPUNIT_ASSERT_EQUAL(String("Disco Eurodisco"), tag.genre());
}
+ void testUpdateGenre23_3()
+ {
+ // Multiple references and a refinement
+ ID3v2::FrameFactory *factory = ID3v2::FrameFactory::instance();
+ ByteVector data = ByteVector("TCON" // Frame ID
+ "\x00\x00\x00\x15" // Frame size
+ "\x00\x00" // Frame flags
+ "\x00" // Encoding
+ "(9)(138)Viking Metal", 31); // Text
+ ID3v2::Header header;
+ header.setMajorVersion(3);
+ ID3v2::TextIdentificationFrame *frame =
+ dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
+ CPPUNIT_ASSERT_EQUAL(3U, frame->fieldList().size());
+ CPPUNIT_ASSERT_EQUAL(String("9"), frame->fieldList()[0]);
+ CPPUNIT_ASSERT_EQUAL(String("138"), frame->fieldList()[1]);
+ CPPUNIT_ASSERT_EQUAL(String("Viking Metal"), frame->fieldList()[2]);
+
+ ID3v2::Tag tag;
+ tag.addFrame(frame);
+ CPPUNIT_ASSERT_EQUAL(String("Metal Black Metal Viking Metal"), tag.genre());
+ }
+
void testUpdateGenre24()
{
ID3v2::FrameFactory *factory = ID3v2::FrameFactory::instance();