2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
20 // Need to override adaptor classes for toolkit test harness, so include
21 // test harness headers before dali headers.
22 #include <dali-toolkit-test-suite-utils.h>
25 #include <dali-toolkit/dali-toolkit.h>
26 #include <dali/integration-api/events/key-event-integ.h>
27 #include <dali/integration-api/events/mouse-wheel-event-integ.h>
28 #include <dali/integration-api/events/long-press-gesture-event.h>
29 #include <dali/integration-api/events/pinch-gesture-event.h>
30 #include <dali/integration-api/events/pan-gesture-event.h>
31 #include <dali/integration-api/events/tap-gesture-event.h>
32 #include <dali/integration-api/events/touch-event-integ.h>
34 #include "dummy-control.h"
37 using namespace Dali::Toolkit;
39 void utc_dali_toolkit_control_impl_startup(void)
41 test_return_value = TET_UNDEF;
44 void utc_dali_toolkit_control_impl_cleanup(void)
46 test_return_value = TET_PASS;
49 int UtcDaliControlImplNew(void)
51 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
55 DALI_TEST_CHECK( !Control::DownCast(control) );
57 control = ControlImpl::New();
59 DALI_TEST_CHECK( Control::DownCast(control) );
64 int UtcDaliControlImplEnableGestureDetector(void)
66 ToolkitTestApplication application;
68 // Enable individually
70 DummyControl dummy = DummyControl::New();
71 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
73 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
74 dummyImpl.EnableGestureDetection(Gesture::Pinch);
75 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
77 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
78 dummyImpl.EnableGestureDetection(Gesture::Pan);
79 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
81 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
82 dummyImpl.EnableGestureDetection(Gesture::Tap);
83 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
85 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
86 dummyImpl.EnableGestureDetection(Gesture::LongPress);
87 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
92 DummyControl dummy = DummyControl::New();
93 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
95 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
96 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
97 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
98 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
100 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
102 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
103 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
104 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
105 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
107 // Enable when already enabled
109 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
111 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
112 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
113 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
114 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
119 int UtcDaliControlImplDisableGestureDetector(void)
121 ToolkitTestApplication application;
123 // Disable individually
125 DummyControl dummy = DummyControl::New();
126 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
128 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
130 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
131 dummyImpl.DisableGestureDetection(Gesture::Pinch);
132 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
134 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
135 dummyImpl.DisableGestureDetection(Gesture::Pan);
136 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
138 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
139 dummyImpl.DisableGestureDetection(Gesture::Tap);
140 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
142 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
143 dummyImpl.DisableGestureDetection(Gesture::LongPress);
144 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
149 DummyControl dummy = DummyControl::New();
150 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
152 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
154 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
155 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
156 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
157 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
159 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
161 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
162 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
163 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
164 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
167 // Disable When not enabled
169 DummyControl dummy = DummyControl::New();
170 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
172 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
173 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
174 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
175 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
177 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
179 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
180 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
181 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
182 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
185 // Ensure control is detached if gesture detector is not deleted
187 DummyControl dummy = DummyControl::New();
188 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
190 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
192 PinchGestureDetector pinch = dummyImpl.GetPinchGestureDetector();
193 PanGestureDetector pan = dummyImpl.GetPanGestureDetector();
194 TapGestureDetector tap = dummyImpl.GetTapGestureDetector();
195 LongPressGestureDetector longPress = dummyImpl.GetLongPressGestureDetector();
197 DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), false, TEST_LOCATION );
198 DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), false, TEST_LOCATION );
199 DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), false, TEST_LOCATION );
200 DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), false, TEST_LOCATION );
202 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
204 DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), true, TEST_LOCATION );
205 DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), true, TEST_LOCATION );
206 DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), true, TEST_LOCATION );
207 DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), true, TEST_LOCATION );
212 int UtcDaliControlImplOnGestureMethods(void)
214 ToolkitTestApplication application;
216 // Check gesture actually happens
218 DummyControl dummy = DummyControl::New(true);
219 dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
221 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
222 Stage::GetCurrent().Add(dummy);
224 // Render and notify a couple of times
225 application.SendNotification();
226 application.Render();
227 application.SendNotification();
228 application.Render();
230 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
231 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
233 DALI_TEST_CHECK( dummyImpl.pinchCalled == false );
234 Integration::PinchGestureEvent pinch(Gesture::Started);
237 pinch.centerPoint = Vector2(20.0f, 20.0f);
238 application.ProcessEvent(pinch);
239 DALI_TEST_CHECK( dummyImpl.pinchCalled == true );
241 DALI_TEST_CHECK( dummyImpl.panCalled == false );
242 Integration::PanGestureEvent pan(Gesture::Possible);
243 pan.previousPosition = Vector2(10.0f, 20.0f);
244 pan.currentPosition = Vector2(20.0f, 20.0f);
246 pan.numberOfTouches = 1u;
247 application.ProcessEvent(pan);
248 pan.state = Gesture::Started;
249 application.ProcessEvent(pan);
250 DALI_TEST_CHECK( dummyImpl.panCalled == true );
252 DALI_TEST_CHECK( dummyImpl.tapCalled == false );
253 Integration::TapGestureEvent tap(Gesture::Possible);
254 tap.numberOfTaps = 1u;
255 tap.numberOfTouches = 1u;
256 tap.point = Vector2(50.0f, 50.0f);
257 application.ProcessEvent(tap);
258 tap.state = Gesture::Started;
259 application.ProcessEvent(tap);
260 DALI_TEST_CHECK( dummyImpl.tapCalled == true );
262 DALI_TEST_CHECK( dummyImpl.longPressCalled == false );
263 Integration::LongPressGestureEvent longPress(Gesture::Possible);
264 longPress.numberOfTouches = 1u;
265 longPress.point = Vector2(50.0f, 50.0f);
266 application.ProcessEvent(longPress);
267 longPress.state = Gesture::Started;
268 application.ProcessEvent(longPress);
269 DALI_TEST_CHECK( dummyImpl.longPressCalled == true );
270 longPress.state = Gesture::Finished;
271 application.ProcessEvent(longPress);
273 Stage::GetCurrent().Remove(dummy);
276 // Ensure full code coverage
278 DummyControl dummy = DummyControl::New();
279 dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
281 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
282 Stage::GetCurrent().Add(dummy);
284 // Render and notify a couple of times
285 application.SendNotification();
286 application.Render();
287 application.SendNotification();
288 application.Render();
290 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
291 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
293 DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f );
294 Integration::PinchGestureEvent pinch(Gesture::Started);
297 pinch.centerPoint = Vector2(20.0f, 20.0f);
298 application.ProcessEvent(pinch);
300 // Render and notify a couple of times
301 application.SendNotification();
302 application.Render();
303 application.SendNotification();
304 application.Render();
305 DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f );
307 Integration::PanGestureEvent pan(Gesture::Possible);
308 pan.previousPosition = Vector2(10.0f, 20.0f);
309 pan.currentPosition = Vector2(20.0f, 20.0f);
311 pan.numberOfTouches = 1u;
312 application.ProcessEvent(pan);
313 pan.state = Gesture::Started;
314 application.ProcessEvent(pan);
316 Integration::TapGestureEvent tap(Gesture::Possible);
317 tap.numberOfTaps = 1u;
318 tap.numberOfTouches = 1u;
319 tap.point = Vector2(50.0f, 50.0f);
320 application.ProcessEvent(tap);
321 tap.state = Gesture::Started;
322 application.ProcessEvent(tap);
324 Integration::LongPressGestureEvent longPress(Gesture::Possible);
325 longPress.numberOfTouches = 1u;
326 longPress.point = Vector2(50.0f, 50.0f);
327 application.ProcessEvent(longPress);
328 longPress.state = Gesture::Started;
329 application.ProcessEvent(longPress);
330 longPress.state = Gesture::Finished;
331 application.ProcessEvent(longPress);
333 Stage::GetCurrent().Remove(dummy);
338 int UtcDaliControlImplChildAddAndRemove(void)
340 ToolkitTestApplication application;
343 DummyControl dummy = DummyControl::New( true );
344 Stage::GetCurrent().Add(dummy);
345 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
347 application.Render();
348 application.SendNotification();
350 DALI_TEST_EQUALS( dummyImpl.childAddCalled, false, TEST_LOCATION );
351 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
352 Actor actor = RenderableActor::New();
354 DALI_TEST_EQUALS( dummyImpl.childAddCalled, true, TEST_LOCATION );
355 DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
357 application.Render();
358 application.SendNotification();
360 DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, false, TEST_LOCATION );
361 dummy.Remove( actor );
362 DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, true, TEST_LOCATION );
363 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
365 application.Render();
366 application.SendNotification();
368 Stage::GetCurrent().Remove(dummy);
371 // Ensure full code coverage
373 DummyControl dummy = DummyControl::New();
374 Stage::GetCurrent().Add(dummy);
376 application.Render();
377 application.SendNotification();
379 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
380 Actor actor = RenderableActor::New();
382 DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
384 application.Render();
385 application.SendNotification();
387 dummy.Remove( actor );
388 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
390 application.Render();
391 application.SendNotification();
393 Stage::GetCurrent().Remove(dummy);
398 int UtcDaliControlImplStageConnection(void)
400 ToolkitTestApplication application;
403 DummyControl dummy = DummyControl::New( true );
404 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
406 DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, false, TEST_LOCATION );
407 Stage::GetCurrent().Add(dummy);
408 application.Render();
409 application.SendNotification();
410 DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, true, TEST_LOCATION );
412 DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, false, TEST_LOCATION );
413 Stage::GetCurrent().Remove(dummy);
414 application.Render();
415 application.SendNotification();
416 DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, true, TEST_LOCATION );
419 // Ensure full code coverage
421 unsigned int stageChildren = Stage::GetCurrent().GetLayer(0).GetChildCount();
422 DummyControl dummy = DummyControl::New();
424 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
425 Stage::GetCurrent().Add(dummy);
426 application.Render();
427 application.SendNotification();
428 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren + 1, TEST_LOCATION );
430 Stage::GetCurrent().Remove(dummy);
431 application.Render();
432 application.SendNotification();
433 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
438 int UtcDaliControlImplSizeSet(void)
440 ToolkitTestApplication application;
443 DummyControl dummy = DummyControl::New( true );
444 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
446 Stage::GetCurrent().Add(dummy);
447 application.Render();
448 application.SendNotification();
450 DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION );
451 Vector3 size(100.0f, 200.0f, 0.0f);
454 application.Render();
455 application.SendNotification();
456 application.Render();
457 application.SendNotification();
459 DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
460 DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION );
462 Stage::GetCurrent().Remove(dummy);
465 // Ensure full code coverage
467 DummyControl dummy = DummyControl::New();
468 Stage::GetCurrent().Add(dummy);
470 Vector3 size(100.0f, 200.0f, 0.0f);
471 DALI_TEST_CHECK( size != dummy.GetCurrentSize() );
473 application.Render();
474 application.SendNotification();
478 application.Render();
479 application.SendNotification();
480 application.Render();
481 application.SendNotification();
483 DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
485 Stage::GetCurrent().Remove(dummy);
490 int UtcDaliControlImplSizeAnimation(void)
492 ToolkitTestApplication application;
495 DummyControl dummy = DummyControl::New( true );
496 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
498 Stage::GetCurrent().Add(dummy);
500 DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
501 Animation animation = Animation::New(1.0f);
502 animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
505 application.Render();
506 application.SendNotification();
507 application.Render();
508 application.SendNotification();
510 DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION );
512 Stage::GetCurrent().Remove(dummy);
515 // Ensure full code coverage
517 DummyControl dummy = DummyControl::New();
519 Stage::GetCurrent().Add(dummy);
521 Animation animation = Animation::New(1.0f);
522 animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
525 application.Render();
526 application.SendNotification();
527 application.Render();
528 application.SendNotification();
530 Stage::GetCurrent().Remove(dummy);
535 ///////////////////////////////////////////////////////////////////////////////////////////////////
537 int UtcDaliControlImplTouchEvent(void)
539 ToolkitTestApplication application;
542 DummyControl dummy = DummyControl::New( true );
543 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
545 dummy.SetSize(100.0f, 100.0f);
546 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
547 Stage::GetCurrent().Add(dummy);
549 application.Render();
550 application.SendNotification();
551 application.Render();
552 application.SendNotification();
554 DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION );
555 Integration::TouchEvent touchEvent(1);
556 TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
557 touchEvent.AddPoint(point);
558 application.ProcessEvent(touchEvent);
559 DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION );
561 Stage::GetCurrent().Remove(dummy);
564 // Ensure full code coverage
566 DummyControl dummy = DummyControl::New();
568 dummy.SetSize(100.0f, 100.0f);
569 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
570 Stage::GetCurrent().Add(dummy);
572 application.Render();
573 application.SendNotification();
574 application.Render();
575 application.SendNotification();
577 Integration::TouchEvent touchEvent(1);
578 TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
579 touchEvent.AddPoint(point);
580 application.ProcessEvent(touchEvent);
582 Stage::GetCurrent().Remove(dummy);
587 ///////////////////////////////////////////////////////////////////////////////////////////////////
590 int UtcDaliControlImplKeyEvent(void)
592 ToolkitTestApplication application;
595 DummyControl dummy = DummyControl::New( true );
596 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
598 Stage::GetCurrent().Add(dummy);
599 dummy.SetKeyInputFocus();
601 application.Render();
602 application.SendNotification();
603 application.Render();
604 application.SendNotification();
606 DALI_TEST_EQUALS( dummyImpl.keyEventCalled, false, TEST_LOCATION );
607 Integration::KeyEvent keyEvent;
608 application.ProcessEvent(keyEvent);
609 DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION );
611 Stage::GetCurrent().Remove(dummy);
614 // Ensure full code coverage
616 DummyControl dummy = DummyControl::New();
618 Stage::GetCurrent().Add(dummy);
619 dummy.SetKeyInputFocus();
621 application.Render();
622 application.SendNotification();
623 application.Render();
624 application.SendNotification();
626 Integration::KeyEvent keyEvent;
627 application.ProcessEvent(keyEvent);
629 Stage::GetCurrent().Remove(dummy);
634 int UtcDaliControlImplStyleChange(void)
636 ToolkitTestApplication application;
638 DummyControl dummy = DummyControl::New( true );
639 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
641 Stage::GetCurrent().Add(dummy);
643 application.Render();
644 application.SendNotification();
645 application.Render();
646 application.SendNotification();
648 // Add a Control and normal Actor as children
649 DummyControl dummyChild = DummyControl::New();
650 dummy.Add(dummyChild);
652 Actor actor = Actor::New();
655 DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, false, TEST_LOCATION );
656 StyleChange styleChange;
657 styleChange.defaultFontChange = true;
658 Dali::StyleMonitor styleMonitor = application.GetAdaptor().GetToolkitStyleMonitor();
659 styleMonitor.EmitStyleChangeSignal(styleChange);
661 DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, true, TEST_LOCATION );
663 Stage::GetCurrent().Remove(dummy);
667 int UtcDaliControlImplKeyInputFocusGained(void)
669 ToolkitTestApplication application;
672 DummyControl dummy = DummyControl::New( true );
673 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
675 Stage::GetCurrent().Add(dummy);
677 DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, false, TEST_LOCATION );
679 dummy.SetKeyInputFocus();
681 DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, true, TEST_LOCATION );
683 Stage::GetCurrent().Remove(dummy);
686 // Ensure full code coverage
688 DummyControl dummy = DummyControl::New();
690 Stage::GetCurrent().Add(dummy);
691 dummy.SetKeyInputFocus();
692 Stage::GetCurrent().Remove(dummy);
697 int UtcDaliControlImplKeyInputFocusLost(void)
699 ToolkitTestApplication application;
702 DummyControl dummy = DummyControl::New( true );
703 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
705 Stage::GetCurrent().Add(dummy);
707 DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, false, TEST_LOCATION );
709 dummy.SetKeyInputFocus();
710 dummy.ClearKeyInputFocus();
712 DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, true, TEST_LOCATION );
714 Stage::GetCurrent().Remove(dummy);
717 // Ensure full code coverage
719 DummyControl dummy = DummyControl::New();
721 Stage::GetCurrent().Add(dummy);
722 dummy.SetKeyInputFocus();
723 dummy.ClearKeyInputFocus();
725 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
727 dummyImpl.OnAccessibilityValueChange( true );
728 dummyImpl.IsKeyboardNavigationSupported();
729 dummyImpl.IsKeyboardFocusGroup();
731 Stage::GetCurrent().Remove(dummy);