diff --git a/src/lib/time/digxel.hpp b/src/lib/time/digxel.hpp index 6ade5c742..7256c0061 100644 --- a/src/lib/time/digxel.hpp +++ b/src/lib/time/digxel.hpp @@ -172,7 +172,7 @@ namespace time { struct CountFormatter : PrintfFormatter { - CountFormatter() : PrintfFormatter("%04l") { } + CountFormatter() : PrintfFormatter("%04ld") { } }; } //(End) digxel configuration namespace diff --git a/src/lib/time/timecode.hpp b/src/lib/time/timecode.hpp index 978b3c503..704db4293 100644 --- a/src/lib/time/timecode.hpp +++ b/src/lib/time/timecode.hpp @@ -86,7 +86,7 @@ namespace time { , public CountVal { - string show() const { return string(show())+"fr"; } + string show() const { return string(CountVal::show())+"fr"; } Literal tcID() const { return "Frame-count"; } TimeValue value() const { return Format::evaluate (*this, *quantiser_); } diff --git a/tests/40components.tests b/tests/40components.tests index 490730d84..3b451e8a2 100644 --- a/tests/40components.tests +++ b/tests/40components.tests @@ -247,6 +247,7 @@ out: .+Digxel.+SexaFormatter.+--empty--00--\(val=42\)--42 out: .+Digxel.+SexaFormatter.+--empty--00--\(val=-5\)---5 out: .+Digxel.+HexaFormatter.+--empty--00--\(val=12\)--0C out: .+Digxel.+HexaFormatter.+--empty--00--\(val=111\)--6F +out: .+Digxel.+CountFormatter.+--empty--0000--\(val=-1234567890\)---1234567890 return: 0 END diff --git a/tests/lib/time/digxel-configurations-test.cpp b/tests/lib/time/digxel-configurations-test.cpp index 185fd06a7..6a226eb23 100644 --- a/tests/lib/time/digxel-configurations-test.cpp +++ b/tests/lib/time/digxel-configurations-test.cpp @@ -68,6 +68,7 @@ namespace test{ verifyConfiguration (-5); verifyConfiguration (0xc); verifyConfiguration (0x6f); + verifyConfiguration (-1234567890); } diff --git a/tests/lib/time/time-formats-test.cpp b/tests/lib/time/time-formats-test.cpp index d11e5c3c2..e22c8ce1b 100644 --- a/tests/lib/time/time-formats-test.cpp +++ b/tests/lib/time/time-formats-test.cpp @@ -22,6 +22,7 @@ #include "lib/test/run.hpp" +//#include "lib/test/test-helper.hpp" #include "lib/time/timecode.hpp" #include "lib/util.hpp" @@ -43,9 +44,10 @@ namespace test{ /******************************************************** * @test verify handling of grid aligned timecode values. - * - creating timecode values - * - some conversions - * - formatting + * - full cycle from parsing to formatting + * - mutating the components of timecode + * - some formatting corner cases + * - formatting in various formats */ class TimeFormats_test : public Test { @@ -56,29 +58,55 @@ namespace test{ TimeValue ref (refval); - checkBasics (ref); - checkComparisons (ref); - checkComponentAccess(); + checkTimecodeUsageCycle (ref); + checkFrames (); + checkSeconds (); + checkHms (); + checkSmpte(); + checkDropFrame(); } void - checkBasics (TimeValue ref) + checkTimecodeUsageCycle (TimeValue ref) { + UNIMPLEMENTED ("full usage cycle for a timecode value"); } void - checkComparisons (TimeValue ref) + checkFrames () { + UNIMPLEMENTED ("verify frame count time format"); } void - checkComponentAccess() + checkSeconds () { + UNIMPLEMENTED ("verify seconds as timecode format"); } + + void + checkHms () + { + UNIMPLEMENTED ("verify hour-minutes-seconds-millis timecode"); + } + + + void + checkSmpte () + { + UNIMPLEMENTED ("verify SMPTE timecode format"); + } + + + void + checkDropFrame () + { + UNIMPLEMENTED ("verify especially SMPTE-drop-frame timecode"); + } }; diff --git a/tests/lib/time/time-quantisation-test.cpp b/tests/lib/time/time-quantisation-test.cpp index c2f0bfbf5..c1a1a2812 100644 --- a/tests/lib/time/time-quantisation-test.cpp +++ b/tests/lib/time/time-quantisation-test.cpp @@ -31,12 +31,12 @@ #include #include #include -//#include +#include using boost::lexical_cast; using util::isnil; using util::contains; -//using std::rand; +using std::rand; using std::cout; using std::endl; @@ -52,23 +52,36 @@ namespace test{ /******************************************************** * @test verify handling of quantised time values. - * - creating times and time intervals - * - comparisons - * - time arithmetics + * - the simple usage, just referring to an + * predefined grid by name + * - explicitly defining an quantiser + * - converting these quantised values into + * various timecode formats + * - error detection */ class TimeQuantisation_test : public Test { + int + random_or_get (Arg arg) + { + if (isnil(arg)) + return 1 + (rand() % 10000); + else + return lexical_cast (arg[1]); + } + + + virtual void run (Arg arg) { - long refval= isnil(arg)? 1 : lexical_cast (arg[1]); - - TimeValue ref (refval); + Time ref (random_or_get(arg)); CHECK (Time(0) < ref); checkSimpleUsage (ref); check_theFullStory (ref); checkMultipleGrids (ref); + checkGridBinding (ref); } @@ -133,12 +146,12 @@ namespace test{ FrameNr palNr (palVal); FrameNr ntscNr(ntscVal); - CHECK (palNr < ntscNr); + CHECK (palNr <= ntscNr); } void - checkGridLateBinding (TimeValue org) + checkGridBinding (TimeValue org) { // refer to a grid not yet defined VERIFY_ERROR (UNKNOWN_GRID, QuTime wired(org, "special_funny_grid"));