further planning the features of time::Change
This commit is contained in:
parent
4731afefb8
commit
9004818d63
4 changed files with 154 additions and 0 deletions
|
|
@ -40,6 +40,17 @@
|
|||
** of time-like entities -- be it the running time display in a GUI widget, a ruler marker
|
||||
** which can be dragged, a modifiable selection or the animated playhead cursor.
|
||||
**
|
||||
** \par implementation notes
|
||||
** - the validity of a given combination of change and target is checked immediately,
|
||||
** when connecting to the target. Depending on the situation, the actual changes later
|
||||
** are subject to specific treatment (e.g. frame quantisation)
|
||||
** - by default time::Control is <b>not threadsafe</b>. But, as each change is basically
|
||||
** processed within its own call context (function invocation), parallelism is only
|
||||
** a concern with respect to the value finally visible within the target.
|
||||
** - the change notification is processed right away, after applying the change to the
|
||||
** target; in all cases, the effective change value is what will be propagated, \em not
|
||||
** the content of the target after applying the change
|
||||
**
|
||||
** @todo WIP-WIP-WIP
|
||||
**
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
|
||||
#include "lib/error.hpp"
|
||||
#include "include/play-facade.h"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
|
|
|
|||
|
|
@ -688,6 +688,11 @@ return: 0
|
|||
END
|
||||
|
||||
|
||||
PLANNED "Life changing time specifications with feedback" TimeControl_test <<END
|
||||
return: 0
|
||||
END
|
||||
|
||||
|
||||
TEST "Quantiser API basics" QuantiserBasics_test <<END
|
||||
return: 0
|
||||
END
|
||||
|
|
|
|||
137
tests/lib/time/time-control-test.cpp
Normal file
137
tests/lib/time/time-control-test.cpp
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
TimeControl(Test) - mutating time entities with life connection and feedback
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2011, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "lib/test/test-helper.hpp"
|
||||
#include "lib/time/timevalue.hpp"
|
||||
#include "lib/time/timequant.hpp"
|
||||
#include "lib/time/mutation.hpp"
|
||||
#include "proc/asset/meta/time-grid.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using boost::lexical_cast;
|
||||
using util::isnil;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace time{
|
||||
namespace test{
|
||||
|
||||
using asset::meta::TimeGrid;
|
||||
|
||||
namespace {
|
||||
inline string
|
||||
pop (Arg arg)
|
||||
{
|
||||
if (isnil (arg)) return "";
|
||||
string entry = arg[0];
|
||||
arg.erase (arg.begin());
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* @test use the time::Control to push a sequence of modifications
|
||||
* to various time entities; in all cases, a suitable change
|
||||
* should be imposed to the target and then a notification signal
|
||||
* should be invoked.
|
||||
* @todo cover the cases.....
|
||||
* - change to a given value
|
||||
* - change by an offset
|
||||
* - change using a grid value
|
||||
* - apply an (grid) increment
|
||||
*/
|
||||
class TimeControl_test : public Test
|
||||
{
|
||||
gavl_time_t
|
||||
random_or_get (string arg)
|
||||
{
|
||||
if (isnil(arg))
|
||||
return gavl_time_t (1 + (rand() % 100000)) * GAVL_TIME_SCALE;
|
||||
else
|
||||
return lexical_cast<gavl_time_t> (arg);
|
||||
}
|
||||
|
||||
struct TestValues
|
||||
{
|
||||
TimeVar var;
|
||||
Duration dur;
|
||||
TimeSpan span;
|
||||
QuTime quant;
|
||||
|
||||
TestValues (TimeValue o)
|
||||
: var(o)
|
||||
, dur(o)
|
||||
, span(o, Offset(o))
|
||||
, quant(o, "test_grid")
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
virtual void
|
||||
run (Arg arg)
|
||||
{
|
||||
TimeValue o (random_or_get (pop(arg)));
|
||||
TimeValue c (random_or_get (pop(arg)));
|
||||
CHECK (o != c, "unsuitable testdata");
|
||||
|
||||
// using a 25fps-grid, but with an time origin offset by 1/50sec
|
||||
TimeGrid::build("test_grid", FrameRate::PAL, Time(FSecs(1,50)));
|
||||
|
||||
QuTime qChange (c, "test_grid");
|
||||
FrameNr count(qChange);
|
||||
|
||||
verifyBasics();
|
||||
runningMutations();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
verifyBasics()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
runningMutations ()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** Register this test class... */
|
||||
LAUNCHER (TimeControl_test, "unit common");
|
||||
|
||||
|
||||
|
||||
}}} // namespace lib::time::test
|
||||
Loading…
Reference in a new issue