mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Fix parsing of TXXX frame without description (#1069)
This commit is contained in:
parent
8aa7dd81d8
commit
bc5e56d3eb
@ -220,7 +220,7 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
|
||||
|
||||
unsigned short firstBom = 0;
|
||||
for(ByteVectorList::ConstIterator it = l.begin(); it != l.end(); it++) {
|
||||
if(!(*it).isEmpty()) {
|
||||
if(!it->isEmpty() || (it == l.begin() && frameID() == "TXXX")) {
|
||||
if(d->textEncoding == String::Latin1) {
|
||||
d->fieldList.append(Tag::latin1StringHandler()->parse(*it));
|
||||
}
|
||||
|
@ -112,6 +112,8 @@ class TestID3v2 : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testRenderPodcastFrame);
|
||||
CPPUNIT_TEST(testParsePrivateFrame);
|
||||
CPPUNIT_TEST(testRenderPrivateFrame);
|
||||
CPPUNIT_TEST(testParseUserTextIdentificationFrame);
|
||||
CPPUNIT_TEST(testRenderUserTextIdentificationFrame);
|
||||
CPPUNIT_TEST(testSaveUTF16Comment);
|
||||
CPPUNIT_TEST(testUpdateGenre23_1);
|
||||
CPPUNIT_TEST(testUpdateGenre23_2);
|
||||
@ -841,6 +843,51 @@ public:
|
||||
f.render());
|
||||
}
|
||||
|
||||
void testParseUserTextIdentificationFrame()
|
||||
{
|
||||
ID3v2::UserTextIdentificationFrame frameWithoutDescription(
|
||||
ByteVector("TXXX"
|
||||
"\x00\x00\x00\x06"
|
||||
"\x00\x00\x00"
|
||||
"\x00"
|
||||
"Text", 16));
|
||||
CPPUNIT_ASSERT_EQUAL(String(""), frameWithoutDescription.description());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Text"), frameWithoutDescription.fieldList()[1]);
|
||||
|
||||
ID3v2::UserTextIdentificationFrame frameWithDescription(
|
||||
ByteVector("TXXX"
|
||||
"\x00\x00\x00\x11"
|
||||
"\x00\x00\x00"
|
||||
"Description\x00"
|
||||
"Text", 27));
|
||||
CPPUNIT_ASSERT_EQUAL(String("Description"), frameWithDescription.description());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Text"), frameWithDescription.fieldList()[1]);
|
||||
}
|
||||
|
||||
void testRenderUserTextIdentificationFrame()
|
||||
{
|
||||
ID3v2::UserTextIdentificationFrame f;
|
||||
f.setDescription("");
|
||||
f.setText("Text");
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
ByteVector("TXXX"
|
||||
"\x00\x00\x00\x06"
|
||||
"\x00\x00\x00"
|
||||
"\x00"
|
||||
"Text", 16),
|
||||
f.render());
|
||||
|
||||
f.setDescription("Description");
|
||||
f.setText("Text");
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
ByteVector("TXXX"
|
||||
"\x00\x00\x00\x11"
|
||||
"\x00\x00\x00"
|
||||
"Description\x00"
|
||||
"Text", 27),
|
||||
f.render());
|
||||
}
|
||||
|
||||
void testItunes24FrameSize()
|
||||
{
|
||||
MPEG::File f(TEST_FILE_PATH_C("005411.id3"), false);
|
||||
|
Loading…
Reference in New Issue
Block a user