X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-application.cpp;h=d45791690a0af393dd48e87b17d67927aa1afed2;hb=6d96d7c0b6a74a5fe927dcaa2d9b1fae932af08d;hp=a20ef6da41a15329f2a9fd6fee4b4a3d5d0c426f;hpb=07a73413cfefa18105d94f952efb62884b8ed9a1;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 a20ef6d..d457916 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,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -20,12 +20,14 @@ namespace Dali { +bool TestApplication::mLoggingEnabled = true; TestApplication::TestApplication( uint32_t surfaceWidth, uint32_t surfaceHeight, uint32_t horizontalDpi, uint32_t verticalDpi, - ResourcePolicy::DataRetention policy) + ResourcePolicy::DataRetention policy, + bool initialize ) : mCore( NULL ), mSurfaceWidth( surfaceWidth ), mSurfaceHeight( surfaceHeight ), @@ -34,11 +36,21 @@ TestApplication::TestApplication( uint32_t surfaceWidth, mLastVSyncTime(0u), mDataRetentionPolicy( policy ) { - Initialize(); + if( initialize ) + { + Initialize(); + } } void TestApplication::Initialize() { + CreateCore(); + CreateScene(); + InitializeCore(); +} + +void TestApplication::CreateCore() +{ // We always need the first update! mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING; @@ -46,15 +58,12 @@ void TestApplication::Initialize() mPlatformAbstraction, mGlAbstraction, mGlSyncAbstraction, - mGestureManager, mDataRetentionPolicy, Integration::RenderToFrameBuffer::FALSE, Integration::DepthBufferAvailable::TRUE, Integration::StencilBufferAvailable::TRUE ); mCore->ContextCreated(); - mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); - mCore->SetDpi( mDpi.x, mDpi.y ); Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); Dali::Integration::Log::InstallLogFunction(logFunction); @@ -63,13 +72,28 @@ void TestApplication::Initialize() Dali::Integration::Trace::InstallLogContextFunction( logContextFunction ); Dali::Integration::Trace::LogContext( true, "Test" ); +} +void TestApplication::CreateScene() +{ + mRenderSurface = new TestRenderSurface( Dali::PositionSize( 0, 0, mSurfaceWidth, mSurfaceHeight ) ); + mScene = Dali::Integration::Scene::New( Vector2( static_cast( mSurfaceWidth ), static_cast( mSurfaceHeight ) ) ); + mScene.SetSurface( *mRenderSurface ); + mScene.SetDpi( Vector2( static_cast( mDpi.x ), static_cast( mDpi.y ) ) ); + + mCore->SurfaceResized( mRenderSurface ); +} + +void TestApplication::InitializeCore() +{ mCore->SceneCreated(); + mCore->Initialize(); } TestApplication::~TestApplication() { Dali::Integration::Log::UninstallLogFunction(); + delete mRenderSurface; delete mCore; } @@ -77,30 +101,33 @@ void TestApplication::LogContext( bool start, const char* tag ) { if( start ) { - fprintf(stderr, "INFO: Trace Start: %s", tag); + fprintf(stderr, "INFO: Trace Start: %s\n", tag); } else { - fprintf(stderr, "INFO: Trace End: %s", tag); + fprintf(stderr, "INFO: Trace End: %s\n", tag); } } void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) { - switch(level) + if( mLoggingEnabled ) { - case Dali::Integration::Log::DebugInfo: - fprintf(stderr, "INFO: %s", message.c_str()); - break; - case Dali::Integration::Log::DebugWarning: - fprintf(stderr, "WARN: %s", message.c_str()); - break; - case Dali::Integration::Log::DebugError: - fprintf(stderr, "ERROR: %s", message.c_str()); - break; - default: - fprintf(stderr, "DEFAULT: %s", message.c_str()); - break; + switch(level) + { + case Dali::Integration::Log::DebugInfo: + fprintf(stderr, "INFO: %s", message.c_str()); + break; + case Dali::Integration::Log::DebugWarning: + fprintf(stderr, "WARN: %s", message.c_str()); + break; + case Dali::Integration::Log::DebugError: + fprintf(stderr, "ERROR: %s", message.c_str()); + break; + default: + fprintf(stderr, "DEFAULT: %s", message.c_str()); + break; + } } } @@ -129,11 +156,6 @@ TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction() return mGlSyncAbstraction; } -TestGestureManager& TestApplication::GetGestureManager() -{ - return mGestureManager; -} - void TestApplication::ProcessEvent(const Integration::Event& event) { mCore->QueueEvent(event); @@ -145,19 +167,6 @@ void TestApplication::SendNotification() mCore->ProcessEvents(); } -void TestApplication::SetSurfaceWidth( uint32_t width, uint32_t height ) -{ - mSurfaceWidth = width; - mSurfaceHeight = height; - - mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); -} - -void TestApplication::SetTopMargin( uint32_t margin ) -{ - mCore->SetTopMargin( margin ); -} - void TestApplication::DoUpdate( uint32_t intervalMilliseconds, const char* location ) { if( GetUpdateStatus() == 0 &&