/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
+#include <dali/public-api/signals/dali-signal.h>
namespace Dali
{
typedef IntrusivePtr<Timer> TimerPtr;
+Dali::Timer::TimerSignalType gTickSignal;
+int gTimerCount = 0;
+
/**
* Implementation of the timer
*/
class Timer : public BaseObject
{
public:
+ void MockEmitSignal();
+
+public:
static TimerPtr New( unsigned int milliSec );
Timer( unsigned int milliSec );
virtual ~Timer();
public: // Signals
- Dali::Timer::TimerSignalV2& TickSignal();
+ Dali::Timer::TimerSignalType& TickSignal();
private: // Implementation
private: // Data
- Dali::Timer::TimerSignalV2 mTickSignal;
unsigned int mInterval;
};
TimerPtr Timer::New( unsigned int milliSec )
{
- TimerPtr timerImpl = new Timer(10);
+ TimerPtr timerImpl = new Timer( milliSec );
return timerImpl;
}
Timer::Timer( unsigned int milliSec )
: mInterval( milliSec )
{
+ ++gTimerCount;
}
Timer::~Timer()
{
+ --gTimerCount;
}
void Timer::Start()
return false;
}
-Dali::Timer::TimerSignalV2& Timer::TickSignal()
+Dali::Timer::TimerSignalType& Timer::TickSignal()
+{
+ return gTickSignal;
+}
+
+// Mock setup functions:
+
+void Timer::MockEmitSignal()
{
- return mTickSignal;
+ if( gTimerCount > 1 )
+ {
+ // Only emit the signal if we have more than just the timer created in the test function
+ gTickSignal.Emit();
+ }
}
+
} // namespace Adaptor
} // namespace Internal
return true;
}
-Timer::TimerSignalV2& Timer::TickSignal()
+Timer::TimerSignalType& Timer::TickSignal()
{
return Internal::Adaptor::GetImplementation( *this ).TickSignal();
}
{
}
+// Mock setup functions:
+
+void Timer::MockEmitSignal()
+{
+ Internal::Adaptor::GetImplementation( *this ).MockEmitSignal();
+}
+
} // namespace Dali
+
+namespace Test
+{
+
+int GetTimerCount()
+{
+ return Dali::Internal::Adaptor::gTimerCount;
+}
+
+void EmitGlobalTimerSignal()
+{
+ Dali::Internal::Adaptor::gTickSignal.Emit();
+}
+
+}