13
0
livetrax/libs/evoral/test/RangeTest.cpp
Carl Hetherington a2897ecef6 Fairly major change to the way in which crossfades are handled;
they are now done with region fades, rather than separate objects.
After this commit, Ardour will try to convert your session files
to the new crossfade format, but will make a backup in your
session folder first.

If you have works in progress using Ardour 3 it is
***STRONGLY RECOMMENDED*** that you back up session files before
updating to this commit.


git-svn-id: svn://localhost/ardour2/branches/3.0@11986 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-04-16 16:32:22 +00:00

85 lines
1.7 KiB
C++

#include "RangeTest.hpp"
#include "evoral/Range.hpp"
CPPUNIT_TEST_SUITE_REGISTRATION (RangeTest);
using namespace Evoral;
void
RangeTest::coalesceTest ()
{
RangeList<int> fred;
fred.add (Range<int> (2, 4));
fred.add (Range<int> (5, 6));
fred.add (Range<int> (6, 8));
RangeList<int>::List jim = fred.get ();
RangeList<int>::List::iterator i = jim.begin ();
CPPUNIT_ASSERT_EQUAL (2, i->from);
CPPUNIT_ASSERT_EQUAL (4, i->to);
++i;
CPPUNIT_ASSERT_EQUAL (5, i->from);
CPPUNIT_ASSERT_EQUAL (8, i->to);
}
void
RangeTest::subtractTest1 ()
{
Range<int> fred (0, 10);
RangeList<int> jim;
jim.add (Range<int> (2, 4));
jim.add (Range<int> (7, 8));
RangeList<int> sheila = subtract (fred, jim);
RangeList<int>::List s = sheila.get ();
CPPUNIT_ASSERT_EQUAL (size_t (3), s.size ());
RangeList<int>::List::iterator i = s.begin ();
CPPUNIT_ASSERT_EQUAL (0, i->from);
CPPUNIT_ASSERT_EQUAL (1, i->to);
++i;
CPPUNIT_ASSERT_EQUAL (4, i->from);
CPPUNIT_ASSERT_EQUAL (6, i->to);
++i;
CPPUNIT_ASSERT_EQUAL (8, i->from);
CPPUNIT_ASSERT_EQUAL (10, i->to);
}
void
RangeTest::subtractTest2 ()
{
Range<int> fred (0, 10);
RangeList<int> jim;
jim.add (Range<int> (12, 19));
RangeList<int> sheila = subtract (fred, jim);
RangeList<int>::List s = sheila.get ();
CPPUNIT_ASSERT_EQUAL (size_t (1), s.size ());
RangeList<int>::List::iterator i = s.begin ();
CPPUNIT_ASSERT_EQUAL (0, i->from);
CPPUNIT_ASSERT_EQUAL (10, i->to);
}
void
RangeTest::subtractTest3 ()
{
Range<int> fred (0, 10);
RangeList<int> jim;
jim.add (Range<int> (0, 12));
RangeList<int> sheila = subtract (fred, jim);
RangeList<int>::List s = sheila.get ();
CPPUNIT_ASSERT_EQUAL (size_t (0), s.size ());
}