Merge "Updated test suite following platform abstraction change" into tizen
[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
55   TestApplication( bool   initialize,
56                    size_t surfaceWidth  = DEFAULT_SURFACE_WIDTH,
57                    size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
58                    float  horizontalDpi = DEFAULT_HORIZONTAL_DPI,
59                    float  verticalDpi   = DEFAULT_VERTICAL_DPI );
60
61   void Initialize();
62   virtual ~TestApplication();
63   static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
64   Dali::Integration::Core& GetCore();
65   TestPlatformAbstraction& GetPlatform();
66   TestRenderController& GetRenderController();
67   TestGlAbstraction& GetGlAbstraction();
68   TestGlSyncAbstraction& GetGlSyncAbstraction();
69   TestGestureManager& GetGestureManager();
70   void ProcessEvent(const Integration::Event& event);
71   void SendNotification();
72   void SetSurfaceWidth( unsigned int width, unsigned height );
73   bool Render( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
74   unsigned int GetUpdateStatus();
75   bool UpdateOnly( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
76   bool RenderOnly( );
77   void ResetContext();
78
79 private:
80   void DoUpdate( unsigned int intervalMilliseconds );
81
82 protected:
83   TestPlatformAbstraction   mPlatformAbstraction;
84   TestRenderController      mRenderController;
85   TestGlAbstraction         mGlAbstraction;
86   TestGlSyncAbstraction     mGlSyncAbstraction;
87   TestGestureManager        mGestureManager;
88
89   Integration::UpdateStatus mStatus;
90   Integration::RenderStatus mRenderStatus;
91
92   Integration::Core* mCore;
93
94   unsigned int mSurfaceWidth;
95   unsigned int mSurfaceHeight;
96   unsigned int mFrame;
97
98   Vector2 mDpi;
99   unsigned int mLastVSyncTime;
100 };
101
102 } // Dali
103
104 #endif