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>
24 #include "toolkit-style-monitor.h"
27 #include <dali-toolkit/dali-toolkit.h>
28 #include <dali/integration-api/events/key-event-integ.h>
29 #include <dali/integration-api/events/mouse-wheel-event-integ.h>
30 #include <dali/integration-api/events/long-press-gesture-event.h>
31 #include <dali/integration-api/events/pinch-gesture-event.h>
32 #include <dali/integration-api/events/pan-gesture-event.h>
33 #include <dali/integration-api/events/tap-gesture-event.h>
34 #include <dali/integration-api/events/touch-event-integ.h>
36 #include "dummy-control.h"
39 using namespace Dali::Toolkit;
41 void utc_dali_toolkit_control_impl_startup(void)
43 test_return_value = TET_UNDEF;
46 void utc_dali_toolkit_control_impl_cleanup(void)
48 test_return_value = TET_PASS;
51 int UtcDaliControlImplNew(void)
53 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
57 DALI_TEST_CHECK( !Control::DownCast(control) );
59 control = Toolkit::Internal::Control::New();
61 DALI_TEST_CHECK( Control::DownCast(control) );
66 int UtcDaliControlImplEnableGestureDetector(void)
68 ToolkitTestApplication application;
70 // Enable individually
72 DummyControl dummy = DummyControl::New();
73 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
75 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
76 dummyImpl.EnableGestureDetection(Gesture::Pinch);
77 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
79 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
80 dummyImpl.EnableGestureDetection(Gesture::Pan);
81 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
83 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
84 dummyImpl.EnableGestureDetection(Gesture::Tap);
85 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
87 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
88 dummyImpl.EnableGestureDetection(Gesture::LongPress);
89 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
94 DummyControl dummy = DummyControl::New();
95 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
97 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
98 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
99 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
100 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
102 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
104 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
105 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
106 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
107 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
109 // Enable when already enabled
111 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
113 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
114 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
115 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
116 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
121 int UtcDaliControlImplDisableGestureDetector(void)
123 ToolkitTestApplication application;
125 // Disable individually
127 DummyControl dummy = DummyControl::New();
128 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
130 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
132 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
133 dummyImpl.DisableGestureDetection(Gesture::Pinch);
134 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
136 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
137 dummyImpl.DisableGestureDetection(Gesture::Pan);
138 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
140 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
141 dummyImpl.DisableGestureDetection(Gesture::Tap);
142 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
144 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
145 dummyImpl.DisableGestureDetection(Gesture::LongPress);
146 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
151 DummyControl dummy = DummyControl::New();
152 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
154 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
156 DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
157 DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
158 DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
159 DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
161 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
163 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
164 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
165 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
166 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
169 // Disable When not enabled
171 DummyControl dummy = DummyControl::New();
172 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
174 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
175 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
176 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
177 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
179 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
181 DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
182 DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
183 DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
184 DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
187 // Ensure control is detached if gesture detector is not deleted
189 DummyControl dummy = DummyControl::New();
190 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
192 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
194 PinchGestureDetector pinch = dummyImpl.GetPinchGestureDetector();
195 PanGestureDetector pan = dummyImpl.GetPanGestureDetector();
196 TapGestureDetector tap = dummyImpl.GetTapGestureDetector();
197 LongPressGestureDetector longPress = dummyImpl.GetLongPressGestureDetector();
199 DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), false, TEST_LOCATION );
200 DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), false, TEST_LOCATION );
201 DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), false, TEST_LOCATION );
202 DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), false, TEST_LOCATION );
204 dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
206 DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), true, TEST_LOCATION );
207 DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), true, TEST_LOCATION );
208 DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), true, TEST_LOCATION );
209 DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), true, TEST_LOCATION );
214 int UtcDaliControlImplOnGestureMethods(void)
216 ToolkitTestApplication application;
218 // Check gesture actually happens
220 DummyControl dummy = DummyControl::New(true);
221 dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
223 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
224 Stage::GetCurrent().Add(dummy);
226 // Render and notify a couple of times
227 application.SendNotification();
228 application.Render();
229 application.SendNotification();
230 application.Render();
232 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
233 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
235 DALI_TEST_CHECK( dummyImpl.pinchCalled == false );
236 Integration::PinchGestureEvent pinch(Gesture::Started);
239 pinch.centerPoint = Vector2(20.0f, 20.0f);
240 application.ProcessEvent(pinch);
241 DALI_TEST_CHECK( dummyImpl.pinchCalled == true );
243 DALI_TEST_CHECK( dummyImpl.panCalled == false );
244 Integration::PanGestureEvent pan(Gesture::Possible);
245 pan.previousPosition = Vector2(10.0f, 20.0f);
246 pan.currentPosition = Vector2(20.0f, 20.0f);
248 pan.numberOfTouches = 1u;
249 application.ProcessEvent(pan);
250 pan.state = Gesture::Started;
251 application.ProcessEvent(pan);
252 DALI_TEST_CHECK( dummyImpl.panCalled == true );
254 DALI_TEST_CHECK( dummyImpl.tapCalled == false );
255 Integration::TapGestureEvent tap(Gesture::Possible);
256 tap.numberOfTaps = 1u;
257 tap.numberOfTouches = 1u;
258 tap.point = Vector2(50.0f, 50.0f);
259 application.ProcessEvent(tap);
260 tap.state = Gesture::Started;
261 application.ProcessEvent(tap);
262 DALI_TEST_CHECK( dummyImpl.tapCalled == true );
264 DALI_TEST_CHECK( dummyImpl.longPressCalled == false );
265 Integration::LongPressGestureEvent longPress(Gesture::Possible);
266 longPress.numberOfTouches = 1u;
267 longPress.point = Vector2(50.0f, 50.0f);
268 application.ProcessEvent(longPress);
269 longPress.state = Gesture::Started;
270 application.ProcessEvent(longPress);
271 DALI_TEST_CHECK( dummyImpl.longPressCalled == true );
272 longPress.state = Gesture::Finished;
273 application.ProcessEvent(longPress);
275 Stage::GetCurrent().Remove(dummy);
278 // Ensure full code coverage
280 DummyControl dummy = DummyControl::New();
281 dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
283 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
284 Stage::GetCurrent().Add(dummy);
286 // Render and notify a couple of times
287 application.SendNotification();
288 application.Render();
289 application.SendNotification();
290 application.Render();
292 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
293 dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
295 DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f );
296 Integration::PinchGestureEvent pinch(Gesture::Started);
299 pinch.centerPoint = Vector2(20.0f, 20.0f);
300 application.ProcessEvent(pinch);
302 // Render and notify a couple of times
303 application.SendNotification();
304 application.Render();
305 application.SendNotification();
306 application.Render();
307 DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f );
309 Integration::PanGestureEvent pan(Gesture::Possible);
310 pan.previousPosition = Vector2(10.0f, 20.0f);
311 pan.currentPosition = Vector2(20.0f, 20.0f);
313 pan.numberOfTouches = 1u;
314 application.ProcessEvent(pan);
315 pan.state = Gesture::Started;
316 application.ProcessEvent(pan);
318 Integration::TapGestureEvent tap(Gesture::Possible);
319 tap.numberOfTaps = 1u;
320 tap.numberOfTouches = 1u;
321 tap.point = Vector2(50.0f, 50.0f);
322 application.ProcessEvent(tap);
323 tap.state = Gesture::Started;
324 application.ProcessEvent(tap);
326 Integration::LongPressGestureEvent longPress(Gesture::Possible);
327 longPress.numberOfTouches = 1u;
328 longPress.point = Vector2(50.0f, 50.0f);
329 application.ProcessEvent(longPress);
330 longPress.state = Gesture::Started;
331 application.ProcessEvent(longPress);
332 longPress.state = Gesture::Finished;
333 application.ProcessEvent(longPress);
335 Stage::GetCurrent().Remove(dummy);
340 int UtcDaliControlImplChildAddAndRemove(void)
342 ToolkitTestApplication application;
345 DummyControl dummy = DummyControl::New( true );
346 Stage::GetCurrent().Add(dummy);
347 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
349 application.Render();
350 application.SendNotification();
352 DALI_TEST_EQUALS( dummyImpl.childAddCalled, false, TEST_LOCATION );
353 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
354 Actor actor = RenderableActor::New();
356 DALI_TEST_EQUALS( dummyImpl.childAddCalled, true, TEST_LOCATION );
357 DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
359 application.Render();
360 application.SendNotification();
362 DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, false, TEST_LOCATION );
363 dummy.Remove( actor );
364 DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, true, TEST_LOCATION );
365 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
367 application.Render();
368 application.SendNotification();
370 Stage::GetCurrent().Remove(dummy);
373 // Ensure full code coverage
375 DummyControl dummy = DummyControl::New();
376 Stage::GetCurrent().Add(dummy);
378 application.Render();
379 application.SendNotification();
381 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
382 Actor actor = RenderableActor::New();
384 DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
386 application.Render();
387 application.SendNotification();
389 dummy.Remove( actor );
390 DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
392 application.Render();
393 application.SendNotification();
395 Stage::GetCurrent().Remove(dummy);
400 int UtcDaliControlImplStageConnection(void)
402 ToolkitTestApplication application;
405 DummyControl dummy = DummyControl::New( true );
406 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
408 DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, false, TEST_LOCATION );
409 Stage::GetCurrent().Add(dummy);
410 application.Render();
411 application.SendNotification();
412 DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, true, TEST_LOCATION );
414 DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, false, TEST_LOCATION );
415 Stage::GetCurrent().Remove(dummy);
416 application.Render();
417 application.SendNotification();
418 DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, true, TEST_LOCATION );
421 // Ensure full code coverage
423 unsigned int stageChildren = Stage::GetCurrent().GetLayer(0).GetChildCount();
424 DummyControl dummy = DummyControl::New();
426 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
427 Stage::GetCurrent().Add(dummy);
428 application.Render();
429 application.SendNotification();
430 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren + 1, TEST_LOCATION );
432 Stage::GetCurrent().Remove(dummy);
433 application.Render();
434 application.SendNotification();
435 DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
440 int UtcDaliControlImplSizeSet(void)
442 ToolkitTestApplication application;
445 DummyControl dummy = DummyControl::New( true );
446 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
448 Stage::GetCurrent().Add(dummy);
449 application.Render();
450 application.SendNotification();
452 DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION );
453 Vector3 size(100.0f, 200.0f, 0.0f);
456 application.Render();
457 application.SendNotification();
458 application.Render();
459 application.SendNotification();
461 DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
462 DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION );
464 Stage::GetCurrent().Remove(dummy);
467 // Ensure full code coverage
469 DummyControl dummy = DummyControl::New();
470 Stage::GetCurrent().Add(dummy);
472 Vector3 size(100.0f, 200.0f, 0.0f);
473 DALI_TEST_CHECK( size != dummy.GetCurrentSize() );
475 application.Render();
476 application.SendNotification();
480 application.Render();
481 application.SendNotification();
482 application.Render();
483 application.SendNotification();
485 DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
487 Stage::GetCurrent().Remove(dummy);
492 int UtcDaliControlImplSizeAnimation(void)
494 ToolkitTestApplication application;
497 DummyControl dummy = DummyControl::New( true );
498 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
500 Stage::GetCurrent().Add(dummy);
502 DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
503 Animation animation = Animation::New(1.0f);
504 animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
507 application.Render();
508 application.SendNotification();
509 application.Render();
510 application.SendNotification();
512 DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION );
514 Stage::GetCurrent().Remove(dummy);
517 // Ensure full code coverage
519 DummyControl dummy = DummyControl::New();
521 Stage::GetCurrent().Add(dummy);
523 Animation animation = Animation::New(1.0f);
524 animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
527 application.Render();
528 application.SendNotification();
529 application.Render();
530 application.SendNotification();
532 Stage::GetCurrent().Remove(dummy);
537 ///////////////////////////////////////////////////////////////////////////////////////////////////
539 int UtcDaliControlImplTouchEvent(void)
541 ToolkitTestApplication application;
544 DummyControl dummy = DummyControl::New( true );
545 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
547 dummy.SetSize(100.0f, 100.0f);
548 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
549 Stage::GetCurrent().Add(dummy);
551 application.Render();
552 application.SendNotification();
553 application.Render();
554 application.SendNotification();
556 DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION );
557 Integration::TouchEvent touchEvent(1);
558 TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
559 touchEvent.AddPoint(point);
560 application.ProcessEvent(touchEvent);
561 DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION );
563 Stage::GetCurrent().Remove(dummy);
566 // Ensure full code coverage
568 DummyControl dummy = DummyControl::New();
570 dummy.SetSize(100.0f, 100.0f);
571 dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
572 Stage::GetCurrent().Add(dummy);
574 application.Render();
575 application.SendNotification();
576 application.Render();
577 application.SendNotification();
579 Integration::TouchEvent touchEvent(1);
580 TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
581 touchEvent.AddPoint(point);
582 application.ProcessEvent(touchEvent);
584 Stage::GetCurrent().Remove(dummy);
589 ///////////////////////////////////////////////////////////////////////////////////////////////////
592 int UtcDaliControlImplKeyEvent(void)
594 ToolkitTestApplication application;
597 DummyControl dummy = DummyControl::New( true );
598 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
600 Stage::GetCurrent().Add(dummy);
601 dummy.SetKeyInputFocus();
603 application.Render();
604 application.SendNotification();
605 application.Render();
606 application.SendNotification();
608 DALI_TEST_EQUALS( dummyImpl.keyEventCalled, false, TEST_LOCATION );
609 Integration::KeyEvent keyEvent;
610 application.ProcessEvent(keyEvent);
611 DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION );
613 Stage::GetCurrent().Remove(dummy);
616 // Ensure full code coverage
618 DummyControl dummy = DummyControl::New();
620 Stage::GetCurrent().Add(dummy);
621 dummy.SetKeyInputFocus();
623 application.Render();
624 application.SendNotification();
625 application.Render();
626 application.SendNotification();
628 Integration::KeyEvent keyEvent;
629 application.ProcessEvent(keyEvent);
631 Stage::GetCurrent().Remove(dummy);
636 int UtcDaliControlImplStyleChange(void)
638 ToolkitTestApplication application;
640 DummyControl dummy = DummyControl::New( true );
641 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
643 Stage::GetCurrent().Add(dummy);
645 application.Render();
646 application.SendNotification();
647 application.Render();
648 application.SendNotification();
650 // Add a Control and normal Actor as children
651 DummyControl dummyChild = DummyControl::New();
652 dummy.Add(dummyChild);
654 Actor actor = Actor::New();
657 DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, false, TEST_LOCATION );
658 StyleChange styleChange;
659 styleChange.defaultFontChange = true;
660 Dali::StyleMonitor styleMonitor = StyleMonitor::Get();
661 styleMonitor.EmitStyleChangeSignal(styleChange);
663 DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, true, TEST_LOCATION );
665 Stage::GetCurrent().Remove(dummy);
669 int UtcDaliControlImplKeyInputFocusGained(void)
671 ToolkitTestApplication application;
674 DummyControl dummy = DummyControl::New( true );
675 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
677 Stage::GetCurrent().Add(dummy);
679 DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, false, TEST_LOCATION );
681 dummy.SetKeyInputFocus();
683 DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, true, TEST_LOCATION );
685 Stage::GetCurrent().Remove(dummy);
688 // Ensure full code coverage
690 DummyControl dummy = DummyControl::New();
692 Stage::GetCurrent().Add(dummy);
693 dummy.SetKeyInputFocus();
694 Stage::GetCurrent().Remove(dummy);
699 int UtcDaliControlImplKeyInputFocusLost(void)
701 ToolkitTestApplication application;
704 DummyControl dummy = DummyControl::New( true );
705 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
707 Stage::GetCurrent().Add(dummy);
709 DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, false, TEST_LOCATION );
711 dummy.SetKeyInputFocus();
712 dummy.ClearKeyInputFocus();
714 DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, true, TEST_LOCATION );
716 Stage::GetCurrent().Remove(dummy);
719 // Ensure full code coverage
721 DummyControl dummy = DummyControl::New();
723 Stage::GetCurrent().Add(dummy);
724 dummy.SetKeyInputFocus();
725 dummy.ClearKeyInputFocus();
727 DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
729 dummyImpl.OnAccessibilityValueChange( true );
730 dummyImpl.IsKeyboardNavigationSupported();
731 dummyImpl.IsKeyboardFocusGroup();
733 Stage::GetCurrent().Remove(dummy);