2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
21 // Need to override adaptor classes for toolkit test harness, so include
22 // test harness headers before dali headers.
23 #include <dali-toolkit-test-suite-utils.h>
26 #include <dali-toolkit/dali-toolkit.h>
27 #include <dali/integration-api/events/key-event-integ.h>
28 #include <dali/integration-api/events/mouse-wheel-event-integ.h>
29 #include <dali/integration-api/events/long-press-gesture-event.h>
30 #include <dali/integration-api/events/pinch-gesture-event.h>
31 #include <dali/integration-api/events/pan-gesture-event.h>
32 #include <dali/integration-api/events/tap-gesture-event.h>
33 #include <dali/integration-api/events/touch-event-integ.h>
35 #include "dummy-control.h"
38 using namespace Dali::Toolkit;
40 void utc_dali_toolkit_control_impl_startup(void)
42 test_return_value = TET_UNDEF;
45 void utc_dali_toolkit_control_impl_cleanup(void)
47 test_return_value = TET_PASS;
50 int UtcDaliControlImplNew(void)
52 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
56 DALI_TEST_CHECK( !Control::DownCast(control) );
58 control = Toolkit::Internal::Control::New();
60 DALI_TEST_CHECK( Control::DownCast(control) );
65 int UtcDaliControlImplEnableGestureDetector(void)
67 ToolkitTestApplication application;
69 // Enable individually
71 DummyControl dummy = DummyControl::New();
72 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
74 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
75 dummyImpl.EnableGestureDetection(Gesture::Pinch);
76 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
78 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
79 dummyImpl.EnableGestureDetection(Gesture::Pan);
80 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
82 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
83 dummyImpl.EnableGestureDetection(Gesture::Tap);
84 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
86 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
87 dummyImpl.EnableGestureDetection(Gesture::LongPress);
88 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
93 DummyControl dummy = DummyControl::New();
94 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
96 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
97 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
98 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
99 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
101 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
103 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
104 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
105 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
106 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
108 // Enable when already enabled
110 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
112 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
113 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
114 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
115 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
120 int UtcDaliControlImplDisableGestureDetector(void)
122 ToolkitTestApplication application;
124 // Disable individually
126 DummyControl dummy = DummyControl::New();
127 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
129 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
131 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
132 dummyImpl.DisableGestureDetection(Gesture::Pinch);
133 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
135 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
136 dummyImpl.DisableGestureDetection(Gesture::Pan);
137 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
139 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
140 dummyImpl.DisableGestureDetection(Gesture::Tap);
141 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
143 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
144 dummyImpl.DisableGestureDetection(Gesture::LongPress);
145 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
150 DummyControl dummy = DummyControl::New();
151 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
153 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
155 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
156 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
157 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
158 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
160 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
162 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
163 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
164 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
165 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
168 // Disable When not enabled
170 DummyControl dummy = DummyControl::New();
171 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
173 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
174 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
175 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
176 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
178 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
180 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
181 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
182 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
183 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
186 // Ensure control is detached if gesture detector is not deleted
188 DummyControl dummy = DummyControl::New();
189 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
191 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
193 PinchGestureDetector pinch = dummyImpl.GetPinchGestureDetector();
194 PanGestureDetector pan = dummyImpl.GetPanGestureDetector();
195 TapGestureDetector tap = dummyImpl.GetTapGestureDetector();
196 LongPressGestureDetector longPress = dummyImpl.GetLongPressGestureDetector();
198 DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), false, TEST_LOCATION );
199 DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), false, TEST_LOCATION );
200 DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), false, TEST_LOCATION );
201 DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), false, TEST_LOCATION );
203 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
205 DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), true, TEST_LOCATION );
206 DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), true, TEST_LOCATION );
207 DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), true, TEST_LOCATION );
208 DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), true, TEST_LOCATION );
213 int UtcDaliControlImplOnGestureMethods(void)
215 ToolkitTestApplication application;
217 // Check gesture actually happens
219 DummyControl dummy = DummyControl::New(true);
220 dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
222 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
223 Stage::GetCurrent().Add(dummy);
225 // Render and notify a couple of times
226 application.SendNotification();
227 application.Render();
228 application.SendNotification();
229 application.Render();
231 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
232 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
234 DALI_TEST_CHECK( dummyImpl.pinchCalled == false );
235 Integration::PinchGestureEvent pinch(Gesture::Started);
238 pinch.centerPoint = Vector2(20.0f, 20.0f);
239 application.ProcessEvent(pinch);
240 DALI_TEST_CHECK( dummyImpl.pinchCalled == true );
242 DALI_TEST_CHECK( dummyImpl.panCalled == false );
243 Integration::PanGestureEvent pan(Gesture::Possible);
244 pan.previousPosition = Vector2(10.0f, 20.0f);
245 pan.currentPosition = Vector2(20.0f, 20.0f);
247 pan.numberOfTouches = 1u;
248 application.ProcessEvent(pan);
249 pan.state = Gesture::Started;
250 application.ProcessEvent(pan);
251 DALI_TEST_CHECK( dummyImpl.panCalled == true );
253 DALI_TEST_CHECK( dummyImpl.tapCalled == false );
254 Integration::TapGestureEvent tap(Gesture::Possible);
255 tap.numberOfTaps = 1u;
256 tap.numberOfTouches = 1u;
257 tap.point = Vector2(50.0f, 50.0f);
258 application.ProcessEvent(tap);
259 tap.state = Gesture::Started;
260 application.ProcessEvent(tap);
261 DALI_TEST_CHECK( dummyImpl.tapCalled == true );
263 DALI_TEST_CHECK( dummyImpl.longPressCalled == false );
264 Integration::LongPressGestureEvent longPress(Gesture::Possible);
265 longPress.numberOfTouches = 1u;
266 longPress.point = Vector2(50.0f, 50.0f);
267 application.ProcessEvent(longPress);
268 longPress.state = Gesture::Started;
269 application.ProcessEvent(longPress);
270 DALI_TEST_CHECK( dummyImpl.longPressCalled == true );
271 longPress.state = Gesture::Finished;
272 application.ProcessEvent(longPress);
274 Stage::GetCurrent().Remove(dummy);
277 // Ensure full code coverage
279 DummyControl dummy = DummyControl::New();
280 dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
282 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
283 Stage::GetCurrent().Add(dummy);
285 // Render and notify a couple of times
286 application.SendNotification();
287 application.Render();
288 application.SendNotification();
289 application.Render();
291 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
292 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
294 DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f );
295 Integration::PinchGestureEvent pinch(Gesture::Started);
298 pinch.centerPoint = Vector2(20.0f, 20.0f);
299 application.ProcessEvent(pinch);
301 // Render and notify a couple of times
302 application.SendNotification();
303 application.Render();
304 application.SendNotification();
305 application.Render();
306 DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f );
308 Integration::PanGestureEvent pan(Gesture::Possible);
309 pan.previousPosition = Vector2(10.0f, 20.0f);
310 pan.currentPosition = Vector2(20.0f, 20.0f);
312 pan.numberOfTouches = 1u;
313 application.ProcessEvent(pan);
314 pan.state = Gesture::Started;
315 application.ProcessEvent(pan);
317 Integration::TapGestureEvent tap(Gesture::Possible);
318 tap.numberOfTaps = 1u;
319 tap.numberOfTouches = 1u;
320 tap.point = Vector2(50.0f, 50.0f);
321 application.ProcessEvent(tap);
322 tap.state = Gesture::Started;
323 application.ProcessEvent(tap);
325 Integration::LongPressGestureEvent longPress(Gesture::Possible);
326 longPress.numberOfTouches = 1u;
327 longPress.point = Vector2(50.0f, 50.0f);
328 application.ProcessEvent(longPress);
329 longPress.state = Gesture::Started;
330 application.ProcessEvent(longPress);
331 longPress.state = Gesture::Finished;
332 application.ProcessEvent(longPress);
334 Stage::GetCurrent().Remove(dummy);
339 int UtcDaliControlImplChildAddAndRemove(void)
341 ToolkitTestApplication application;
344 DummyControl dummy = DummyControl::New( true );
345 Stage::GetCurrent().Add(dummy);
346 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
348 application.Render();
349 application.SendNotification();
351 DALI_TEST_EQUALS( dummyImpl.childAddCalled, false, TEST_LOCATION );
352 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
353 Actor actor = RenderableActor::New();
355 DALI_TEST_EQUALS( dummyImpl.childAddCalled, true, TEST_LOCATION );
356 DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
358 application.Render();
359 application.SendNotification();
361 DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, false, TEST_LOCATION );
362 dummy.Remove( actor );
363 DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, true, TEST_LOCATION );
364 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
366 application.Render();
367 application.SendNotification();
369 Stage::GetCurrent().Remove(dummy);
372 // Ensure full code coverage
374 DummyControl dummy = DummyControl::New();
375 Stage::GetCurrent().Add(dummy);
377 application.Render();
378 application.SendNotification();
380 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
381 Actor actor = RenderableActor::New();
383 DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
385 application.Render();
386 application.SendNotification();
388 dummy.Remove( actor );
389 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
391 application.Render();
392 application.SendNotification();
394 Stage::GetCurrent().Remove(dummy);
399 int UtcDaliControlImplStageConnection(void)
401 ToolkitTestApplication application;
404 DummyControl dummy = DummyControl::New( true );
405 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
407 DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, false, TEST_LOCATION );
408 Stage::GetCurrent().Add(dummy);
409 application.Render();
410 application.SendNotification();
411 DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, true, TEST_LOCATION );
413 DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, false, TEST_LOCATION );
414 Stage::GetCurrent().Remove(dummy);
415 application.Render();
416 application.SendNotification();
417 DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, true, TEST_LOCATION );
420 // Ensure full code coverage
422 unsigned int stageChildren = Stage::GetCurrent().GetLayer(0).GetChildCount();
423 DummyControl dummy = DummyControl::New();
425 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
426 Stage::GetCurrent().Add(dummy);
427 application.Render();
428 application.SendNotification();
429 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren + 1, TEST_LOCATION );
431 Stage::GetCurrent().Remove(dummy);
432 application.Render();
433 application.SendNotification();
434 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
439 int UtcDaliControlImplSizeSet(void)
441 ToolkitTestApplication application;
444 DummyControl dummy = DummyControl::New( true );
445 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
447 Stage::GetCurrent().Add(dummy);
448 application.Render();
449 application.SendNotification();
451 DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION );
452 Vector3 size(100.0f, 200.0f, 0.0f);
455 application.Render();
456 application.SendNotification();
457 application.Render();
458 application.SendNotification();
460 DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
461 DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION );
463 Stage::GetCurrent().Remove(dummy);
466 // Ensure full code coverage
468 DummyControl dummy = DummyControl::New();
469 Stage::GetCurrent().Add(dummy);
471 Vector3 size(100.0f, 200.0f, 0.0f);
472 DALI_TEST_CHECK( size != dummy.GetCurrentSize() );
474 application.Render();
475 application.SendNotification();
479 application.Render();
480 application.SendNotification();
481 application.Render();
482 application.SendNotification();
484 DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
486 Stage::GetCurrent().Remove(dummy);
491 int UtcDaliControlImplSizeAnimation(void)
493 ToolkitTestApplication application;
496 DummyControl dummy = DummyControl::New( true );
497 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
499 Stage::GetCurrent().Add(dummy);
501 DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
502 Animation animation = Animation::New(1.0f);
503 animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
506 application.Render();
507 application.SendNotification();
508 application.Render();
509 application.SendNotification();
511 DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION );
513 Stage::GetCurrent().Remove(dummy);
516 // Ensure full code coverage
518 DummyControl dummy = DummyControl::New();
520 Stage::GetCurrent().Add(dummy);
522 Animation animation = Animation::New(1.0f);
523 animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
526 application.Render();
527 application.SendNotification();
528 application.Render();
529 application.SendNotification();
531 Stage::GetCurrent().Remove(dummy);
536 ///////////////////////////////////////////////////////////////////////////////////////////////////
538 int UtcDaliControlImplTouchEvent(void)
540 ToolkitTestApplication application;
543 DummyControl dummy = DummyControl::New( true );
544 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
546 dummy.SetSize(100.0f, 100.0f);
547 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
548 Stage::GetCurrent().Add(dummy);
550 application.Render();
551 application.SendNotification();
552 application.Render();
553 application.SendNotification();
555 DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION );
556 Integration::TouchEvent touchEvent(1);
557 TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
558 touchEvent.AddPoint(point);
559 application.ProcessEvent(touchEvent);
560 DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION );
562 Stage::GetCurrent().Remove(dummy);
565 // Ensure full code coverage
567 DummyControl dummy = DummyControl::New();
569 dummy.SetSize(100.0f, 100.0f);
570 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
571 Stage::GetCurrent().Add(dummy);
573 application.Render();
574 application.SendNotification();
575 application.Render();
576 application.SendNotification();
578 Integration::TouchEvent touchEvent(1);
579 TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
580 touchEvent.AddPoint(point);
581 application.ProcessEvent(touchEvent);
583 Stage::GetCurrent().Remove(dummy);
588 ///////////////////////////////////////////////////////////////////////////////////////////////////
591 int UtcDaliControlImplKeyEvent(void)
593 ToolkitTestApplication application;
596 DummyControl dummy = DummyControl::New( true );
597 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
599 Stage::GetCurrent().Add(dummy);
600 dummy.SetKeyInputFocus();
602 application.Render();
603 application.SendNotification();
604 application.Render();
605 application.SendNotification();
607 DALI_TEST_EQUALS( dummyImpl.keyEventCalled, false, TEST_LOCATION );
608 Integration::KeyEvent keyEvent;
609 application.ProcessEvent(keyEvent);
610 DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION );
612 Stage::GetCurrent().Remove(dummy);
615 // Ensure full code coverage
617 DummyControl dummy = DummyControl::New();
619 Stage::GetCurrent().Add(dummy);
620 dummy.SetKeyInputFocus();
622 application.Render();
623 application.SendNotification();
624 application.Render();
625 application.SendNotification();
627 Integration::KeyEvent keyEvent;
628 application.ProcessEvent(keyEvent);
630 Stage::GetCurrent().Remove(dummy);
635 int UtcDaliControlImplStyleChange(void)
637 ToolkitTestApplication application;
639 DummyControl dummy = DummyControl::New( true );
640 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
642 Stage::GetCurrent().Add(dummy);
644 application.Render();
645 application.SendNotification();
646 application.Render();
647 application.SendNotification();
649 // Add a Control and normal Actor as children
650 DummyControl dummyChild = DummyControl::New();
651 dummy.Add(dummyChild);
653 Actor actor = Actor::New();
656 DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, false, TEST_LOCATION );
657 StyleChange styleChange;
658 styleChange.defaultFontChange = true;
659 Dali::StyleMonitor styleMonitor = application.GetAdaptor().GetToolkitStyleMonitor();
660 styleMonitor.EmitStyleChangeSignal(styleChange);
662 DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, true, TEST_LOCATION );
664 Stage::GetCurrent().Remove(dummy);
668 int UtcDaliControlImplKeyInputFocusGained(void)
670 ToolkitTestApplication application;
673 DummyControl dummy = DummyControl::New( true );
674 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
676 Stage::GetCurrent().Add(dummy);
678 DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, false, TEST_LOCATION );
680 dummy.SetKeyInputFocus();
682 DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, true, TEST_LOCATION );
684 Stage::GetCurrent().Remove(dummy);
687 // Ensure full code coverage
689 DummyControl dummy = DummyControl::New();
691 Stage::GetCurrent().Add(dummy);
692 dummy.SetKeyInputFocus();
693 Stage::GetCurrent().Remove(dummy);
698 int UtcDaliControlImplKeyInputFocusLost(void)
700 ToolkitTestApplication application;
703 DummyControl dummy = DummyControl::New( true );
704 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
706 Stage::GetCurrent().Add(dummy);
708 DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, false, TEST_LOCATION );
710 dummy.SetKeyInputFocus();
711 dummy.ClearKeyInputFocus();
713 DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, true, TEST_LOCATION );
715 Stage::GetCurrent().Remove(dummy);
718 // Ensure full code coverage
720 DummyControl dummy = DummyControl::New();
722 Stage::GetCurrent().Add(dummy);
723 dummy.SetKeyInputFocus();
724 dummy.ClearKeyInputFocus();
726 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
728 dummyImpl.OnAccessibilityValueChange( true );
729 dummyImpl.IsKeyboardNavigationSupported();
730 dummyImpl.IsKeyboardFocusGroup();
732 Stage::GetCurrent().Remove(dummy);