Merge " fix Klocwork warning of unintialized data members, unneeded assignment &...
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-application.h
1 #ifndef __DALI_TEST_APPLICATION_H__
2 #define __DALI_TEST_APPLICATION_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
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>
28
29 namespace Dali
30 {
31
32 class DALI_IMPORT_API TestApplication : public ConnectionTracker
33 {
34 public:
35
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;
39
40 #ifdef _CPP11
41   static constexpr float DEFAULT_HORIZONTAL_DPI = 220.0f;
42   static constexpr float DEFAULT_VERTICAL_DPI   = 217.0f;
43 #else
44   static const float DEFAULT_HORIZONTAL_DPI = 220.0f;
45   static const float DEFAULT_VERTICAL_DPI   = 217.0f;
46 #endif
47
48   static const unsigned int DEFAULT_RENDER_INTERVAL = 1;
49
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 );
55
56
57
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 );
64
65   void Initialize();
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 );
80   bool RenderOnly( );
81   void ResetContext();
82
83 private:
84   void DoUpdate( unsigned int intervalMilliseconds );
85
86 protected:
87   TestPlatformAbstraction   mPlatformAbstraction;
88   TestRenderController      mRenderController;
89   TestGlAbstraction         mGlAbstraction;
90   TestGlSyncAbstraction     mGlSyncAbstraction;
91   TestGestureManager        mGestureManager;
92
93   Integration::UpdateStatus mStatus;
94   Integration::RenderStatus mRenderStatus;
95
96   Integration::Core* mCore;
97
98   unsigned int mSurfaceWidth;
99   unsigned int mSurfaceHeight;
100   unsigned int mFrame;
101
102   Vector2 mDpi;
103   unsigned int mLastVSyncTime;
104   ResourcePolicy::DataRetention mDataRetentionPolicy;
105 };
106
107 } // Dali
108
109 #endif