Merge remote-tracking branch 'correct/taglib2' into taglib2

This commit is contained in:
Sebastian Rachuj
2013-05-21 00:27:06 +02:00
48 changed files with 1782 additions and 1422 deletions

View File

@ -163,10 +163,6 @@ public:
CPPUNIT_ASSERT(n.toInt64LE(6) == -1268082884489200845ll);
CPPUNIT_ASSERT(n.toInt64BE(4) == 2497865822736504285ll);
// Shows the message "toNumber<T>() -- offset is out of range. Returning 0." 2 times.
CPPUNIT_ASSERT(n.toUInt32LE(13) == 0);
CPPUNIT_ASSERT(n.toUInt16BE(15) == 0);
CPPUNIT_ASSERT(ByteVector::fromUInt16LE(n.toInt16LE(5)) == n.mid(5, 2));
CPPUNIT_ASSERT(ByteVector::fromUInt16BE(n.toInt16BE(9)) == n.mid(9, 2));
CPPUNIT_ASSERT(ByteVector::fromUInt32LE(n.toUInt32LE(4)) == n.mid(4, 4));

View File

@ -37,6 +37,7 @@ public:
string newname = copy.fileName();
FileRef *f = new FileRef(newname.c_str());
CPPUNIT_ASSERT(f->isValid());
CPPUNIT_ASSERT(!f->isNull());
f->tag()->setArtist("test artist");
f->tag()->setTitle("test title");
@ -48,6 +49,7 @@ public:
delete f;
f = new FileRef(newname.c_str());
CPPUNIT_ASSERT(f->isValid());
CPPUNIT_ASSERT(!f->isNull());
CPPUNIT_ASSERT_EQUAL(f->tag()->artist(), String("test artist"));
CPPUNIT_ASSERT_EQUAL(f->tag()->title(), String("test title"));
@ -65,6 +67,7 @@ public:
delete f;
f = new FileRef(newname.c_str());
CPPUNIT_ASSERT(f->isValid());
CPPUNIT_ASSERT(!f->isNull());
CPPUNIT_ASSERT_EQUAL(f->tag()->artist(), String("ttest artist"));
CPPUNIT_ASSERT_EQUAL(f->tag()->title(), String("ytest title"));
@ -73,6 +76,27 @@ public:
CPPUNIT_ASSERT_EQUAL(f->tag()->track(), TagLib::uint(7));
CPPUNIT_ASSERT_EQUAL(f->tag()->year(), TagLib::uint(2080));
delete f;
f = new FileRef(newname.c_str());
CPPUNIT_ASSERT(f->isValid());
CPPUNIT_ASSERT(!f->isNull());
PropertyMap prop = f->properties();
CPPUNIT_ASSERT_EQUAL(prop["ARTIST"].front(), String("ttest artist"));
CPPUNIT_ASSERT_EQUAL(prop["TITLE" ].front(), String("ytest title"));
prop["ARTIST"].front() = "a test artist";
prop["TITLE" ].front() = "b test title";
f->setProperties(prop);
f->save();
delete f;
f = new FileRef(newname.c_str());
CPPUNIT_ASSERT(f->isValid());
CPPUNIT_ASSERT(!f->isNull());
prop = f->properties();
CPPUNIT_ASSERT_EQUAL(prop["ARTIST"].front(), String("a test artist"));
CPPUNIT_ASSERT_EQUAL(prop["TITLE" ].front(), String("b test title"));
delete f;
}
void testMusepack()

View File

@ -1,5 +1,6 @@
#include <string>
#include <stdio.h>
#include <config.h>
// so evil :(
#define protected public
#include <id3v2tag.h>
@ -15,6 +16,7 @@
#include <popularimeterframe.h>
#include <urllinkframe.h>
#include <ownershipframe.h>
#include <unknownframe.h>
#include <tdebug.h>
#include <tpropertymap.h>
#include <cppunit/extensions/HelperMacros.h>
@ -582,13 +584,27 @@ public:
{
MPEG::File f(TEST_FILE_PATH_C("compressed_id3_frame.mp3"), false);
CPPUNIT_ASSERT(f.ID3v2Tag()->frameListMap().contains("APIC"));
ID3v2::AttachedPictureFrame *frame =
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(f.ID3v2Tag()->frameListMap()["APIC"].front());
#ifdef HAVE_ZLIB
ID3v2::AttachedPictureFrame *frame
= dynamic_cast<TagLib::ID3v2::AttachedPictureFrame*>(f.ID3v2Tag()->frameListMap()["APIC"].front());
CPPUNIT_ASSERT(frame);
CPPUNIT_ASSERT_EQUAL(String("image/bmp"), frame->mimeType());
CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::Other, frame->type());
CPPUNIT_ASSERT_EQUAL(String(""), frame->description());
CPPUNIT_ASSERT_EQUAL(size_t(86414), frame->picture().size());
#else
// Skip the test if ZLIB is not installed.
// The message "Compressed frames are currently not supported." will be displayed.
ID3v2::UnknownFrame *frame
= dynamic_cast<TagLib::ID3v2::UnknownFrame*>(f.ID3v2Tag()->frameListMap()["APIC"].front());
CPPUNIT_ASSERT(frame);
#endif
}
void testW000()

