27 #include <boost/lexical_cast.hpp> 29 using boost::lexical_cast;
53 random_or_get (Arg arg)
58 return 1 +
rani(100
'000); 60 else // use argument as 1/10 seconds 61 return 10 * lexical_cast<int> (arg[1]); 73 Time ref (random_or_get(arg),0,0,0); 74 CHECK (TimeValue(0) < ref); 76 checkSimpleUsage (ref); 77 check_theFullStory (ref); 78 checkMultipleGrids (ref); 79 checkGridBinding (ref); 84 checkSimpleUsage (TimeValue org) 86 TimeGrid::build("my_simple_grid", 25); // "someone" has defined a time grid 88 QuTime qVal (org, "my_simple_grid"); // create time quantised to this grid 90 FrameNr count(qVal); // materialise this quantised time into.. 91 int n = count; // frame count, accessible as plain number 93 CHECK (Time(FSecs(n, 25)) <= org); // verify quantisation: the original time 94 CHECK (org < Time(FSecs(n+1, 25))); // is properly bracketed by [n, n+1[ 99 check_theFullStory (TimeValue org) 101 cout << "TEST rawTime:"<<Time{org} << endl; 102 PQuant fixQ (new FixedFrameQuantiser(25)); 103 QuTime qVal (org, fixQ); 105 CHECK ( qVal == org); // Note: stores the raw value, but tagged with a grid 106 CHECK ( fixQ.get() == PQuant(qVal).get()); 107 CHECK ( qVal.supports<format::Frames>()); 108 CHECK ( qVal.supports<format::Smpte>()); 110 SmpteTC smpteTCode = qVal.formatAs<format::Smpte>(); 111 showTimeCode (smpteTCode); 113 HmsTC pureTimeCode = qVal.formatAs<format::Hms>(); 114 showTimeCode (pureTimeCode); ////////////////////////////////////////////////////////////////TICKET #736 : HMS not implemented yet 116 FrameNr frameTCode = qVal.formatAs<format::Frames>(); 117 showTimeCode (frameTCode); 119 Secs seconds = qVal.formatAs<format::Seconds>(); 120 showTimeCode (seconds); ////////////////////////////////////////////////////////////////TICKET #736 : Seconds not implemented yet 125 showTimeCode (TC timecodeValue) 127 cout << timecodeValue.describe() 128 << " time = "<< timecodeValue.getTime() 129 << " code = "<< timecodeValue 135 checkMultipleGrids (TimeValue org) 137 TimeGrid::build("my_alternate_grid", FrameRate::NTSC); 139 QuTime palVal (org, "my_simple_grid"); 140 QuTime ntscVal (org, "my_alternate_grid"); 142 CHECK (org == palVal); 143 CHECK (org == ntscVal); 145 FrameNr palNr (palVal); 146 FrameNr ntscNr(ntscVal); 147 CHECK (palNr <= ntscNr); 152 checkGridBinding (TimeValue org) 154 // refer to a grid not yet defined 155 VERIFY_ERROR (UNKNOWN_GRID, QuTime weird(org, "special_funny_grid")); 157 TimeGrid::build("special_funny_grid", 1); // provide the grid's definition (1 frame per second)
159 QuTime funny (org,
"special_funny_grid");
163 CHECK (0 == smpte.frames);
164 CHECK (cnt % 60 == smpte.secs);
Classical Timecode value reminiscent to SMPTE format.
int rani(uint bound=_iBOUND())
Implementation namespace for support and library code.
format::Traits< FMT >::TimeCode formatAs() const
create new time code instance, then castInto
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A collection of frequently used helper functions to support unit testing.
Support library to represent grid-aligned time specifications This is part of Lumiera's time and time...
To establish a reference scale for quantised time values.
bool contains(SEQ const &cont, typename SEQ::const_reference val)
shortcut for brute-force containment test in any sequential container
grid aligned time specification, referring to a specific scale.