ardour
region_naming_test.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 
19 #include "ardour/playlist.h"
20 #include "ardour/region.h"
21 #include "ardour/region_factory.h"
22 #include "region_naming_test.h"
23 
25 
26 using namespace std;
27 using namespace ARDOUR;
28 
29 void
31 {
32  for (int i = 0; i < 64; ++i) {
33  boost::shared_ptr<Region> r = RegionFactory::create (_r[0], true);
34  stringstream s;
35  s << "ar0." << (i + 1);
36  CPPUNIT_ASSERT_EQUAL (s.str(), r->name());
37  }
38 
39  _r[0]->set_name ("foo");
40 
41  for (int i = 0; i < 64; ++i) {
42  boost::shared_ptr<Region> r = RegionFactory::create (_r[0], true);
43  stringstream s;
44  s << "foo." << (i + 1);
45  CPPUNIT_ASSERT_EQUAL (s.str(), r->name());
46  }
47 
48  for (int i = 0; i < 64; ++i) {
49  boost::shared_ptr<Region> rA = RegionFactory::create (_r[0], true);
50  boost::shared_ptr<Region> rB = RegionFactory::create (rA, true);
51  stringstream s;
52  s << "foo." << (i * 2 + 64 + 1);
53  CPPUNIT_ASSERT_EQUAL (s.str(), rA->name());
54  stringstream t;
55  t << "foo." << (i * 2 + 64 + 2);
56  CPPUNIT_ASSERT_EQUAL (s.str(), rA->name());
57  }
58 }
59 
60 void
62 {
63  /* Check that all the regions in the map are on the name list */
64 
65  CPPUNIT_ASSERT_EQUAL (RegionFactory::region_map.size(), RegionFactory::region_name_map.size());
66 
67  for (RegionFactory::RegionMap::iterator i = RegionFactory::region_map.begin(); i != RegionFactory::region_map.end(); ++i) {
68  CPPUNIT_ASSERT (RegionFactory::region_name_map.find (i->second->name()) != RegionFactory::region_name_map.end ());
69  }
70 }
Definition: Beats.hpp:239
CPPUNIT_TEST_SUITE_REGISTRATION(RegionNamingTest)
Definition: amp.h:29
std::string name() const