2 Copyright (C) 2012 Paul Davis
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.
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.
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.
19 #include "ardour/playlist.h"
20 #include "ardour/region.h"
21 #include "ardour/region_factory.h"
22 #include "region_naming_test.h"
24 CPPUNIT_TEST_SUITE_REGISTRATION (RegionNamingTest);
27 using namespace ARDOUR;
30 RegionNamingTest::basicsTest ()
32 for (int i = 0; i < 64; ++i) {
33 boost::shared_ptr<Region> r = RegionFactory::create (_r[0], true);
35 s << "ar0." << (i + 1);
36 CPPUNIT_ASSERT_EQUAL (s.str(), r->name());
39 _r[0]->set_name ("foo");
41 for (int i = 0; i < 64; ++i) {
42 boost::shared_ptr<Region> r = RegionFactory::create (_r[0], true);
44 s << "foo." << (i + 1);
45 CPPUNIT_ASSERT_EQUAL (s.str(), r->name());
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);
52 s << "foo." << (i * 2 + 64 + 1);
53 CPPUNIT_ASSERT_EQUAL (s.str(), rA->name());
55 t << "foo." << (i * 2 + 64 + 2);
56 CPPUNIT_ASSERT_EQUAL (s.str(), rA->name());
61 RegionNamingTest::cacheTest ()
63 /* Check that all the regions in the map are on the name list */
65 CPPUNIT_ASSERT_EQUAL (RegionFactory::region_map.size(), RegionFactory::region_name_map.size());
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 ());