Merge branch 'master' into taglib2

Conflicts:
	tests/test_aiff.cpp
	tests/test_flac.cpp
This commit is contained in:
Scott Wheeler
2014-09-25 16:39:26 +02:00
11 changed files with 80 additions and 58 deletions

View File

@ -25,11 +25,10 @@ public:
RIFF::AIFF::File *f = new RIFF::AIFF::File(filename.c_str());
CPPUNIT_ASSERT_EQUAL(705, f->audioProperties()->bitrate());
CPPUNIT_ASSERT(!f->audioProperties()->isAiffC());
CPPUNIT_ASSERT(f->audioProperties()->isAiffC());
delete f;
}
void testAiffCProperties()
{
ScopedFileCopy copy("alaw", ".aifc");
@ -39,7 +38,6 @@ public:
CPPUNIT_ASSERT(f->audioProperties()->isAiffC());
CPPUNIT_ASSERT_EQUAL(ByteVector("ALAW"), f->audioProperties()->compressionType());
CPPUNIT_ASSERT_EQUAL(String("SGI CCITT G.711 A-law"), f->audioProperties()->compressionName());
delete f;
}

View File

@ -172,6 +172,7 @@ public:
FileRef *f = new FileRef(TEST_FILE_PATH_C("empty_flac.oga"));
CPPUNIT_ASSERT(dynamic_cast<Ogg::Vorbis::File *>(f->file()) == NULL);
CPPUNIT_ASSERT(dynamic_cast<Ogg::FLAC::File *>(f->file()) != NULL);
delete f;
}
void testOGA_Vorbis()
@ -179,6 +180,7 @@ public:
FileRef *f = new FileRef(TEST_FILE_PATH_C("empty_vorbis.oga"));
CPPUNIT_ASSERT(dynamic_cast<Ogg::Vorbis::File *>(f->file()) != NULL);
CPPUNIT_ASSERT(dynamic_cast<Ogg::FLAC::File *>(f->file()) == NULL);
delete f;
}
void testAPE()

View File

@ -69,6 +69,7 @@ public:
CPPUNIT_ASSERT_EQUAL(String("image/png"), pic->mimeType());
CPPUNIT_ASSERT_EQUAL(String("A pixel."), pic->description());
CPPUNIT_ASSERT_EQUAL(size_t(150), pic->data().size());
delete f;
}
void testAddPicture()

View File

@ -209,6 +209,8 @@ public:
CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), frame->mimeType());
CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::FileIcon, frame->type());
CPPUNIT_ASSERT_EQUAL(String("d"), frame->description());
delete frame;
}
void testDontRender22()
@ -921,9 +923,9 @@ public:
f.setEndTime(5);
f.setStartOffset(2);
f.setEndOffset(3);
ID3v2::TextIdentificationFrame eF("TIT2");
eF.setText("CH1");
f.addEmbeddedFrame(&eF);
ID3v2::TextIdentificationFrame *eF = new ID3v2::TextIdentificationFrame("TIT2");
eF->setText("CH1");
f.addEmbeddedFrame(eF);
CPPUNIT_ASSERT_EQUAL(
ByteVector("CHAP" // Frame ID
"\x00\x00\x00\x20" // Frame size
@ -979,9 +981,9 @@ public:
f.setIsOrdered(true);
f.addChildElement(ByteVector("\x43\x00", 2));
f.addChildElement(ByteVector("\x44\x00", 2));
ID3v2::TextIdentificationFrame eF("TIT2");
eF.setText("TC1");
f.addEmbeddedFrame(&eF);
ID3v2::TextIdentificationFrame *eF = new ID3v2::TextIdentificationFrame("TIT2");
eF->setText("TC1");
f.addEmbeddedFrame(eF);
CPPUNIT_ASSERT_EQUAL(
ByteVector("CTOC" // Frame ID
"\x00\x00\x00\x16" // Frame size

View File

@ -142,6 +142,7 @@ public:
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());
delete f;
}
void test64BitAtom()
@ -158,6 +159,7 @@ public:
f->tag()->itemListMap()["pgap"] = true;
f->save();
delete atoms;
delete f;
f = new MP4::File(filename.c_str());
@ -168,6 +170,7 @@ public:
moov = atoms->atoms[0];
// original size + 'pgap' size + padding
CPPUNIT_ASSERT_EQUAL(long(77 + 25 + 974), moov->length);
delete atoms;
delete f;
}

View File

@ -86,6 +86,8 @@ public:
CPPUNIT_ASSERT_EQUAL(ByteVector("TEST"), f->chunkName(2));
CPPUNIT_ASSERT_EQUAL(ByteVector("foo"), f->chunkData(2));
delete f;
}
void testLastChunkAtEvenPosition()

View File

@ -11,6 +11,7 @@
#include <sys/stat.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <fstream>
@ -26,7 +27,9 @@ inline string testFilePath(const string &filename)
inline string copyFile(const string &filename, const string &ext)
{
string newname = string(tempnam(NULL, NULL)) + ext;
char *newname_c = tempnam(NULL, NULL);
string newname = string(newname_c) + ext;
free(newname_c);
string oldname = testFilePath(filename) + ext;
#ifdef _WIN32
CopyFileA(oldname.c_str(), newname.c_str(), FALSE);