1 #ifndef __DALI_TEST_APPLICATION_H__
2 #define __DALI_TEST_APPLICATION_H__
5 * Copyright (c) 2014 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 <dali/public-api/common/dali-common.h>
32 class DALI_IMPORT_API TestApplication : public ConnectionTracker
36 // Default values derived from H2 device.
37 static const unsigned int DEFAULT_SURFACE_WIDTH = 480;
38 static const unsigned int DEFAULT_SURFACE_HEIGHT = 800;
41 static constexpr float DEFAULT_HORIZONTAL_DPI = 220.0f;
42 static constexpr float DEFAULT_VERTICAL_DPI = 217.0f;
44 static const float DEFAULT_HORIZONTAL_DPI = 220.0f;
45 static const float DEFAULT_VERTICAL_DPI = 217.0f;
48 static const unsigned int DEFAULT_RENDER_INTERVAL = 1;
50 TestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
51 size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
52 float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
53 float verticalDpi = DEFAULT_VERTICAL_DPI,
54 ResourcePolicy::DataRetention resourcePolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA );
58 TestApplication( bool initialize,
59 size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
60 size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
61 float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
62 float verticalDpi = DEFAULT_VERTICAL_DPI,
63 ResourcePolicy::DataRetention resourcePolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA );
66 virtual ~TestApplication();
67 static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
68 Dali::Integration::Core& GetCore();
69 TestPlatformAbstraction& GetPlatform();
70 TestRenderController& GetRenderController();
71 TestGlAbstraction& GetGlAbstraction();
72 TestGlSyncAbstraction& GetGlSyncAbstraction();
73 TestGestureManager& GetGestureManager();
74 void ProcessEvent(const Integration::Event& event);
75 void SendNotification();
76 void SetSurfaceWidth( unsigned int width, unsigned height );
77 bool Render( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
78 unsigned int GetUpdateStatus();
79 bool UpdateOnly( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
84 void DoUpdate( unsigned int intervalMilliseconds );
87 TestPlatformAbstraction mPlatformAbstraction;
88 TestRenderController mRenderController;
89 TestGlAbstraction mGlAbstraction;
90 TestGlSyncAbstraction mGlSyncAbstraction;
91 TestGestureManager mGestureManager;
93 Integration::UpdateStatus mStatus;
94 Integration::RenderStatus mRenderStatus;
96 Integration::Core* mCore;
98 unsigned int mSurfaceWidth;
99 unsigned int mSurfaceHeight;
103 unsigned int mLastVSyncTime;
104 ResourcePolicy::DataRetention mDataRetentionPolicy;