Merge "Add Text input style changed signal." into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-test-application.h
1 #ifndef __DALI_TOOLKIT_TEST_APPLICATION_H__
2 #define __DALI_TOOLKIT_TEST_APPLICATION_H__
3
4 /*
5  * Copyright (c) 2016 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 <dali-test-suite-utils.h>
23 #include <dali/devel-api/text-abstraction/font-client.h>
24 #include <dali/integration-api/adaptors/adaptor.h>
25 #include <toolkit-adaptor-impl.h>
26
27 namespace Dali
28 {
29
30 /**
31  * Adds some functionality on top of TestApplication that is required by the Toolkit.
32  */
33 class ToolkitTestApplication : public TestApplication
34 {
35 public:
36
37   ToolkitTestApplication( size_t surfaceWidth  = DEFAULT_SURFACE_WIDTH,
38                           size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
39                           float  horizontalDpi = DEFAULT_HORIZONTAL_DPI,
40                           float  verticalDpi   = DEFAULT_VERTICAL_DPI )
41   : TestApplication( false, surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi )
42   {
43     Initialize();
44
45     // set the DPI value for font rendering
46     Dali::TextAbstraction::FontClient fontClient = Dali::TextAbstraction::FontClient::Get();
47     if( fontClient )
48     {
49       fontClient.SetDpi( mDpi.x, mDpi.y );
50     }
51   }
52
53   ~ToolkitTestApplication()
54   {
55     // Need to delete core before we delete the adaptor.
56     delete mCore;
57     mCore = NULL;
58   }
59
60   //ToolkitOrientation& GetOrientation()
61   //{
62   //return mOrientation;
63   //}
64
65   /**
66    * @brief Creates an adaptor implementation for those controls like the
67    * text-field and the text-editor which connects a callback to the idle signal.
68    */
69   void CreateAdaptor()
70   {
71     Adaptor::Get();
72   }
73
74   /**
75    * @brief Executes the idle callbacks.
76    *
77    * Some controls like the text-field and the text-editor connect callbacks to the
78    * idle signal.
79    */
80   void RunIdles()
81   {
82     if( Adaptor::IsAvailable() )
83     {
84       for( Vector<CallbackBase*>::Iterator it = Internal::Adaptor::Adaptor::mCallbacks.Begin(),
85              endIt = Internal::Adaptor::Adaptor::mCallbacks.End();
86            it != endIt;
87            ++it )
88       {
89         CallbackBase* callback = *it;
90
91         CallbackBase::Execute( *callback );
92       }
93
94       Internal::Adaptor::Adaptor::mCallbacks.Clear();
95     }
96   }
97
98 private:
99   //ToolkitOrientation mOrientation;
100 };
101
102 } // namespace Dali
103
104 #endif // __DALI_TOOLKIT_TEST_APPLICATION_H__