27 #include <boost/lexical_cast.hpp> 30 using boost::lexical_cast;
45 if (isnil (arg))
return "";
46 string entry = arg[0];
47 arg.erase (arg.begin());
65 random_or_get (
string arg)
70 return lexical_cast<gavl_time_t> (arg);
84 , quant(o,
"test_grid")
96 CHECK (o != c,
"unsuitable testdata");
101 QuTime qChange (c,
"test_grid");
104 mutate_by_Value (o,
Time(c));
105 mutate_by_Offset (o,
Offset(c));
106 mutate_quantised (o, qChange);
107 mutate_by_Increment(o, count);
116 CHECK (t.span.start() == original);
118 CHECK (t.span.start() != original);
119 CHECK (t.span.start() == newStart);
123 t.span.
accept (change_back);
124 CHECK (t.span.start() == original);
126 CHECK (t.quant == original);
128 CHECK (t.quant != original);
129 CHECK (t.quant == newStart);
132 VERIFY_ERROR (INVALID_MUTATION, t.dur.accept(change_back));
133 VERIFY_ERROR (INVALID_MUTATION, t.span.duration().accept(change_back));
135 CHECK (t.dur == original);
137 CHECK (t.dur != original);
138 CHECK (t.dur == t.var*2);
140 CHECK (t.span.start() == original);
141 CHECK (t.span.duration() == original);
143 CHECK (t.span.duration() != original);
144 CHECK (t.span.duration() == t.var*3);
145 CHECK (t.span.start() == original);
158 CHECK (t.span == original);
159 CHECK (t.span != should_be);
161 CHECK (t.span == should_be);
164 CHECK (t.dur == should_be);
167 CHECK (t.quant == should_be);
172 CHECK (t.span == original);
176 CHECK (t.span ==
Time(original) - 3*change);
185 CHECK (
Time(change) == t.var);
187 CHECK (t.span == original);
189 CHECK (t.span != original);
190 CHECK (t.span != t.var);
195 Time materialised (quantiser->materialise(change));
196 CHECK (t.span == materialised);
198 CHECK (t.span.duration() == original);
202 CHECK (t.quant == original);
204 CHECK (t.quant != original);
205 CHECK (t.quant == materialised);
213 QuTime funny (original,
"special_funny_grid");
215 CHECK (funny == t.quant);
217 Time doublyQuantised (
PQuant(funny)->materialise(funny));
218 CHECK (doublyQuantised != materialised);
223 mutate_by_Increment (
TimeValue original,
int change)
233 CHECK (t.span.start() == t.var);
234 CHECK (t.dur == t.var);
238 CHECK (t.dur != t.var);
243 Offset distance (testGrid->timeOf(0), testGrid->timeOf(change));
245 CHECK (t.dur - t.var == distance);
253 CHECK (t.quant != original);
255 CHECK (frameNr_after == frameNr + change);
a mutable time value, behaving like a plain number, allowing copy and re-accessing ...
Modifying time and timecode values.
static PQuant retrieve(Symbol gridID)
Access an existing grid definition or quantiser, known by the given symbolic ID.
static EncapsulatedMutation changeTime(Time)
Convenience factory to yield a simple Mutation changing the absolute start time.
void accept(Mutation const &)
may change start / duration
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
static const gavl_time_t SCALE
Number of micro ticks (µs) per second as basic time scale.
static EncapsulatedMutation adjust(Offset)
Convenience factory: simple Mutation to adjust the duration or length of a timespan.
int rani(uint bound=_iBOUND())
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
void accept(Mutation const &)
receive change message, which might cause re-quantisation
Implementation namespace for support and library code.
Lumiera's internal time value datatype.
format::Traits< FMT >::TimeCode formatAs() const
create new time code instance, then castInto
static EncapsulatedMutation materialise(QuTime const &)
Convenience factory: materialise the given quantised time into an explicit fixed internal time value...
Simplistic test class runner.
Template to build polymorphic value objects.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
boost::rational< int64_t > FSecs
rational representation of fractional seconds
A collection of frequently used helper functions to support unit testing.
Duration duration() const
duration of one frame
Support library to represent grid-aligned time specifications This is part of Lumiera's time and time...
Offset measures a distance in time.
To establish a reference scale for quantised time values.
static EncapsulatedMutation nudge(int adjustment)
build a time mutation to nudge the target time value by an offset, defined as number of steps on an i...
Duration is the internal Lumiera time metric.
static EncapsulatedMutation changeDuration(Duration)
Convenience factory: simple Mutation to adjust the duration or length of a timespan.
A time interval anchored at a specific point in time.
A frame counting timecode value.
a family of time value like entities and their relationships.
basic constant internal time value.
static const FrameRate PAL
predefined constant for PAL framerate
grid aligned time specification, referring to a specific scale.