File: test_shorten.cpp

package info (click to toggle)
taglib 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,192 kB
  • sloc: cpp: 44,736; ansic: 137; makefile: 28
file content (44 lines) | stat: -rw-r--r-- 1,284 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <string>
#include <cstdio>

#include "tbytevectorlist.h"
#include "tpropertymap.h"
#include "tag.h"
#include "shortenfile.h"
#include "plainfile.h"
#include <cppunit/extensions/HelperMacros.h>
#include "utils.h"

using namespace std;
using namespace TagLib;

class TestShorten : public CppUnit::TestFixture
{
  CPPUNIT_TEST_SUITE(TestShorten);
  CPPUNIT_TEST(testBasic);
  CPPUNIT_TEST(testTags);
  CPPUNIT_TEST_SUITE_END();

public:

  void testBasic()
  {
    Shorten::File f(TEST_FILE_PATH_C("2sec-silence.shn"));
    CPPUNIT_ASSERT(f.audioProperties());
    CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->lengthInSeconds());
    CPPUNIT_ASSERT_EQUAL(2000, f.audioProperties()->lengthInMilliseconds());
    CPPUNIT_ASSERT_EQUAL(1411, f.audioProperties()->bitrate());
    CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
    CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
    CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->shortenVersion());
    CPPUNIT_ASSERT_EQUAL(5, f.audioProperties()->fileType());
    CPPUNIT_ASSERT_EQUAL(16, f.audioProperties()->bitsPerSample());
    CPPUNIT_ASSERT_EQUAL(static_cast<unsigned long>(88200), f.audioProperties()->sampleFrames());
  }

  void testTags()
  {
  }
};

CPPUNIT_TEST_SUITE_REGISTRATION(TestShorten);