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 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <boost/function.hpp>
25 #include "toolkit-style-monitor.h"
26 #include "toolkit-accessibility-manager.h"
27 #include "toolkit-timer.h"
28 #include "toolkit-imf-manager.h"
29 #include "toolkit-clipboard-event-notifier.h"
31 #include <dali/public-api/events/touch-point.h>
32 #include <dali/public-api/math/rect.h>
39 typedef Dali::Rect<int> PositionSize;
42 * This creates a stubbed Adaptor so that internal Toolkit Adaptor calls work.
43 * Furthermore, it provides an interface to see if certain methods were invoked.
47 public: // Construction & Destruction
54 boost::function<void(void)> GetLastIdleAdded() const
56 return mLastIdleAdded;
59 TouchPoint GetLastTouchPointFed() const
61 return mLastTouchPointFed;
64 int GetLastTimeStampFed() const
66 return mLastTimeStampFed;
69 PositionSize GetLastSizeSet() const
74 StyleMonitor& GetToolkitStyleMonitor()
79 AccessibilityManager& GetAccessibilityManager()
81 return mAccessibilityManager;
84 ToolkitClipboardEventNotifier& GetClipboardEventNotifier()
86 return mClipboardEventNotifier;
89 public: // Signal Emissions
91 void EmitSignalResize();
93 public: // TEST FUNCTIONS
95 // Enumeration of Adaptor methods
111 RegisterSingletonType,
118 mFunctionsCalled.Reset();
121 bool WasCalled(TestFuncEnum func)
125 case StartType: return mFunctionsCalled.Start;
126 case PauseType: return mFunctionsCalled.Pause;
127 case ResumeType: return mFunctionsCalled.Resume;
128 case StopType: return mFunctionsCalled.Stop;
129 case AddIdleType: return mFunctionsCalled.AddIdle;
130 case FeedEventType: return mFunctionsCalled.FeedEvent;
131 case MoveResizeType: return mFunctionsCalled.MoveResize;
132 case SurfaceResizedType: return mFunctionsCalled.SurfaceResized;
133 case ReplaceSurfaceType: return mFunctionsCalled.ReplaceSurface;
134 case RenderSyncType: return mFunctionsCalled.RenderSync;
135 case GetSurfaceType: return mFunctionsCalled.GetSurface;
136 case GetType: return mFunctionsCalled.Get;
137 case IsAvailableType: return mFunctionsCalled.IsAvailable;
138 case RegisterSingletonType: return mFunctionsCalled.RegisterSingleton;
139 case GetSingletonType: return mFunctionsCalled.GetSingleton;
140 case SignalResizeType: return mFunctionsCalled.SignalResize;
145 void ResetCallStatistics(TestFuncEnum func)
149 case StartType: mFunctionsCalled.Start = false; break;
150 case PauseType: mFunctionsCalled.Pause = false; break;
151 case ResumeType: mFunctionsCalled.Resume = false; break;
152 case StopType: mFunctionsCalled.Stop = false; break;
153 case AddIdleType: mFunctionsCalled.AddIdle = false; break;
154 case FeedEventType: mFunctionsCalled.FeedEvent = false; break;
155 case MoveResizeType: mFunctionsCalled.MoveResize = false; break;
156 case SurfaceResizedType: mFunctionsCalled.SurfaceResized = false; break;
157 case ReplaceSurfaceType: mFunctionsCalled.ReplaceSurface = false; break;
158 case RenderSyncType: mFunctionsCalled.RenderSync = false; break;
159 case GetSurfaceType: mFunctionsCalled.GetSurface = false; break;
160 case GetType: mFunctionsCalled.Get = false; break;
161 case IsAvailableType: mFunctionsCalled.IsAvailable = false; break;
162 case RegisterSingletonType: mFunctionsCalled.RegisterSingleton = false; break;
163 case GetSingletonType: mFunctionsCalled.GetSingleton = false; break;
164 case SignalResizeType: mFunctionsCalled.SignalResize = false; break;
180 SurfaceResized(false),
181 ReplaceSurface(false),
186 RegisterSingleton(false),
201 SurfaceResized = false;
202 ReplaceSurface = false;
207 RegisterSingleton = false;
208 GetSingleton = false;
209 SignalResize = false;
225 bool RegisterSingleton;
230 TestFunctions mFunctionsCalled;
232 // Last set information
233 boost::function<void(void)> mLastIdleAdded;
234 TouchPoint mLastTouchPointFed;
235 int mLastTimeStampFed;
236 PositionSize mLastSizeSet;
238 // Contains Test functions for the Style Monitor
239 StyleMonitor mStyleMonitor;
241 // Stub for AccessibilityManager
242 AccessibilityManager mAccessibilityManager;
244 // Stub for ClipboardEventNotifier
245 ToolkitClipboardEventNotifier mClipboardEventNotifier;
247 ImfManager mImfManager;
250 Adaptor* mAdaptorStub;
251 friend class Adaptor;
256 #endif // __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__