summaryrefslogtreecommitdiff
path: root/libs/ardour/test/mantis_3356.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/test/mantis_3356.cc')
-rw-r--r--libs/ardour/test/mantis_3356.cc69
1 files changed, 69 insertions, 0 deletions
diff --git a/libs/ardour/test/mantis_3356.cc b/libs/ardour/test/mantis_3356.cc
new file mode 100644
index 0000000000..5e48c60b2b
--- /dev/null
+++ b/libs/ardour/test/mantis_3356.cc
@@ -0,0 +1,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 ());
+ }
+
+}