mSurfaceHeight( surfaceHeight ),
mFrame( 0u ),
mDpi( horizontalDpi, verticalDpi ),
+ mLastVSyncTime(0u),
mDataRetentionPolicy( policy )
{
if ( initialize )
void TestApplication::DoUpdate( unsigned int intervalMilliseconds )
{
- uint64_t seconds(0u), nanoseconds(0u);
- mPlatformAbstraction.GetTimeNanoseconds( seconds, nanoseconds );
- mLastVSyncTime = ( seconds * 1e3 ) + ( nanoseconds / 1e6 );
- unsigned int nextVSyncTime = mLastVSyncTime + 16;
-
- // Update Time values
- mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
-
+ unsigned int nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
float elapsedSeconds = intervalMilliseconds / 1e3f;
+
mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus );
+
+ mLastVSyncTime = nextVSyncTime;
}
bool TestApplication::Render( unsigned int intervalMilliseconds )
namespace Dali
{
-namespace
-{
-const unsigned int NANOSECONDS_PER_MILLISECOND = 1000000u;
-const unsigned int NANOSECONDS_PER_SECOND = 1000000000u;
-}
-
TestPlatformAbstraction::TestPlatformAbstraction()
: mTrace(),
- mSeconds( 0u ),
- mNanoSeconds( 0u ),
mIsLoadingResult( false ),
mGetDefaultFontSizeResult( 0 ),
mResources(),
{
}
-void TestPlatformAbstraction::GetTimeNanoseconds( uint64_t& seconds, uint64_t& nanoseconds )
-{
- seconds = mSeconds;
- nanoseconds = mNanoSeconds;
- mTrace.PushCall("GetTimeNanoseconds", "");
-}
-
void TestPlatformAbstraction::Suspend()
{
mTrace.PushCall("Suspend", "");
mTrace.Reset();
mTrace.Enable(true);
memset(&mResources, 0, sizeof(Resources));
- mSeconds=0;
- mNanoSeconds=0;
mIsLoadingResult=false;
if(mRequest)
{
switch(func)
{
- case GetTimeNanosecondsFunc: return mTrace.FindMethod("GetTimeNanoseconds");
case SuspendFunc: return mTrace.FindMethod("Suspend");
case ResumeFunc: return mTrace.FindMethod("Resume");
case LoadResourceFunc: return mTrace.FindMethod("LoadResource");
return false;
}
-void TestPlatformAbstraction::SetGetTimeNanosecondsResult(size_t sec, size_t nsec)
-{
- mSeconds = sec;
- mNanoSeconds = nsec;
-}
-
-void TestPlatformAbstraction::IncrementGetTimeResult(size_t milliseconds)
-{
- mNanoSeconds += milliseconds * NANOSECONDS_PER_MILLISECOND;
- unsigned int additionalSeconds = mNanoSeconds / NANOSECONDS_PER_SECOND;
-
- mSeconds += additionalSeconds;
- mNanoSeconds -= additionalSeconds * NANOSECONDS_PER_SECOND;
-}
-
void TestPlatformAbstraction::SetIsLoadingResult(bool result)
{
mIsLoadingResult = result;
*/
virtual ~TestPlatformAbstraction();
- /**
- * @copydoc PlatformAbstraction::GetTimeNanoseconds()
- */
- virtual void GetTimeNanoseconds( uint64_t& seconds, uint64_t& nanoseconds );
-
/**
* @copydoc PlatformAbstraction::Suspend()
*/
// Enumeration of Platform Abstraction methods
typedef enum
{
- GetTimeNanosecondsFunc,
SuspendFunc,
ResumeFunc,
LoadResourceFunc,
bool WasCalled(TestFuncEnum func);
- void SetGetTimeNanosecondsResult(size_t sec, size_t nsec);
-
- void IncrementGetTimeResult(size_t milliseconds);
-
void SetIsLoadingResult(bool result);
void SetGetDefaultFontSizeResult(float result);
private:
mutable TraceCallStack mTrace;
- uint64_t mSeconds;
- uint64_t mNanoSeconds;
bool mIsLoadingResult;
int mGetDefaultFontSizeResult;
Resources mResources;