36 #include <boost/lexical_cast.hpp> 39 using boost::lexical_cast;
54 if (isnil (arg))
return "";
55 string entry = arg[0];
56 arg.erase (arg.begin());
74 random_or_get (
string arg)
79 return lexical_cast<gavl_time_t> (arg);
93 , quant(o,
"test_grid")
103 CHECK (o != c,
"unsuitable testdata");
108 QuTime qChange (c,
"test_grid");
111 mutate_by_Value (o,
Time(c));
112 mutate_by_Offset (o,
Offset(c));
113 mutate_quantised (o, qChange);
114 mutate_by_Increment(o, count);
123 CHECK (t.span.start() == original);
125 CHECK (t.span.start() != original);
126 CHECK (t.span.start() == newStart);
130 t.span.
accept (change_back);
131 CHECK (t.span.start() == original);
133 CHECK (t.quant == original);
135 CHECK (t.quant != original);
136 CHECK (t.quant == newStart);
139 VERIFY_ERROR (INVALID_MUTATION, t.dur.accept(change_back));
140 VERIFY_ERROR (INVALID_MUTATION, t.span.duration().accept(change_back));
142 CHECK (t.dur == original);
144 CHECK (t.dur != original);
145 CHECK (t.dur == t.var*2);
147 CHECK (t.span.start() == original);
148 CHECK (t.span.duration() == original);
150 CHECK (t.span.duration() != original);
151 CHECK (t.span.duration() == t.var*3);
152 CHECK (t.span.start() == original);
165 CHECK (t.span == original);
166 CHECK (t.span != should_be);
168 CHECK (t.span == should_be);
171 CHECK (t.dur == should_be);
174 CHECK (t.quant == should_be);
179 CHECK (t.span == original);
183 CHECK (t.span ==
Time(original) - 3*change);
192 CHECK (
Time(change) == t.var);
194 CHECK (t.span == original);
196 CHECK (t.span != original);
197 CHECK (t.span != t.var);
202 Time materialised (quantiser->materialise(change));
203 CHECK (t.span == materialised);
205 CHECK (t.span.duration() == original);
209 CHECK (t.quant == original);
211 CHECK (t.quant != original);
212 CHECK (t.quant == materialised);
220 QuTime funny (original,
"special_funny_grid");
222 CHECK (funny == t.quant);
224 Time doublyQuantised (
PQuant(funny)->materialise(funny));
225 CHECK (doublyQuantised != materialised);
230 mutate_by_Increment (
TimeValue original,
int change)
240 CHECK (t.span.start() == t.var);
241 CHECK (t.dur == t.var);
245 CHECK (t.dur != t.var);
250 Offset distance (testGrid->timeOf(0), testGrid->timeOf(change));
252 CHECK (t.dur - t.var == distance);
260 CHECK (t.quant != original);
262 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.
#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...
Simple 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.