X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-application.cpp;h=df3ae2e08b19ae4544ae8b0c0014683d6a31a521;hp=5aa928e2a3dffa2d183171f212ffeb942ebb6e9e;hb=cc82bd9b187cda8fe2c8336b73fd1fa9376cfebd;hpb=fa6279fb2830427d5ab569ca14e6ade1557ef2fa diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp index 5aa928e..df3ae2e 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp @@ -1,18 +1,19 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #include "test-application.h" @@ -23,12 +24,15 @@ namespace Dali TestApplication::TestApplication( size_t surfaceWidth, size_t surfaceHeight, float horizontalDpi, - float verticalDpi) + float verticalDpi, + ResourcePolicy::DataRetention policy) : mCore( NULL ), mSurfaceWidth( surfaceWidth ), mSurfaceHeight( surfaceHeight ), mFrame( 0u ), - mDpi( horizontalDpi, verticalDpi ) + mDpi( horizontalDpi, verticalDpi ), + mLastVSyncTime(0u), + mDataRetentionPolicy( policy ) { Initialize(); } @@ -37,12 +41,14 @@ TestApplication::TestApplication( bool initialize, size_t surfaceWidth, size_t surfaceHeight, float horizontalDpi, - float verticalDpi ) + float verticalDpi, + ResourcePolicy::DataRetention policy) : mCore( NULL ), mSurfaceWidth( surfaceWidth ), mSurfaceHeight( surfaceHeight ), mFrame( 0u ), - mDpi( horizontalDpi, verticalDpi ) + mDpi( horizontalDpi, verticalDpi ), + mDataRetentionPolicy( policy ) { if ( initialize ) { @@ -57,7 +63,8 @@ void TestApplication::Initialize() mPlatformAbstraction, mGlAbstraction, mGlSyncAbstraction, - mGestureManager ); + mGestureManager, + mDataRetentionPolicy); mCore->ContextCreated(); mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); @@ -65,6 +72,8 @@ void TestApplication::Initialize() Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); Dali::Integration::Log::InstallLogFunction(logFunction); + + mCore->SceneCreated(); } TestApplication::~TestApplication() @@ -141,15 +150,23 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height ) mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); } -bool TestApplication::Render( unsigned int intervalMilliseconds ) +void TestApplication::DoUpdate( unsigned int intervalMilliseconds ) { - // Update Time values - mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds ); unsigned int seconds(0u), microseconds(0u); mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds ); + mLastVSyncTime = ( seconds * 1e3 ) + ( microseconds / 1e3 ); + unsigned int nextVSyncTime = mLastVSyncTime + 16; + + // Update Time values + mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds ); + + float elapsedSeconds = intervalMilliseconds / 1e3f; + mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus ); +} - mCore->VSync( mFrame, seconds, microseconds ); - mCore->Update( mStatus ); +bool TestApplication::Render( unsigned int intervalMilliseconds ) +{ + DoUpdate( intervalMilliseconds ); mCore->Render( mRenderStatus ); mFrame++; @@ -164,14 +181,7 @@ unsigned int TestApplication::GetUpdateStatus() bool TestApplication::UpdateOnly( unsigned int intervalMilliseconds ) { - // Update Time values - mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds ); - unsigned int seconds(0u), microseconds(0u); - mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds ); - - mCore->VSync( mFrame, seconds, microseconds ); - mCore->Update( mStatus ); - + DoUpdate( intervalMilliseconds ); return mStatus.KeepUpdating(); } @@ -187,7 +197,7 @@ bool TestApplication::RenderOnly( ) void TestApplication::ResetContext() { - mCore->ContextToBeDestroyed(); + mCore->ContextDestroyed(); mCore->ContextCreated(); }