mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
Avoid writing duplicate tags when saving ASF files.
Reduce memory reallocations and copies when saving ASF files.
This commit is contained in:
@ -25,6 +25,7 @@ class TestASF : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testSavePicture);
|
||||
CPPUNIT_TEST(testSaveMultiplePictures);
|
||||
CPPUNIT_TEST(testProperties);
|
||||
CPPUNIT_TEST(testRepeatedSave);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -270,6 +271,21 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(StringList("3"), tags["DISCNUMBER"]);
|
||||
}
|
||||
|
||||
void testRepeatedSave()
|
||||
{
|
||||
ScopedFileCopy copy("silence-1", ".wma");
|
||||
|
||||
{
|
||||
ASF::File f(copy.fileName().c_str());
|
||||
f.tag()->setTitle(std::string(128 * 1024, 'X').c_str());
|
||||
f.save();
|
||||
CPPUNIT_ASSERT_EQUAL(297578L, f.length());
|
||||
f.tag()->setTitle(std::string(16 * 1024, 'X').c_str());
|
||||
f.save();
|
||||
CPPUNIT_ASSERT_EQUAL(68202L, f.length());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestASF);
|
||||
|
Reference in New Issue
Block a user