1 #ifndef __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
2 #define __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 // http://floralicense.org/license/
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.
21 #include <boost/function.hpp>
24 #include <dali/public-api/events/touch-point.h>
25 #include <dali/public-api/math/rect.h>
27 #include "toolkit-style-monitor.h"
28 #include "toolkit-accessibility-manager.h"
29 #include "toolkit-physical-keyboard.h"
30 #include "toolkit-clipboard-event-notifier.h"
31 #include "toolkit-timer.h"
38 typedef Dali::Rect<int> PositionSize;
41 * This creates a stubbed Adaptor so that internal Toolkit Adaptor calls work.
42 * Furthermore, it provides an interface to see if certain methods were invoked.
46 public: // Construction & Destruction
53 boost::function<void(void)> GetLastIdleAdded() const
55 return mLastIdleAdded;
58 TouchPoint GetLastTouchPointFed() const
60 return mLastTouchPointFed;
63 int GetLastTimeStampFed() const
65 return mLastTimeStampFed;
68 PositionSize GetLastSizeSet() const
73 ToolkitStyleMonitor& GetToolkitStyleMonitor()
78 ToolkitAccessibilityManager& GetAccessibilityManager()
80 return mAccessibilityManager;
83 ToolkitClipboardEventNotifier& GetClipboardEventNotifier()
85 return mClipboardEventNotifier;
88 public: // Signal Emissions
90 void EmitSignalResize();
92 public: // TEST FUNCTIONS
94 // Enumeration of Adaptor methods
110 RegisterSingletonType,
117 mFunctionsCalled.Reset();
120 bool WasCalled(TestFuncEnum func)
124 case StartType: return mFunctionsCalled.Start;
125 case PauseType: return mFunctionsCalled.Pause;
126 case ResumeType: return mFunctionsCalled.Resume;
127 case StopType: return mFunctionsCalled.Stop;
128 case AddIdleType: return mFunctionsCalled.AddIdle;
129 case FeedEventType: return mFunctionsCalled.FeedEvent;
130 case MoveResizeType: return mFunctionsCalled.MoveResize;
131 case SurfaceResizedType: return mFunctionsCalled.SurfaceResized;
132 case ReplaceSurfaceType: return mFunctionsCalled.ReplaceSurface;
133 case RenderSyncType: return mFunctionsCalled.RenderSync;
134 case GetSurfaceType: return mFunctionsCalled.GetSurface;
135 case GetType: return mFunctionsCalled.Get;
136 case IsAvailableType: return mFunctionsCalled.IsAvailable;
137 case RegisterSingletonType: return mFunctionsCalled.RegisterSingleton;
138 case GetSingletonType: return mFunctionsCalled.GetSingleton;
139 case SignalResizeType: return mFunctionsCalled.SignalResize;
144 void ResetCallStatistics(TestFuncEnum func)
148 case StartType: mFunctionsCalled.Start = false; break;
149 case PauseType: mFunctionsCalled.Pause = false; break;
150 case ResumeType: mFunctionsCalled.Resume = false; break;
151 case StopType: mFunctionsCalled.Stop = false; break;
152 case AddIdleType: mFunctionsCalled.AddIdle = false; break;
153 case FeedEventType: mFunctionsCalled.FeedEvent = false; break;
154 case MoveResizeType: mFunctionsCalled.MoveResize = false; break;
155 case SurfaceResizedType: mFunctionsCalled.SurfaceResized = false; break;
156 case ReplaceSurfaceType: mFunctionsCalled.ReplaceSurface = false; break;
157 case RenderSyncType: mFunctionsCalled.RenderSync = false; break;
158 case GetSurfaceType: mFunctionsCalled.GetSurface = false; break;
159 case GetType: mFunctionsCalled.Get = false; break;
160 case IsAvailableType: mFunctionsCalled.IsAvailable = false; break;
161 case RegisterSingletonType: mFunctionsCalled.RegisterSingleton = false; break;
162 case GetSingletonType: mFunctionsCalled.GetSingleton = false; break;
163 case SignalResizeType: mFunctionsCalled.SignalResize = false; break;
179 SurfaceResized(false),
180 ReplaceSurface(false),
185 RegisterSingleton(false),
200 SurfaceResized = false;
201 ReplaceSurface = false;
206 RegisterSingleton = false;
207 GetSingleton = false;
208 SignalResize = false;
224 bool RegisterSingleton;
229 TestFunctions mFunctionsCalled;
231 // Last set information
232 boost::function<void(void)> mLastIdleAdded;
233 TouchPoint mLastTouchPointFed;
234 int mLastTimeStampFed;
235 PositionSize mLastSizeSet;
237 // Contains Test functions for the Style Monitor
238 ToolkitStyleMonitor mStyleMonitor;
241 ToolkitTimer mToolkitTimer;
243 // Stub for AccessibilityManager
244 ToolkitAccessibilityManager mAccessibilityManager;
246 // Stub for PhysicalKeyboard
247 ToolkitPhysicalKeyboard mPhysicalKeyboard;
249 // Stub for ClipboardEventNotifier
250 ToolkitClipboardEventNotifier mClipboardEventNotifier;
253 Adaptor* mAdaptorStub;
254 friend class Adaptor;
259 #endif // __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__