Merge pull request #562 from TsudaKageyu/audioprop-speex

(wishlist) Ogg Speex: AudioProperties improvements
This commit is contained in:
Tsuda Kageyu
2015-08-01 01:29:22 +09:00
6 changed files with 136 additions and 35 deletions

View File

@ -65,6 +65,7 @@ SET(test_runner_SRCS
test_xm.cpp
test_mpc.cpp
test_opus.cpp
test_speex.cpp
)
INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIR})

31
tests/test_speex.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <speexfile.h>
#include <cppunit/extensions/HelperMacros.h>
#include "utils.h"
using namespace std;
using namespace TagLib;
class TestSpeex : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestSpeex);
CPPUNIT_TEST(testAudioProperties);
CPPUNIT_TEST_SUITE_END();
public:
void testAudioProperties()
{
Ogg::Speex::File f(TEST_FILE_PATH_C("empty.spx"));
CPPUNIT_ASSERT(f.audioProperties());
CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length());
CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->lengthInSeconds());
CPPUNIT_ASSERT_EQUAL(3685, f.audioProperties()->lengthInMilliseconds());
CPPUNIT_ASSERT_EQUAL(53, f.audioProperties()->bitrate());
CPPUNIT_ASSERT_EQUAL(-1, f.audioProperties()->bitrateNominal());
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestSpeex);