Fix saving MPC files.

This fixes the issue reported at #624.
This commit is contained in:
Tsuda Kageyu
2015-11-27 00:52:44 +09:00
parent cbc279b899
commit 083eadec60
3 changed files with 114 additions and 97 deletions

View File

@ -24,6 +24,7 @@ class TestMPC : public CppUnit::TestFixture
CPPUNIT_TEST(testFuzzedFile3);
CPPUNIT_TEST(testFuzzedFile4);
CPPUNIT_TEST(testStripAndProperties);
CPPUNIT_TEST(testRepeatedSave);
CPPUNIT_TEST_SUITE_END();
public:
@ -132,6 +133,32 @@ public:
}
}
void testRepeatedSave()
{
ScopedFileCopy copy("click", ".mpc");
{
MPC::File f(copy.fileName().c_str());
CPPUNIT_ASSERT(!f.hasAPETag());
CPPUNIT_ASSERT(!f.hasID3v1Tag());
f.APETag(true)->setTitle("01234 56789 ABCDE FGHIJ");
f.save();
f.APETag()->setTitle("0");
f.save();
f.ID3v1Tag(true)->setTitle("01234 56789 ABCDE FGHIJ");
f.APETag()->setTitle("01234 56789 ABCDE FGHIJ 01234 56789 ABCDE FGHIJ 01234 56789");
f.save();
}
{
MPC::File f(copy.fileName().c_str());
CPPUNIT_ASSERT(f.hasAPETag());
CPPUNIT_ASSERT(f.hasID3v1Tag());
}
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestMPC);