time::Control simple unit test pass
This commit is contained in:
parent
c96cd66688
commit
eed2b0f320
5 changed files with 16 additions and 3 deletions
|
|
@ -187,6 +187,7 @@ namespace lib {
|
|||
{
|
||||
if (created_)
|
||||
get()->~TY();
|
||||
created_ = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -342,6 +342,11 @@ namespace time {
|
|||
void
|
||||
Control<TI>::connectChangeNotification (SIG const& toNotify)
|
||||
{
|
||||
if (this->offset_)
|
||||
{ // we're already connected: thus propagate current value
|
||||
TI currentValue = this->offset_(Offset::ZERO);
|
||||
toNotify (currentValue);
|
||||
}
|
||||
notifyListeners_.attach (toNotify);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ namespace time {
|
|||
const Time Time::MIN ( TimeValue::buildRaw_(-_raw(Time::MAX) ) );
|
||||
const Time Time::ZERO;
|
||||
|
||||
const Offset Offset::ZERO (Time::ZERO);
|
||||
|
||||
|
||||
|
||||
/** convenience constructor to build an
|
||||
* internal Lumiera Time value from the usual parts
|
||||
|
|
|
|||
|
|
@ -193,6 +193,8 @@ namespace time {
|
|||
: TimeValue(TimeVar(target) -= origin)
|
||||
{ }
|
||||
|
||||
static const Offset ZERO;
|
||||
|
||||
TimeValue
|
||||
abs() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ namespace test{
|
|||
ScopedHolder<TI> received_;
|
||||
|
||||
public:
|
||||
TestListener() { received_.create (Time::ZERO); }
|
||||
|
||||
void
|
||||
operator() (TI const& changeValue) const
|
||||
{
|
||||
|
|
@ -173,7 +175,7 @@ namespace test{
|
|||
|
||||
target.accept (controller);
|
||||
CHECK (Time(0,10) == target);
|
||||
controller (Time(FSecs(21,5)));
|
||||
controller (Time(FSecs(21,2)));
|
||||
CHECK (Time(500,10) == target);
|
||||
|
||||
CHECK (follower.reveivedValue() == Time::ZERO);
|
||||
|
|
@ -181,8 +183,8 @@ namespace test{
|
|||
CHECK (follower.reveivedValue() == Time(500,10));
|
||||
|
||||
controller (Offset(-Time(500,1)));
|
||||
CHECK (Time(0,10) == target);
|
||||
CHECK (Time(0,10) == follower.reveivedValue());
|
||||
CHECK (Time(0,9) == target);
|
||||
CHECK (Time(0,9) == follower.reveivedValue());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue