projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update common test util
[platform/core/uifw/dali-toolkit.git]
/
automated-tests
/
src
/
dali-toolkit
/
dali-toolkit-test-utils
/
toolkit-timer.cpp
diff --git
a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
index
4ab6a57
..
2259719
100644
(file)
--- a/
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
+++ b/
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 201
4
Samsung Electronics Co., Ltd.
+ * Copyright (c) 201
6
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-20,7
+20,7
@@
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/object/base-object.h>
// 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
{
namespace Dali
{
@@
-34,12
+34,18
@@
class Timer;
typedef IntrusivePtr<Timer> TimerPtr;
typedef IntrusivePtr<Timer> TimerPtr;
+Dali::Timer::TimerSignalType gTickSignal;
+int gTimerCount = 0;
+
/**
* Implementation of the timer
*/
class Timer : public BaseObject
{
public:
/**
* Implementation of the timer
*/
class Timer : public BaseObject
{
public:
+ void MockEmitSignal();
+
+public:
static TimerPtr New( unsigned int milliSec );
Timer( unsigned int milliSec );
virtual ~Timer();
static TimerPtr New( unsigned int milliSec );
Timer( unsigned int milliSec );
virtual ~Timer();
@@
-53,7
+59,7
@@
public:
public: // Signals
public: // Signals
- Dali::Timer::TimerSignal
V2
& TickSignal();
+ Dali::Timer::TimerSignal
Type
& TickSignal();
private: // Implementation
private: // Implementation
@@
-63,7
+69,6
@@
private: // Implementation
private: // Data
private: // Data
- Dali::Timer::TimerSignalV2 mTickSignal;
unsigned int mInterval;
};
unsigned int mInterval;
};
@@
-87,17
+92,19
@@
inline const Timer& GetImplementation(const Dali::Timer& timer)
TimerPtr Timer::New( unsigned int milliSec )
{
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 )
{
return timerImpl;
}
Timer::Timer( unsigned int milliSec )
: mInterval( milliSec )
{
+ ++gTimerCount;
}
Timer::~Timer()
{
}
Timer::~Timer()
{
+ --gTimerCount;
}
void Timer::Start()
}
void Timer::Start()
@@
-128,11
+135,23
@@
bool Timer::Tick()
return false;
}
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
} // namespace Adaptor
} // namespace Internal
@@
-196,7
+215,7
@@
bool Timer::IsRunning() const
return true;
}
return true;
}
-Timer::TimerSignal
V2
& Timer::TickSignal()
+Timer::TimerSignal
Type
& Timer::TickSignal()
{
return Internal::Adaptor::GetImplementation( *this ).TickSignal();
}
{
return Internal::Adaptor::GetImplementation( *this ).TickSignal();
}
@@
-206,5
+225,27
@@
Timer::Timer(Internal::Adaptor::Timer* timer)
{
}
{
}
+// Mock setup functions:
+
+void Timer::MockEmitSignal()
+{
+ Internal::Adaptor::GetImplementation( *this ).MockEmitSignal();
+}
+
} // namespace Dali
} // namespace Dali
+
+namespace Test
+{
+
+int GetTimerCount()
+{
+ return Dali::Internal::Adaptor::gTimerCount;
+}
+
+void EmitGlobalTimerSignal()
+{
+ Dali::Internal::Adaptor::gTickSignal.Emit();
+}
+
+}