int flags = data.mid(pos + 8, 4).toUInt();
if(name != "data") {
debug("MP4: Unexpected atom \"" + name + "\", expecting \"data\"");
- return;
+ break;
}
if(flags == MP4::CoverArt::PNG || flags == MP4::CoverArt::JPEG) {
value.append(MP4::CoverArt(MP4::CoverArt::Format(flags),
CPPUNIT_TEST(testGnre);
CPPUNIT_TEST(testCovrRead);
CPPUNIT_TEST(testCovrWrite);
+ CPPUNIT_TEST(testCovrRead2);
CPPUNIT_TEST_SUITE_END();
public:
{
MP4::File *f = new MP4::File("data/gnre.m4a");
CPPUNIT_ASSERT_EQUAL(TagLib::String("Ska"), f->tag()->genre());
+ delete f;
}
void testCovrRead()
CPPUNIT_ASSERT_EQUAL(TagLib::uint(79), l[0].data().size());
CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::JPEG, l[1].format());
CPPUNIT_ASSERT_EQUAL(TagLib::uint(287), l[1].data().size());
+ delete f;
}
void testCovrWrite()
delete f;
}
+ void testCovrRead2()
+ {
+ MP4::File *f = new MP4::File("data/covr-junk.m4a");
+ CPPUNIT_ASSERT(f->tag()->itemListMap().contains("covr"));
+ MP4::CoverArtList l = f->tag()->itemListMap()["covr"].toCoverArtList();
+ CPPUNIT_ASSERT_EQUAL(TagLib::uint(2), l.size());
+ CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::PNG, l[0].format());
+ CPPUNIT_ASSERT_EQUAL(TagLib::uint(79), l[0].data().size());
+ CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::JPEG, l[1].format());
+ CPPUNIT_ASSERT_EQUAL(TagLib::uint(287), l[1].data().size());
+ delete f;
+ }
+
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestMP4);
class ScopedFileCopy
{
public:
- ScopedFileCopy(const string &filename, const string &ext)
+ ScopedFileCopy(const string &filename, const string &ext, bool deleteFile=true)
{
+ m_deleteFile = deleteFile;
m_filename = copyFile(filename, ext);
}
~ScopedFileCopy()
{
- deleteFile(m_filename);
+ if(m_deleteFile)
+ deleteFile(m_filename);
}
string fileName()
}
private:
+ bool m_deleteFile;
string m_filename;
};