summaryrefslogtreecommitdiff
path: root/libs/ardour/test
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-01-03 16:05:25 +0000
committerCarl Hetherington <carl@carlh.net>2012-01-03 16:05:25 +0000
commitb6438ed1f60def7a6c673405304b688787dd2ed1 (patch)
tree0ec9e9914948ba6dc91b1de716c399bcd58b65ea /libs/ardour/test
parentdd577004459b7810daae2b4ad6741e3a2b858565 (diff)
Add TestNeedingSession and add missing tempo_test.h
git-svn-id: svn://localhost/ardour2/branches/3.0@11140 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/test')
-rw-r--r--libs/ardour/test/playlist_layering_test.cc66
-rw-r--r--libs/ardour/test/playlist_layering_test.h7
-rw-r--r--libs/ardour/test/tempo_test.h17
-rw-r--r--libs/ardour/test/test_needing_session.cc83
-rw-r--r--libs/ardour/test/test_needing_session.h12
5 files changed, 118 insertions, 67 deletions
diff --git a/libs/ardour/test/playlist_layering_test.cc b/libs/ardour/test/playlist_layering_test.cc
index fd0b6bc09c..1753635584 100644
--- a/libs/ardour/test/playlist_layering_test.cc
+++ b/libs/ardour/test/playlist_layering_test.cc
@@ -15,66 +15,12 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-class TestReceiver : public Receiver
-{
-protected:
- void receive (Transmitter::Channel chn, const char * str) {
- const char *prefix = "";
-
- switch (chn) {
- case Transmitter::Error:
- prefix = ": [ERROR]: ";
- break;
- case Transmitter::Info:
- /* ignore */
- return;
- case Transmitter::Warning:
- prefix = ": [WARNING]: ";
- break;
- case Transmitter::Fatal:
- prefix = ": [FATAL]: ";
- break;
- case Transmitter::Throw:
- /* this isn't supposed to happen */
- abort ();
- }
-
- /* note: iostreams are already thread-safe: no external
- lock required.
- */
-
- cout << prefix << str << endl;
-
- if (chn == Transmitter::Fatal) {
- exit (9);
- }
- }
-};
-
-TestReceiver test_receiver;
-
void
PlaylistLayeringTest::setUp ()
{
- string const test_session_path = "libs/ardour/test/playlist_layering_test";
- string const test_wav_path = "libs/ardour/test/playlist_layering_test/playlist_layering_test.wav";
- system (string_compose ("rm -rf %1", test_session_path).c_str());
+ TestNeedingSession::setUp ();
- init (false, true);
- SessionEvent::create_per_thread_pool ("test", 512);
-
- test_receiver.listen_to (error);
- test_receiver.listen_to (info);
- test_receiver.listen_to (fatal);
- test_receiver.listen_to (warning);
-
- AudioEngine* engine = new AudioEngine ("test", "");
- MIDI::Manager::create (engine->jack ());
- CPPUNIT_ASSERT (engine->start () == 0);
-
- _session = new Session (*engine, test_session_path, "playlist_layering_test");
- engine->set_session (_session);
-
+ string const test_wav_path = "libs/ardour/test/playlist_layering_test/playlist_layering_test.wav";
_playlist = PlaylistFactory::create (DataType::AUDIO, *_session, "test");
_source = SourceFactory::createWritable (DataType::AUDIO, *_session, test_wav_path, "", false, 44100);
}
@@ -87,12 +33,8 @@ PlaylistLayeringTest::tearDown ()
for (int i = 0; i < 16; ++i) {
_region[i].reset ();
}
-
- AudioEngine::instance()->remove_session ();
- delete _session;
- EnumWriter::destroy ();
- MIDI::Manager::destroy ();
- AudioEngine::destroy ();
+
+ TestNeedingSession::tearDown ();
}
void
diff --git a/libs/ardour/test/playlist_layering_test.h b/libs/ardour/test/playlist_layering_test.h
index 46285459ca..2200fa8f9f 100644
--- a/libs/ardour/test/playlist_layering_test.h
+++ b/libs/ardour/test/playlist_layering_test.h
@@ -1,13 +1,11 @@
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include "test_needing_session.h"
namespace ARDOUR {
- class Session;
class Playlist;
class Source;
}
-class PlaylistLayeringTest : public CppUnit::TestFixture
+class PlaylistLayeringTest : public TestNeedingSession
{
CPPUNIT_TEST_SUITE (PlaylistLayeringTest);
CPPUNIT_TEST (basicsTest);
@@ -22,7 +20,6 @@ public:
private:
void create_three_short_regions ();
- ARDOUR::Session* _session;
boost::shared_ptr<ARDOUR::Playlist> _playlist;
boost::shared_ptr<ARDOUR::Source> _source;
boost::shared_ptr<ARDOUR::Region> _region[16];
diff --git a/libs/ardour/test/tempo_test.h b/libs/ardour/test/tempo_test.h
new file mode 100644
index 0000000000..3252650b03
--- /dev/null
+++ b/libs/ardour/test/tempo_test.h
@@ -0,0 +1,17 @@
+#include <sigc++/sigc++.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class TempoTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE (TempoTest);
+ CPPUNIT_TEST (recomputeMapTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+ void setUp () {}
+ void tearDown () {}
+
+ void recomputeMapTest ();
+};
+
diff --git a/libs/ardour/test/test_needing_session.cc b/libs/ardour/test/test_needing_session.cc
new file mode 100644
index 0000000000..e2da42c475
--- /dev/null
+++ b/libs/ardour/test/test_needing_session.cc
@@ -0,0 +1,83 @@
+#include "midi++/manager.h"
+#include "pbd/textreceiver.h"
+#include "pbd/compose.h"
+#include "pbd/enumwriter.h"
+#include "ardour/session.h"
+#include "ardour/audioengine.h"
+#include "test_needing_session.h"
+
+using namespace std;
+using namespace ARDOUR;
+using namespace PBD;
+
+class TestReceiver : public Receiver
+{
+protected:
+ void receive (Transmitter::Channel chn, const char * str) {
+ const char *prefix = "";
+
+ switch (chn) {
+ case Transmitter::Error:
+ prefix = ": [ERROR]: ";
+ break;
+ case Transmitter::Info:
+ /* ignore */
+ return;
+ case Transmitter::Warning:
+ prefix = ": [WARNING]: ";
+ break;
+ case Transmitter::Fatal:
+ prefix = ": [FATAL]: ";
+ break;
+ case Transmitter::Throw:
+ /* this isn't supposed to happen */
+ abort ();
+ }
+
+ /* note: iostreams are already thread-safe: no external
+ lock required.
+ */
+
+ cout << prefix << str << endl;
+
+ if (chn == Transmitter::Fatal) {
+ exit (9);
+ }
+ }
+};
+
+TestReceiver test_receiver;
+
+void
+TestNeedingSession::setUp ()
+{
+ string const test_session_path = "libs/ardour/test/test_session";
+ system (string_compose ("rm -rf %1", test_session_path).c_str());
+
+ init (false, true);
+ SessionEvent::create_per_thread_pool ("test", 512);
+
+ test_receiver.listen_to (error);
+ test_receiver.listen_to (info);
+ test_receiver.listen_to (fatal);
+ test_receiver.listen_to (warning);
+
+ AudioEngine* engine = new AudioEngine ("test", "");
+ MIDI::Manager::create (engine->jack ());
+ CPPUNIT_ASSERT (engine->start () == 0);
+
+ _session = new Session (*engine, test_session_path, "test_session");
+ engine->set_session (_session);
+}
+
+void
+TestNeedingSession::tearDown ()
+{
+ AudioEngine::instance()->remove_session ();
+
+ delete _session;
+
+ EnumWriter::destroy ();
+ MIDI::Manager::destroy ();
+ AudioEngine::destroy ();
+}
diff --git a/libs/ardour/test/test_needing_session.h b/libs/ardour/test/test_needing_session.h
new file mode 100644
index 0000000000..57acd9287c
--- /dev/null
+++ b/libs/ardour/test/test_needing_session.h
@@ -0,0 +1,12 @@
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class TestNeedingSession : public CppUnit::TestFixture
+{
+public:
+ virtual void setUp ();
+ virtual void tearDown ();
+
+protected:
+ ARDOUR::Session* _session;
+};