tweaks to be ready for more information timecode display in Timecode clock mode
[ardour.git] / libs / evoral / test / SMFTest.hpp
1 /* This file is part of Evoral.
2  * Copyright(C) 2000-2008 Paul Davis
3  * Author: Hans Baier
4  *
5  * Evoral is free software; you can redistribute it and/or modify it under the
6  * terms of the GNU General Public License as published by the Free Software
7  * Foundation; either version 2 of the License, or(at your option) any later
8  * version.
9  *
10  * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18
19 #include <cassert>
20 #include <stdint.h>
21 #include <sigc++/sigc++.h>
22 #include <cppunit/TestFixture.h>
23 #include <cppunit/extensions/HelperMacros.h>
24 #include "evoral/SMF.hpp"
25 #include "SequenceTest.hpp"
26
27 using namespace Evoral;
28
29 class TestSMF : public SMF {
30 public:
31         std::string path() const { return _path; }
32
33         int open(const std::string& path) THROW_FILE_ERROR {
34                 _path = path;
35                 return SMF::open(path);
36         }
37
38         void close() THROW_FILE_ERROR {
39                 return SMF::close();
40         }
41
42         int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const {
43                 event_id_t id;
44                 return SMF::read_event(delta_t, size, buf, &id);
45         }
46
47 private:
48         std::string  _path;
49 };
50
51 class SMFTest : public CppUnit::TestFixture
52 {
53         CPPUNIT_TEST_SUITE(SMFTest);
54         CPPUNIT_TEST(createNewFileTest);
55         CPPUNIT_TEST(takeFiveTest);
56         CPPUNIT_TEST_SUITE_END();
57
58 public:
59         typedef double Time;
60
61         void setUp() {
62                 type_map = new DummyTypeMap();
63                 assert(type_map);
64                 seq = new MySequence<Time>(*type_map);
65                 assert(seq);
66         }
67
68         void tearDown() {
69                 delete seq;
70                 delete type_map;
71         }
72
73         void createNewFileTest();
74         void takeFiveTest();
75
76 private:
77         DummyTypeMap*     type_map;
78         MySequence<Time>* seq;
79 };
80