Add isEmpty() to MP4

Closes #457
This commit is contained in:
Scott Wheeler 2015-05-18 20:30:19 +02:00
parent d248f77ab9
commit 451d23ca37
3 changed files with 20 additions and 0 deletions

View File

@ -760,6 +760,11 @@ MP4::Tag::setTrack(uint value)
d->items["trkn"] = MP4::Item(value, 0);
}
bool MP4::Tag::isEmpty() const
{
return d->items.isEmpty();
}
MP4::ItemListMap &
MP4::Tag::itemListMap()
{

View File

@ -65,6 +65,8 @@ namespace TagLib {
void setYear(uint value);
void setTrack(uint value);
virtual bool isEmpty() const;
ItemListMap &itemListMap();
PropertyMap properties() const;

View File

@ -19,6 +19,7 @@ class TestMP4 : public CppUnit::TestFixture
CPPUNIT_TEST(testPropertiesALAC);
CPPUNIT_TEST(testFreeForm);
CPPUNIT_TEST(testCheckValid);
CPPUNIT_TEST(testIsEmpty);
CPPUNIT_TEST(testUpdateStco);
CPPUNIT_TEST(testSaveExisingWhenIlstIsLast);
CPPUNIT_TEST(test64BitAtom);
@ -62,6 +63,18 @@ public:
CPPUNIT_ASSERT(f2.isValid());
}
void testIsEmpty()
{
MP4::Tag t1;
CPPUNIT_ASSERT(t1.isEmpty());
t1.setArtist("Foo");
CPPUNIT_ASSERT(!t1.isEmpty());
MP4::Tag t2;
t2.itemListMap()["foo"] = "bar";
CPPUNIT_ASSERT(!t2.isEmpty());
}
void testUpdateStco()
{
ScopedFileCopy copy("no-tags", ".3g2");