X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Fdali-test-suite-utils%2Ftest-application.cpp;h=8bb7176a0f5aca266910af7a9160ce203dbb4c7a;hb=11a3c866f91cf439f404788b088bf90036f5cd48;hp=5fb6e110700c896c08d953f96fa41e2dc143cf2d;hpb=4805f154c85adcf71716d9aa6746b6ba1b44a19e;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp index 5fb6e11..8bb7176 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -62,13 +62,15 @@ void TestApplication::Initialize() // We always need the first update! mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING; - mCore = Dali::Integration::Core::New( - mRenderController, - mPlatformAbstraction, - mGlAbstraction, - mGlSyncAbstraction, - mGestureManager, - mDataRetentionPolicy); + mCore = Dali::Integration::Core::New( mRenderController, + mPlatformAbstraction, + mGlAbstraction, + mGlSyncAbstraction, + mGestureManager, + mDataRetentionPolicy, + Integration::RenderToFrameBuffer::FALSE, + Integration::DepthBufferAvailable::TRUE, + Integration::StencilBufferAvailable::TRUE ); mCore->ContextCreated(); mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); @@ -77,6 +79,11 @@ void TestApplication::Initialize() Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); Dali::Integration::Log::InstallLogFunction(logFunction); + Dali::Integration::Trace::LogContextFunction logContextFunction(&TestApplication::LogContext); + Dali::Integration::Trace::InstallLogContextFunction( logContextFunction ); + + Dali::Integration::Trace::LogContext( true, "Test" ); + mCore->SceneCreated(); } @@ -86,6 +93,18 @@ TestApplication::~TestApplication() delete mCore; } +void TestApplication::LogContext( bool start, const char* tag ) +{ + if( start ) + { + fprintf(stderr, "INFO: Trace Start: %s", tag); + } + else + { + fprintf(stderr, "INFO: Trace End: %s", tag); + } +} + void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) { switch(level) @@ -154,29 +173,34 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height ) mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); } -void TestApplication::DoUpdate( unsigned int intervalMilliseconds ) +void TestApplication::SetTopMargin( unsigned int margin ) +{ + mCore->SetTopMargin( margin ); +} + +void TestApplication::DoUpdate( unsigned int intervalMilliseconds, const char* location ) { if( GetUpdateStatus() == 0 && mRenderStatus.NeedsUpdate() == false && ! GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc) ) { - fprintf(stderr, "WARNING - Update not required\n"); + fprintf(stderr, "WARNING - Update not required :%s\n", location==NULL?"NULL":location); } unsigned int nextVSyncTime = mLastVSyncTime + intervalMilliseconds; float elapsedSeconds = intervalMilliseconds / 1e3f; - mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus ); + mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false ); GetRenderController().Initialize(); mLastVSyncTime = nextVSyncTime; } -bool TestApplication::Render( unsigned int intervalMilliseconds ) +bool TestApplication::Render( unsigned int intervalMilliseconds, const char* location ) { - DoUpdate( intervalMilliseconds ); - mCore->Render( mRenderStatus ); + DoUpdate( intervalMilliseconds, location ); + mCore->Render( mRenderStatus, false ); mFrame++; @@ -198,15 +222,11 @@ bool TestApplication::GetRenderNeedsUpdate() { return mRenderStatus.NeedsUpdate(); } -bool TestApplication::GetRenderHasRendered() -{ - return mRenderStatus.HasRendered(); -} bool TestApplication::RenderOnly( ) { // Update Time values - mCore->Render( mRenderStatus ); + mCore->Render( mRenderStatus, false ); mFrame++; @@ -216,8 +236,21 @@ bool TestApplication::RenderOnly( ) void TestApplication::ResetContext() { mCore->ContextDestroyed(); + mGlAbstraction.Initialize(); mCore->ContextCreated(); } +unsigned int TestApplication::Wait( unsigned int durationToWait ) +{ + int time = 0; + + for(unsigned int i = 0; i <= ( durationToWait / RENDER_FRAME_INTERVAL); i++) + { + SendNotification(); + Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; + } + return time; +} } // Namespace dali