| 1 | #include <string> |
| 2 | #include <cstdio> |
| 3 | |
| 4 | #include "tbytevectorlist.h" |
| 5 | #include "tpropertymap.h" |
| 6 | #include "tag.h" |
| 7 | #include "shortenfile.h" |
| 8 | #include "plainfile.h" |
| 9 | #include <cppunit/extensions/HelperMacros.h> |
| 10 | #include "utils.h" |
| 11 | |
| 12 | using namespace std; |
| 13 | using namespace TagLib; |
| 14 | |
| 15 | class TestShorten : public CppUnit::TestFixture |
| 16 | { |
| 17 | CPPUNIT_TEST_SUITE(TestShorten); |
| 18 | CPPUNIT_TEST(testBasic); |
| 19 | CPPUNIT_TEST(testTags); |
| 20 | CPPUNIT_TEST_SUITE_END(); |
| 21 | |
| 22 | public: |
| 23 | |
| 24 | void testBasic() |
| 25 | { |
| 26 | Shorten::File f(TEST_FILE_PATH_C("2sec-silence.shn")); |
| 27 | CPPUNIT_ASSERT(f.audioProperties()); |
| 28 | CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->lengthInSeconds()); |
| 29 | CPPUNIT_ASSERT_EQUAL(2000, f.audioProperties()->lengthInMilliseconds()); |
| 30 | CPPUNIT_ASSERT_EQUAL(1411, f.audioProperties()->bitrate()); |
| 31 | CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels()); |
| 32 | CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate()); |
| 33 | CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->shortenVersion()); |
| 34 | CPPUNIT_ASSERT_EQUAL(5, f.audioProperties()->fileType()); |
| 35 | CPPUNIT_ASSERT_EQUAL(16, f.audioProperties()->bitsPerSample()); |
| 36 | CPPUNIT_ASSERT_EQUAL(static_cast<unsigned long>(88200), f.audioProperties()->sampleFrames()); |
| 37 | } |
| 38 | |
| 39 | void testTags() |
| 40 | { |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | CPPUNIT_TEST_SUITE_REGISTRATION(TestShorten); |