Fix off-by-one error in MP4::Tag when looking for free padding to use

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@961160 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Lukáš Lalinský
2009-04-29 15:12:19 +00:00
parent f1a16bcf0f
commit 94a402395b
3 changed files with 26 additions and 3 deletions

BIN
tests/data/ilst-is-last.m4a Normal file

Binary file not shown.

View File

@ -17,6 +17,7 @@ class TestMP4 : public CppUnit::TestFixture
CPPUNIT_TEST(testProperties);
CPPUNIT_TEST(testFreeForm);
CPPUNIT_TEST(testUpdateStco);
CPPUNIT_TEST(testSaveExisingWhenIlstIsLast);
CPPUNIT_TEST_SUITE_END();
public:
@ -98,6 +99,25 @@ public:
deleteFile(filename);
}
void testSaveExisingWhenIlstIsLast()
{
string filename = copyFile("ilst-is-last", ".m4a");
MP4::File *f = new MP4::File(filename.c_str());
CPPUNIT_ASSERT_EQUAL(String("82,164"), f->tag()->itemListMap()["----:com.apple.iTunes:replaygain_track_minmax"].toStringList()[0]);
CPPUNIT_ASSERT_EQUAL(String("Pearl Jam"), f->tag()->artist());
f->tag()->setComment("foo");
f->save();
delete f;
f = new MP4::File(filename.c_str());
CPPUNIT_ASSERT_EQUAL(String("82,164"), f->tag()->itemListMap()["----:com.apple.iTunes:replaygain_track_minmax"].toStringList()[0]);
CPPUNIT_ASSERT_EQUAL(String("Pearl Jam"), f->tag()->artist());
CPPUNIT_ASSERT_EQUAL(String("foo"), f->tag()->comment());
deleteFile(filename);
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestMP4);