a490c96a900581a9f06a974f1634ddf8eccad707
[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 Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <test-platform-abstraction.h>
22 #include "test-gesture-manager.h"
23 #include "test-gl-sync-abstraction.h"
24 #include "test-gl-abstraction.h"
25 #include "test-render-controller.h"
26 #include <dali/public-api/common/dali-common.h>
27
28 namespace Dali
29 {
30
31 class DALI_IMPORT_API TestApplication : public ConnectionTracker
32 {
33 public:
34
35   // Default values derived from H2 device.
36   static const unsigned int DEFAULT_SURFACE_WIDTH = 480;
37   static const unsigned int DEFAULT_SURFACE_HEIGHT = 800;
38
39 #ifdef _CPP11
40   static constexpr float DEFAULT_HORIZONTAL_DPI = 220.0f;
41   static constexpr float DEFAULT_VERTICAL_DPI   = 217.0f;
42 #else
43   static const float DEFAULT_HORIZONTAL_DPI = 220.0f;
44   static const float DEFAULT_VERTICAL_DPI   = 217.0f;
45 #endif
46
47   static const unsigned int DEFAULT_RENDER_INTERVAL = 1;
48
49   TestApplication( size_t surfaceWidth  = DEFAULT_SURFACE_WIDTH,
50                    size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
51                    float  horizontalDpi = DEFAULT_HORIZONTAL_DPI,
52                    float  verticalDpi   = DEFAULT_VERTICAL_DPI );
53
54   TestApplication( bool   initialize,
55                    size_t surfaceWidth  = DEFAULT_SURFACE_WIDTH,
56                    size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
57                    float  horizontalDpi = DEFAULT_HORIZONTAL_DPI,
58                    float  verticalDpi   = DEFAULT_VERTICAL_DPI );
59
60   void Initialize();
61   virtual ~TestApplication();
62   static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
63   Dali::Integration::Core& GetCore();
64   TestPlatformAbstraction& GetPlatform();
65   TestRenderController& GetRenderController();
66   TestGlAbstraction& GetGlAbstraction();
67   TestGlSyncAbstraction& GetGlSyncAbstraction();
68   TestGestureManager& GetGestureManager();
69   void ProcessEvent(const Integration::Event& event);
70   void SendNotification();
71   void SetSurfaceWidth( unsigned int width, unsigned height );
72   bool Render( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
73   unsigned int GetUpdateStatus();
74   bool UpdateOnly( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
75   bool RenderOnly( );
76   void ResetContext();
77
78 protected:
79   TestPlatformAbstraction   mPlatformAbstraction;
80   TestRenderController      mRenderController;
81   TestGlAbstraction         mGlAbstraction;
82   TestGlSyncAbstraction     mGlSyncAbstraction;
83   TestGestureManager        mGestureManager;
84
85   Integration::UpdateStatus mStatus;
86   Integration::RenderStatus mRenderStatus;
87
88   Integration::Core* mCore;
89
90   unsigned int mSurfaceWidth;
91   unsigned int mSurfaceHeight;
92   unsigned int mFrame;
93
94   Vector2 mDpi;
95 };
96
97 } // Dali
98
99 #endif