/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
END_TEST;
}
+int UtcDaliTimerSetInterval02(void)
+{
+ AdaptorTestApplication application;
+
+ tet_printf("timer set interval 02 \n");
+ Timer timer = Timer::New(10);
+ timer.SetInterval(20);
+
+ DALI_TEST_CHECK( timer.GetInterval() == 20 );
+ DALI_TEST_CHECK( timer.IsRunning() == true );
+
+ timer.SetInterval(5000, false);
+
+ DALI_TEST_CHECK( timer.GetInterval() == 5000 );
+ DALI_TEST_CHECK( timer.IsRunning() == false );
+
+ END_TEST;
+}
+
+int UtcDaliTimerSetInterval03(void)
+{
+ AdaptorTestApplication application;
+
+ tet_printf("UtcDaliTimerSetInterval03 SetInterval and ensure timer restarts \n");
+ Timer timer = Timer::New(10);
+ timer.SetInterval(20);
+
+ DALI_TEST_CHECK( timer.GetInterval() == 20 );
+ DALI_TEST_CHECK( timer.IsRunning() == true );
+
+ timer.SetInterval(5000, true);
+
+ DALI_TEST_CHECK( timer.GetInterval() == 5000 );
+ DALI_TEST_CHECK( timer.IsRunning() == true );
+
+ END_TEST;
+}
+
int UtcDaliTimerCopyConstructor(void)
{
AdaptorTestApplication application;
ResetTimerData();
}
-void Timer::SetInterval( unsigned int interval )
+void Timer::Pause()
+{
+ // Timer should be used in the event thread
+ DALI_ASSERT_DEBUG( Adaptor::IsAvailable() );
+
+ if( mImpl->mId != NULL )
+ {
+ ecore_timer_freeze( mImpl->mId );
+ }
+}
+
+void Timer::Resume()
+{
+ // Timer should be used in the event thread
+ DALI_ASSERT_DEBUG( Adaptor::IsAvailable() );
+
+ if( mImpl->mId != NULL )
+ {
+ ecore_timer_thaw( mImpl->mId );
+ }
+}
+
+void Timer::SetInterval( unsigned int interval, bool restart )
{
// stop existing timer
Stop();
mImpl->mInterval = interval;
- // start new tick
- Start();
+
+ if( restart )
+ {
+ // start new tick
+ Start();
+ }
}
unsigned int Timer::GetInterval() const
virtual void Stop();
/**
+ * @copydoc Dali::Timer::Pause()
+ */
+ virtual void Pause();
+
+ /**
+ * @copydoc Dali::Timer::Resume()
+ */
+ virtual void Resume();
+
+ /**
* @copydoc Dali::Timer::SetInterval()
*/
- virtual void SetInterval( unsigned int interval );
+ virtual void SetInterval( unsigned int interval, bool restart );
/**
* @copydoc Dali::Timer::GetInterval()
#define __DALI_INTERNAL_ADAPTOR_BASE_TIMER_INTERFACE_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
virtual void Stop() = 0;
/**
+ * @copydoc Dali::Timer::Pause()
+ */
+ virtual void Pause() = 0;
+
+ /**
+ * @copydoc Dali::Timer::Resume()
+ */
+ virtual void Resume() = 0;
+
+ /**
* @copydoc Dali::Timer::SetInterval()
*/
- virtual void SetInterval( unsigned int intervalInMilliseconds ) = 0;
+ virtual void SetInterval( unsigned int intervalInMilliseconds, bool restart ) = 0;
/**
* @copydoc Dali::Timer::GetInterval()
Internal::Adaptor::GetImplementation(*this).Stop();
}
+void Timer::Pause()
+{
+ Internal::Adaptor::GetImplementation(*this).Pause();
+}
+
+void Timer::Resume()
+{
+ Internal::Adaptor::GetImplementation(*this).Resume();
+}
+
void Timer::SetInterval( unsigned int interval )
{
- Internal::Adaptor::GetImplementation(*this).SetInterval( interval );
+ Internal::Adaptor::GetImplementation(*this).SetInterval( interval, true );
+}
+
+void Timer::SetInterval( unsigned int interval, bool restart )
+{
+ Internal::Adaptor::GetImplementation(*this).SetInterval( interval, restart );
}
unsigned int Timer::GetInterval() const
void Stop();
/**
+ * @brief Pauses timer.
+ * @SINCE_1_3.41
+ */
+ void Pause();
+
+ /**
+ * @brief Resumes timer.
+ * @SINCE_1_3.41
+ */
+ void Resume();
+
+ /**
* @brief Sets a new interval on the timer and starts the timer.
*
* Cancels the previous timer.
void SetInterval( unsigned int milliSec );
/**
+ * @brief Sets a new interval on the timer with option to restart the timer.
+ *
+ * Cancels the previous timer.
+ * @SINCE_1_3.41
+ * @param[in] milliSec Interval in milliseconds
+ * @param[in] restart Flag to set enabled to restart or not.
+ */
+ void SetInterval( unsigned int milliSec, bool restart );
+
+ /**
* @brief Gets the interval of timer.
*
* @SINCE_1_0.0