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.h;h=e224c6b4448ee69b98650fd64b67d08cea8f0bb3;hp=a490c96a900581a9f06a974f1634ddf8eccad707;hb=3fea156f024c5b2909e6a6aa9daaffd3767d7108;hpb=30f6ca1e541089b19f2b349a8a12d8a5bcaf2f9e diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h index a490c96..e224c6b 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h @@ -1,99 +1,120 @@ -#ifndef __DALI_TEST_APPLICATION_H__ -#define __DALI_TEST_APPLICATION_H__ - -// -// 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. -// +#ifndef DALI_TEST_APPLICATION_H +#define DALI_TEST_APPLICATION_H + +/* + * Copyright (c) 2020 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. + * + */ // INTERNAL INCLUDES #include -#include "test-gesture-manager.h" #include "test-gl-sync-abstraction.h" #include "test-gl-abstraction.h" +#include "test-gl-context-helper-abstraction.h" #include "test-render-controller.h" #include +#include +#include +#include namespace Dali { -class DALI_IMPORT_API TestApplication : public ConnectionTracker +class DALI_CORE_API TestApplication : public ConnectionTracker { public: // Default values derived from H2 device. - static const unsigned int DEFAULT_SURFACE_WIDTH = 480; - static const unsigned int DEFAULT_SURFACE_HEIGHT = 800; - -#ifdef _CPP11 - static constexpr float DEFAULT_HORIZONTAL_DPI = 220.0f; - static constexpr float DEFAULT_VERTICAL_DPI = 217.0f; -#else - static const float DEFAULT_HORIZONTAL_DPI = 220.0f; - static const float DEFAULT_VERTICAL_DPI = 217.0f; -#endif - - static const unsigned int DEFAULT_RENDER_INTERVAL = 1; - - TestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH, - size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, - float horizontalDpi = DEFAULT_HORIZONTAL_DPI, - float verticalDpi = DEFAULT_VERTICAL_DPI ); - - TestApplication( bool initialize, - size_t surfaceWidth = DEFAULT_SURFACE_WIDTH, - size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, - float horizontalDpi = DEFAULT_HORIZONTAL_DPI, - float verticalDpi = DEFAULT_VERTICAL_DPI ); + static const uint32_t DEFAULT_SURFACE_WIDTH = 480; + static const uint32_t DEFAULT_SURFACE_HEIGHT = 800; + + static constexpr uint32_t DEFAULT_HORIZONTAL_DPI = 220; + static constexpr uint32_t DEFAULT_VERTICAL_DPI = 217; + + static const uint32_t DEFAULT_RENDER_INTERVAL = 1; + + static const uint32_t RENDER_FRAME_INTERVAL = 16; + + TestApplication( uint32_t surfaceWidth = DEFAULT_SURFACE_WIDTH, + uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, + uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI, + uint32_t verticalDpi = DEFAULT_VERTICAL_DPI, + bool initialize = true, + bool enablePartialUpdate = false ); void Initialize(); - virtual ~TestApplication(); - static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message); + void CreateCore(); + void CreateScene(); + void InitializeCore(); + ~TestApplication() override; + static void LogMessage( Dali::Integration::Log::DebugPriority level, std::string& message ); + static void LogContext( bool start, const char* tag ); Dali::Integration::Core& GetCore(); TestPlatformAbstraction& GetPlatform(); TestRenderController& GetRenderController(); TestGlAbstraction& GetGlAbstraction(); TestGlSyncAbstraction& GetGlSyncAbstraction(); - TestGestureManager& GetGestureManager(); + TestGlContextHelperAbstraction& GetGlContextHelperAbstraction(); void ProcessEvent(const Integration::Event& event); void SendNotification(); - void SetSurfaceWidth( unsigned int width, unsigned height ); - bool Render( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL ); - unsigned int GetUpdateStatus(); - bool UpdateOnly( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL ); + bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL ); + bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector>& damagedRects); + bool RenderWithPartialUpdate(std::vector>& damagedRects, Rect& clippingRect); + uint32_t GetUpdateStatus(); + bool UpdateOnly( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL ); bool RenderOnly( ); void ResetContext(); + bool GetRenderNeedsUpdate(); + bool GetRenderNeedsPostRender(); + uint32_t Wait( uint32_t durationToWait ); + static void EnableLogging( bool enabled ) + { + mLoggingEnabled = enabled; + } + + Integration::Scene GetScene() const + { + return mScene; + } + +private: + void DoUpdate( uint32_t intervalMilliseconds, const char* location=NULL ); protected: TestPlatformAbstraction mPlatformAbstraction; TestRenderController mRenderController; TestGlAbstraction mGlAbstraction; TestGlSyncAbstraction mGlSyncAbstraction; - TestGestureManager mGestureManager; + TestGlContextHelperAbstraction mGlContextHelperAbstraction; Integration::UpdateStatus mStatus; Integration::RenderStatus mRenderStatus; Integration::Core* mCore; + Dali::Integration::Scene mScene; - unsigned int mSurfaceWidth; - unsigned int mSurfaceHeight; - unsigned int mFrame; + uint32_t mSurfaceWidth; + uint32_t mSurfaceHeight; + uint32_t mFrame; - Vector2 mDpi; + struct { uint32_t x; uint32_t y; } mDpi; + uint32_t mLastVSyncTime; + bool mPartialUpdateEnabled; + static bool mLoggingEnabled; }; } // Dali -#endif +#endif // DALI_TEST_APPLICATION_H