Add TestNeedingPlaylistAndRegions
authorCarl Hetherington <carl@carlh.net>
Tue, 3 Jan 2012 21:12:53 +0000 (21:12 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 3 Jan 2012 21:12:53 +0000 (21:12 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11149 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/test/playlist_layering_test.cc
libs/ardour/test/playlist_layering_test.h
libs/ardour/test/test_needing_playlist_and_regions.cc [new file with mode: 0644]
libs/ardour/test/test_needing_playlist_and_regions.h [new file with mode: 0644]
libs/ardour/test/test_needing_session.h
libs/ardour/wscript

index 1753635584e9a4d34a5ba613d8b02d9c5e710d54..e17e15761941818bfd9a2c71a6c28b99e7de76a6 100644 (file)
@@ -1,58 +1,15 @@
-#include "midi++/manager.h"
-#include "pbd/textreceiver.h"
-#include "pbd/compose.h"
-#include "ardour/session.h"
-#include "ardour/audioengine.h"
-#include "ardour/playlist_factory.h"
-#include "ardour/source_factory.h"
+#include "ardour/playlist.h"
 #include "ardour/region.h"
-#include "ardour/region_factory.h"
 #include "playlist_layering_test.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION (PlaylistLayeringTest);
 
 using namespace std;
 using namespace ARDOUR;
-using namespace PBD;
-
-void
-PlaylistLayeringTest::setUp ()
-{
-       TestNeedingSession::setUp ();
-       
-       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);
-}
-
-void
-PlaylistLayeringTest::tearDown ()
-{
-       _playlist.reset ();
-       _source.reset ();
-       for (int i = 0; i < 16; ++i) {
-               _region[i].reset ();
-       }
-
-       TestNeedingSession::tearDown ();
-}
-
-void
-PlaylistLayeringTest::create_three_short_regions ()
-{
-       PropertyList plist;
-       plist.add (Properties::start, 0);
-       plist.add (Properties::length, 100);
-       for (int i = 0; i < 3; ++i) {
-               _region[i] = RegionFactory::create (_source, plist);
-       }
-}
 
 void
 PlaylistLayeringTest::basicsTest ()
 {
-       create_three_short_regions ();
-
        _playlist->add_region (_region[0], 0);
        _playlist->add_region (_region[1], 10);
        _playlist->add_region (_region[2], 20);
index 2200fa8f9fb57c8ad413eec2a8f860fb1267f2a7..20b0f49086df17f929577977f5b7939862b99e3b 100644 (file)
@@ -1,26 +1,11 @@
-#include "test_needing_session.h"
+#include "test_needing_playlist_and_regions.h"
 
-namespace ARDOUR {
-       class Playlist;
-       class Source;
-}
-
-class PlaylistLayeringTest : public TestNeedingSession
+class PlaylistLayeringTest : public TestNeedingPlaylistAndRegions
 {
        CPPUNIT_TEST_SUITE (PlaylistLayeringTest);
        CPPUNIT_TEST (basicsTest);
        CPPUNIT_TEST_SUITE_END ();
 
 public:
-       void setUp ();
-       void tearDown ();
-
        void basicsTest ();
-
-private:
-       void create_three_short_regions ();
-       
-       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/test_needing_playlist_and_regions.cc b/libs/ardour/test/test_needing_playlist_and_regions.cc
new file mode 100644 (file)
index 0000000..7dc7bd9
--- /dev/null
@@ -0,0 +1,40 @@
+#include "ardour/playlist_factory.h"
+#include "ardour/source_factory.h"
+#include "ardour/region.h"
+#include "ardour/region_factory.h"
+#include "test_needing_playlist_and_regions.h"
+
+using namespace std;
+using namespace PBD;
+using namespace ARDOUR;
+
+void
+TestNeedingPlaylistAndRegions::setUp ()
+{
+       TestNeedingSession::setUp ();
+
+       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);
+       
+       PropertyList plist;
+       plist.add (Properties::start, 0);
+       plist.add (Properties::length, 100);
+       for (int i = 0; i < 16; ++i) {
+               _region[i] = RegionFactory::create (_source, plist);
+       }
+}
+
+void
+TestNeedingPlaylistAndRegions::tearDown ()
+{
+       _playlist.reset ();
+       _source.reset ();
+       for (int i = 0; i < 16; ++i) {
+               _region[i].reset ();
+       }
+
+       TestNeedingSession::tearDown ();
+}
+
+       
diff --git a/libs/ardour/test/test_needing_playlist_and_regions.h b/libs/ardour/test/test_needing_playlist_and_regions.h
new file mode 100644 (file)
index 0000000..d8e890b
--- /dev/null
@@ -0,0 +1,20 @@
+#include <boost/shared_ptr.hpp>
+#include "test_needing_session.h"
+
+namespace ARDOUR {
+       class Playlist;
+       class Source;
+       class Region;
+}
+
+class TestNeedingPlaylistAndRegions : public TestNeedingSession
+{
+public:
+       virtual void setUp ();
+       virtual void tearDown ();
+
+protected:
+       boost::shared_ptr<ARDOUR::Playlist> _playlist;
+       boost::shared_ptr<ARDOUR::Source> _source;
+       boost::shared_ptr<ARDOUR::Region> _region[16];
+};
index 57acd9287ce97d4681d54559d01c8aecc6ab2ff2..c858f035ab41d28d38795e61890272c7c69e8e49 100644 (file)
@@ -1,6 +1,10 @@
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
 
+namespace ARDOUR {
+       class Session;
+}
+
 class TestNeedingSession : public CppUnit::TestFixture
 {
 public:
index 43ce7cdb7142d47bad56864fd08e09819033eb05..782a5b230c9b557942d9ce5574b826c98ae5ae2a 100644 (file)
@@ -424,6 +424,7 @@ def build(bld):
         testobj.source       = '''
                 test/dummy_lxvst.cc
                 test/test_needing_session.cc
+                test/test_needing_playlist_and_regions.cc
                 test/bbt_test.cc
                 test/tempo_test.cc
                 test/interpolation_test.cc