7a090f58e167bd63b6320a7422d97afde17fa10e
[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) 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 <dali-test-suite-utils.h>
23
24 #include "toolkit-adaptor.h"
25 #include "toolkit-orientation.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
46   ~ToolkitTestApplication()
47   {
48     // Need to delete core before we delete the adaptor.
49     delete mCore;
50     mCore = NULL;
51   }
52
53   inline ToolkitAdaptor& GetAdaptor()
54   {
55     return mAdaptor;
56   }
57
58   //ToolkitOrientation& GetOrientation()
59   //{
60   //return mOrientation;
61   //}
62
63 private:
64   ToolkitAdaptor mAdaptor;
65   //ToolkitOrientation mOrientation;
66 };
67
68 } // namespace Dali
69
70 inline ImageActor CreateSolidColorImageActor(ToolkitTestApplication& application, const Vector4& color, int width, int height)
71 {
72   ImageActor actor = ImageActor::New(CreateBitmapImage(width, height, color));
73   application.SendNotification();
74   application.Render();
75   return actor;
76 }
77
78
79 #endif // __DALI_TOOLKIT_TEST_APPLICATION_H__