View File

@ -26,7 +26,7 @@ public:
void testSharedptrBasic()
{
int * ip = new int;
TAGLIB_SHARED_PTR<int> cp ( ip );
RefCountPtr<int> cp ( ip );
CPPUNIT_ASSERT( ip == cp.get() );
CPPUNIT_ASSERT( cp.use_count() == 1 );
@ -36,7 +36,7 @@ public:
ck( static_cast<int*>(cp.get()), 54321 );
ck( static_cast<int*>(ip), *cp );
TAGLIB_SHARED_PTR<int> cp2 ( cp );
RefCountPtr<int> cp2 ( cp );
CPPUNIT_ASSERT( ip == cp2.get() );
CPPUNIT_ASSERT( cp.use_count() == 2 );
CPPUNIT_ASSERT( cp2.use_count() == 2 );
@ -46,7 +46,7 @@ public:
ck( static_cast<int*>(cp2.get()), 54321 );
ck( static_cast<int*>(ip), *cp2 );
TAGLIB_SHARED_PTR<int> cp3 ( cp );
RefCountPtr<int> cp3 ( cp );
CPPUNIT_ASSERT( cp.use_count() == 3 );
CPPUNIT_ASSERT( cp2.use_count() == 3 );
CPPUNIT_ASSERT( cp3.use_count() == 3 );
@ -76,16 +76,16 @@ public:
CPPUNIT_ASSERT( cp.use_count() == 3 );
CPPUNIT_ASSERT( *cp == 87654 );
TAGLIB_SHARED_PTR<int> cp4;
RefCountPtr<int> cp4;
swap( cp2, cp4 );
CPPUNIT_ASSERT( cp4.use_count() == 3 );
CPPUNIT_ASSERT( *cp4 == 87654 );
CPPUNIT_ASSERT( cp2.get() == 0 );
std::set< TAGLIB_SHARED_PTR<int> > scp;
std::set< RefCountPtr<int> > scp;
scp.insert(cp4);
CPPUNIT_ASSERT( scp.find(cp4) != scp.end() );
CPPUNIT_ASSERT( scp.find(cp4) == scp.find( TAGLIB_SHARED_PTR<int>(cp4) ) );
CPPUNIT_ASSERT( scp.find(cp4) == scp.find( RefCountPtr<int>(cp4) ) );
}
private:
@ -130,7 +130,7 @@ public:
derivedDestructorCalled = false;
{
TAGLIB_SHARED_PTR<DummyBase> p1(new DummyDerived(100));
RefCountPtr<DummyBase> p1(new DummyDerived(100));
CPPUNIT_ASSERT(p1->getValue() == 100);
}
@ -141,8 +141,8 @@ public:
derivedDestructorCalled = false;
{
TAGLIB_SHARED_PTR<DummyDerived> p1(new DummyDerived(100));
TAGLIB_SHARED_PTR<DummyBase> p2 = p1;
RefCountPtr<DummyDerived> p1(new DummyDerived(100));
RefCountPtr<DummyBase> p2 = p1;
CPPUNIT_ASSERT(p1->getValue() == 100);
CPPUNIT_ASSERT(p2->getValue() == 100);
@ -155,8 +155,8 @@ public:
derivedDestructorCalled = false;
{
TAGLIB_SHARED_PTR<DummyDerived> p1;
TAGLIB_SHARED_PTR<DummyBase> p2;
RefCountPtr<DummyDerived> p1;
RefCountPtr<DummyBase> p2;
p1.reset(new DummyDerived(100));
p2 = p1;
@ -171,7 +171,7 @@ public:
private:
class DummyIncomplete;
TAGLIB_SHARED_PTR<DummyIncomplete> pincomplete;
RefCountPtr<DummyIncomplete> pincomplete;
class DummyIncomplete
{