1 #ifndef __DALI_TEST_APPLICATION_H__
2 #define __DALI_TEST_APPLICATION_H__
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <test-platform-abstraction.h>
23 #include "test-gesture-manager.h"
24 #include "test-gl-sync-abstraction.h"
25 #include "test-gl-abstraction.h"
26 #include "test-render-controller.h"
27 #include "test-render-surface.h"
28 #include <dali/public-api/common/dali-common.h>
29 #include <dali/integration-api/resource-policies.h>
30 #include <dali/integration-api/trace.h>
31 #include <dali/integration-api/scene.h>
36 class DALI_CORE_API TestApplication : public ConnectionTracker
40 // Default values derived from H2 device.
41 static const uint32_t DEFAULT_SURFACE_WIDTH = 480;
42 static const uint32_t DEFAULT_SURFACE_HEIGHT = 800;
45 static constexpr uint32_t DEFAULT_HORIZONTAL_DPI = 220;
46 static constexpr uint32_t DEFAULT_VERTICAL_DPI = 217;
48 static const uint32_t DEFAULT_HORIZONTAL_DPI = 220;
49 static const uint32_t DEFAULT_VERTICAL_DPI = 217;
52 static const uint32_t DEFAULT_RENDER_INTERVAL = 1;
54 static const uint32_t RENDER_FRAME_INTERVAL = 16;
56 TestApplication( uint32_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
57 uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
58 uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI,
59 uint32_t verticalDpi = DEFAULT_VERTICAL_DPI,
60 ResourcePolicy::DataRetention policy = ResourcePolicy::DALI_DISCARDS_ALL_DATA);
63 virtual ~TestApplication();
64 static void LogMessage( Dali::Integration::Log::DebugPriority level, std::string& message );
65 static void LogContext( bool start, const char* tag );
66 Dali::Integration::Core& GetCore();
67 TestPlatformAbstraction& GetPlatform();
68 TestRenderController& GetRenderController();
69 TestGlAbstraction& GetGlAbstraction();
70 TestGlSyncAbstraction& GetGlSyncAbstraction();
71 TestGestureManager& GetGestureManager();
72 void ProcessEvent(const Integration::Event& event);
73 void SendNotification();
74 bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL );
75 uint32_t GetUpdateStatus();
76 bool UpdateOnly( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
79 bool GetRenderNeedsUpdate();
80 uint32_t Wait( uint32_t durationToWait );
81 static void EnableLogging( bool enabled )
83 mLoggingEnabled = enabled;
86 Integration::Scene GetScene() const
92 void DoUpdate( uint32_t intervalMilliseconds, const char* location=NULL );
95 TestPlatformAbstraction mPlatformAbstraction;
96 TestRenderController mRenderController;
97 TestGlAbstraction mGlAbstraction;
98 TestGlSyncAbstraction mGlSyncAbstraction;
99 TestGestureManager mGestureManager;
100 TestRenderSurface* mRenderSurface;
102 Integration::UpdateStatus mStatus;
103 Integration::RenderStatus mRenderStatus;
105 Integration::Core* mCore;
106 Dali::Integration::Scene mScene;
108 uint32_t mSurfaceWidth;
109 uint32_t mSurfaceHeight;
112 struct { uint32_t x; uint32_t y; } mDpi;
113 uint32_t mLastVSyncTime;
114 ResourcePolicy::DataRetention mDataRetentionPolicy;
115 static bool mLoggingEnabled;