mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
Merge pull request #557 from TsudaKageyu/audioprop-flac
(wishlist) FLAC: AudioProperties improvements
This commit is contained in:
BIN
tests/data/sinewave.flac
Normal file
BIN
tests/data/sinewave.flac
Normal file
Binary file not shown.
@ -25,6 +25,7 @@ class TestFLAC : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testSaveMultipleValues);
|
||||
CPPUNIT_TEST(testDict);
|
||||
CPPUNIT_TEST(testInvalid);
|
||||
CPPUNIT_TEST(testAudioProperties);
|
||||
CPPUNIT_TEST(testZeroSizedPadding);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
@ -256,6 +257,24 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(TagLib::uint(0), f.properties().size());
|
||||
}
|
||||
|
||||
void testAudioProperties()
|
||||
{
|
||||
FLAC::File f(TEST_FILE_PATH_C("sinewave.flac"));
|
||||
CPPUNIT_ASSERT(f.audioProperties());
|
||||
CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length());
|
||||
CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->lengthInSeconds());
|
||||
CPPUNIT_ASSERT_EQUAL(3550, f.audioProperties()->lengthInMilliseconds());
|
||||
CPPUNIT_ASSERT_EQUAL(145, f.audioProperties()->bitrate());
|
||||
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
|
||||
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
|
||||
CPPUNIT_ASSERT_EQUAL(16, f.audioProperties()->bitsPerSample());
|
||||
CPPUNIT_ASSERT_EQUAL(16, f.audioProperties()->sampleWidth());
|
||||
CPPUNIT_ASSERT_EQUAL(156556ULL, f.audioProperties()->sampleFrames());
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
ByteVector("\xcf\xe3\xd9\xda\xba\xde\xab\x2c\xbf\x2c\xa2\x35\x27\x4b\x7f\x76"),
|
||||
f.audioProperties()->signature());
|
||||
}
|
||||
|
||||
void testZeroSizedPadding()
|
||||
{
|
||||
ScopedFileCopy copy("zero-sized-padding", ".flac");
|
||||
|
Reference in New Issue
Block a user