blob: 5e48c60b2bbbc109d77373402b6508c5bf74e6a4 (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include <stdexcept>
#include "midi++/manager.h"
#include "pbd/textreceiver.h"
#include "ardour/session.h"
#include "ardour/audioengine.h"
#include "ardour/smf_source.h"
#include "ardour/midi_model.h"
#include "test/mantis_3356.h"
CPPUNIT_TEST_SUITE_REGISTRATION (Mantis3356Test);
using namespace std;
using namespace ARDOUR;
using namespace PBD;
TextReceiver text_receiver ("test");
void
Mantis3356Test::test ()
{
init (false, true);
SessionEvent::create_per_thread_pool ("test", 512);
text_receiver.listen_to (error);
text_receiver.listen_to (info);
text_receiver.listen_to (fatal);
text_receiver.listen_to (warning);
AudioEngine engine ("test", "");
MIDI::Manager::create (engine.jack ());
CPPUNIT_ASSERT (engine.start () == 0);
Session session (engine, "../../libs/ardour/test/data/mantis_3356", "mantis_3356");
engine.set_session (&session);
Session::SourceMap sources = session.get_sources ();
boost::shared_ptr<SMFSource> source = boost::dynamic_pointer_cast<SMFSource> (sources[ID ("87")]);
CPPUNIT_ASSERT (source);
boost::shared_ptr<MidiModel> model = source->model ();
CPPUNIT_ASSERT (model);
stringstream result;
for (MidiModel::const_iterator i = model->begin(); i != model->end(); ++i) {
result << *i << "\n";
}
ifstream ref ("../../libs/ardour/test/data/mantis_3356.ref");
while (1) {
string a;
string b;
getline (ref, a);
getline (result, b);
CPPUNIT_ASSERT (a == b);
if (result.eof() && ref.eof()) {
break;
}
CPPUNIT_ASSERT (!result.eof ());
CPPUNIT_ASSERT (!ref.eof ());
}
}
|