mirror of
https://github.com/taglib/taglib.git
synced 2025-07-19 05:24:25 -04:00
ID3v2 padding won't increase beyond 1% of the file size.
This commit is contained in:
@ -91,6 +91,7 @@ class TestID3v2 : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testRenderChapterFrame);
|
||||
CPPUNIT_TEST(testParseTableOfContentsFrame);
|
||||
CPPUNIT_TEST(testRenderTableOfContentsFrame);
|
||||
CPPUNIT_TEST(testShrinkPadding);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -1005,6 +1006,39 @@ public:
|
||||
f.render());
|
||||
}
|
||||
|
||||
void testShrinkPadding()
|
||||
{
|
||||
ScopedFileCopy copy("xing", ".mp3");
|
||||
string newname = copy.fileName();
|
||||
|
||||
{
|
||||
MPEG::File f(newname.c_str());
|
||||
ID3v2::Tag *tag = f.ID3v2Tag(true);
|
||||
|
||||
ID3v2::TextIdentificationFrame *frame1 = new ID3v2::TextIdentificationFrame("TIT2");
|
||||
frame1->setText("Title");
|
||||
tag->addFrame(frame1);
|
||||
|
||||
ID3v2::AttachedPictureFrame *frame2 = new ID3v2::AttachedPictureFrame();
|
||||
frame2->setPicture(ByteVector(100 * 1024, '\xff'));
|
||||
tag->addFrame(frame2);
|
||||
|
||||
f.save();
|
||||
CPPUNIT_ASSERT(f.length() > 100 * 1024);
|
||||
}
|
||||
|
||||
{
|
||||
MPEG::File f(newname.c_str());
|
||||
CPPUNIT_ASSERT_EQUAL(true, f.hasID3v2Tag());
|
||||
|
||||
ID3v2::Tag *tag = f.ID3v2Tag();
|
||||
tag->removeFrames("APIC");
|
||||
|
||||
f.save();
|
||||
CPPUNIT_ASSERT(f.length() < 10 * 1024);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestID3v2);
|
||||
|
Reference in New Issue
Block a user