summaryrefslogtreecommitdiff
path: root/libs/ardour/test/session_test.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2014-12-20 18:56:36 +0700
committerTim Mayberry <mojofunk@gmail.com>2015-02-15 12:53:41 +1000
commitd9b4c6be6a9366434f92b2ed8897a139ce4f9089 (patch)
tree914d7d950da0d6e58e7fed10804d9009774860ba /libs/ardour/test/session_test.cc
parentef99814f7aedca0e03be617c6fd24ff3f82a9108 (diff)
Add a few test util functions and refactor existing test code
Diffstat (limited to 'libs/ardour/test/session_test.cc')
-rw-r--r--libs/ardour/test/session_test.cc50
1 files changed, 10 insertions, 40 deletions
diff --git a/libs/ardour/test/session_test.cc b/libs/ardour/test/session_test.cc
index 5da03a637d..b9372aa5a5 100644
--- a/libs/ardour/test/session_test.cc
+++ b/libs/ardour/test/session_test.cc
@@ -21,38 +21,6 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-static TextReceiver text_receiver ("test");
-
-void
-SessionTest::setUp ()
-{
- SessionEvent::create_per_thread_pool ("session_test", 512);
-
- text_receiver.listen_to (error);
- text_receiver.listen_to (info);
- text_receiver.listen_to (fatal);
- text_receiver.listen_to (warning);
-
- AudioEngine* engine = AudioEngine::create ();
-
- CPPUNIT_ASSERT (engine);
-
- CPPUNIT_ASSERT (engine->set_backend ("Dummy", "", ""));
-
- init_post_engine ();
-
- CPPUNIT_ASSERT (engine->start () == 0);
-}
-
-void
-SessionTest::tearDown ()
-{
- // this is needed or there is a crash in MIDI::Manager::destroy
- AudioEngine::instance()->remove_session ();
- AudioEngine::instance()->stop ();
- AudioEngine::destroy ();
-}
-
void
SessionTest::new_session ()
{
@@ -61,20 +29,16 @@ SessionTest::new_session ()
CPPUNIT_ASSERT (!Glib::file_test (new_session_dir, Glib::FILE_TEST_EXISTS));
- Session* new_session = 0;
- AudioEngine::create ();
+ create_and_start_dummy_backend ();
- new_session = new Session (*AudioEngine::instance (), new_session_dir, session_name);
+ ARDOUR::Session* new_session = load_session (new_session_dir, "test_session");
CPPUNIT_ASSERT (new_session);
- // shouldn't need to do this as it is done in Session constructor
- // via Session::when_engine_running
- //AudioEngine::instance->set_session (new_session);
-
new_session->save_state ("");
delete new_session;
+ stop_and_destroy_backend ();
}
void
@@ -94,7 +58,8 @@ SessionTest::new_session_from_template ()
Session* new_session = 0;
BusProfile* bus_profile = 0;
- AudioEngine::create ();
+
+ create_and_start_dummy_backend ();
// create a new session based on session template
new_session = new Session (*AudioEngine::instance (), new_session_dir, session_name,
@@ -105,6 +70,10 @@ SessionTest::new_session_from_template ()
new_session->save_state ("");
delete new_session;
+ stop_and_destroy_backend ();
+
+ // keep the same audio backend
+ create_and_start_dummy_backend ();
Session* template_session = 0;
@@ -114,4 +83,5 @@ SessionTest::new_session_from_template ()
CPPUNIT_ASSERT (template_session);
delete template_session;
+ stop_and_destroy_backend ();
}