Refactored AudioProperties classes in some ways

This commit is contained in:
Tsuda Kageyu
2013-07-13 10:38:52 +09:00
parent 6d89689c0e
commit 6d40cbc04f
44 changed files with 498 additions and 477 deletions

BIN
tests/data/alaw.aifc Normal file

Binary file not shown.

BIN
tests/data/alaw.wav Normal file

Binary file not shown.

View File

@ -13,6 +13,7 @@ class TestAIFF : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestAIFF);
CPPUNIT_TEST(testReading);
CPPUNIT_TEST(testAiffCProperties);
CPPUNIT_TEST_SUITE_END();
public:
@ -24,6 +25,22 @@ public:
RIFF::AIFF::File *f = new RIFF::AIFF::File(filename.c_str());
CPPUNIT_ASSERT_EQUAL(705, f->audioProperties()->bitrate());
CPPUNIT_ASSERT(!f->audioProperties()->isAiffC());
delete f;
}
void testAiffCProperties()
{
ScopedFileCopy copy("alaw", ".aifc");
string filename = copy.fileName();
RIFF::AIFF::File *f = new RIFF::AIFF::File(filename.c_str());
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

@ -27,6 +27,8 @@ class TestFileRef : public CppUnit::TestFixture
CPPUNIT_TEST(testTrueAudio);
CPPUNIT_TEST(testAPE);
CPPUNIT_TEST(testWav);
CPPUNIT_TEST(testAIFF);
CPPUNIT_TEST(testAIFC);
CPPUNIT_TEST(testUnsupported);
CPPUNIT_TEST_SUITE_END();
@ -155,6 +157,16 @@ public:
fileRefSave("empty", ".wav");
}
void testAIFF()
{
fileRefSave("empty", ".aiff");
}
void testAIFC()
{
fileRefSave("alaw", ".aifc");
}
void testOGA_FLAC()
{
FileRef *f = new FileRef(TEST_FILE_PATH_C("empty_flac.oga"));

View File

@ -14,6 +14,7 @@ class TestWAV : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE(TestWAV);
CPPUNIT_TEST(testLength);
CPPUNIT_TEST(testZeroSizeDataChunk);
CPPUNIT_TEST(testFormat);
CPPUNIT_TEST_SUITE_END();
public:
@ -30,6 +31,17 @@ public:
RIFF::WAV::File f(TEST_FILE_PATH_C("zero-size-chunk.wav"));
CPPUNIT_ASSERT_EQUAL(false, f.isValid());
}
void testFormat()
{
RIFF::WAV::File f1(TEST_FILE_PATH_C("empty.wav"));
CPPUNIT_ASSERT_EQUAL(true, f1.isValid());
CPPUNIT_ASSERT_EQUAL((uint)1, f1.audioProperties()->format());
RIFF::WAV::File f2(TEST_FILE_PATH_C("alaw.wav"));
CPPUNIT_ASSERT_EQUAL(true, f2.isValid());
CPPUNIT_ASSERT_EQUAL((uint)6, f2.audioProperties()->format());
}
};