2 * Copyright (c) 2016 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>
25 #include <dali-toolkit/dali-toolkit.h>
26 #include <dali/integration-api/events/key-event-integ.h>
27 #include <dali-toolkit/devel-api/controls/control-devel.h>
30 using namespace Dali::Toolkit;
32 void utc_dali_toolkit_keyboard_focus_manager_startup(void)
34 test_return_value = TET_UNDEF;
37 void utc_dali_toolkit_keyboard_focus_manager_cleanup(void)
39 test_return_value = TET_PASS;
46 // Functors to test whether PreFocusChange signal is emitted when the keyboard focus is about to change
47 class PreFocusChangeCallback : public Dali::ConnectionTracker
50 PreFocusChangeCallback(bool& signalReceived)
51 : mSignalVerified(signalReceived),
52 mCurrentFocusedActor(),
53 mProposedActorToFocus(),
54 mDirection(Control::KeyboardFocus::LEFT)
58 Actor Callback(Actor currentFocusedActor, Actor proposedActorToFocus, Control::KeyboardFocus::Direction direction)
60 tet_infoline("Verifying PreFocusChangeCallback()");
62 mSignalVerified = true;
64 mCurrentFocusedActor = currentFocusedActor;
65 mProposedActorToFocus = proposedActorToFocus;
66 mDirection = direction;
68 return mProposedActorToFocus;
73 mSignalVerified = false;
74 mCurrentFocusedActor = Actor();
75 mProposedActorToFocus = Actor();
76 mDirection = Control::KeyboardFocus::LEFT;
79 bool& mSignalVerified;
80 Actor mCurrentFocusedActor;
81 Actor mProposedActorToFocus;
82 Control::KeyboardFocus::Direction mDirection;
85 // Functors to test whether focus changed signal is emitted when the keyboard focus is changed
86 class FocusChangedCallback : public Dali::ConnectionTracker
89 FocusChangedCallback(bool& signalReceived)
90 : mSignalVerified(signalReceived),
91 mOriginalFocusedActor(),
92 mCurrentFocusedActor()
96 void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
98 tet_infoline("Verifying FocusChangedCallback()");
100 if(originalFocusedActor == mCurrentFocusedActor)
102 mSignalVerified = true;
105 mOriginalFocusedActor = originalFocusedActor;
106 mCurrentFocusedActor = currentFocusedActor;
111 mSignalVerified = false;
114 bool& mSignalVerified;
115 Actor mOriginalFocusedActor;
116 Actor mCurrentFocusedActor;
119 // Functors to test whether focus group changed signal is emitted when the keyboard focus group is changed
120 class FocusGroupChangedCallback : public Dali::ConnectionTracker
123 FocusGroupChangedCallback(bool& signalReceived)
124 : mSignalVerified(signalReceived),
125 mCurrentFocusedActor(),
130 void Callback(Actor currentFocusedActor, bool forward)
132 tet_infoline("Verifying FocusGroupChangedCallback()");
134 mSignalVerified = true;
136 mCurrentFocusedActor = currentFocusedActor;
142 mSignalVerified = false;
145 bool& mSignalVerified;
146 Actor mCurrentFocusedActor;
150 // Functors to test whether focused actor activated signal is emitted when the focused actor is activated
151 class FocusedActorActivatedCallback : public Dali::ConnectionTracker
154 FocusedActorActivatedCallback(bool& signalReceived)
155 : mSignalVerified(signalReceived),
160 void Callback(Actor activatedActor)
162 tet_infoline("Verifying FocusedActorActivatedCallback()");
164 mSignalVerified = true;
166 mActivatedActor = activatedActor;
171 mSignalVerified = false;
174 bool& mSignalVerified;
175 Actor mActivatedActor;
178 // Used to connect to signals via the ConnectSignal Handle method
179 struct CallbackFunctor
192 int UtcDaliKeyboardFocusManagerGet(void)
194 ToolkitTestApplication application;
196 tet_infoline(" UtcDaliKeyboardKeyboardFocusManagerGet");
200 type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
201 DALI_TEST_CHECK( type );
202 BaseHandle handle = type.CreateInstance();
203 DALI_TEST_CHECK( handle );
205 KeyboardFocusManager manager;
207 manager = KeyboardFocusManager::Get();
208 DALI_TEST_CHECK(manager);
210 KeyboardFocusManager newManager = KeyboardFocusManager::Get();
211 DALI_TEST_CHECK(newManager);
213 // Check that focus manager is a singleton
214 DALI_TEST_CHECK(manager == newManager);
218 int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor(void)
220 ToolkitTestApplication application;
222 tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor");
224 KeyboardFocusManager manager = KeyboardFocusManager::Get();
225 DALI_TEST_CHECK(manager);
227 // Create the first actor and add it to the stage
228 Actor first = Actor::New();
229 first.SetKeyboardFocusable(true);
230 Stage::GetCurrent().Add(first);
232 // Create the second actor and add it to the stage
233 Actor second = Actor::New();
234 second.SetKeyboardFocusable(true);
235 Stage::GetCurrent().Add(second);
237 // Create the third actor but don't add it to the stage
238 Actor third = Actor::New();
240 // Check that no actor is being focused yet.
241 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
243 // Check that it will fail to set focus on an invalid actor
244 DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
246 // Check that the focus is set on the first actor
247 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
248 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
250 // Check that the focus is set on the second actor
251 DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
252 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
254 // Check that it will fail to set focus on the third actor as it's not in the stage
255 DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
256 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
258 // Add the third actor to the stage
259 Stage::GetCurrent().Add(third);
261 // Check that it will fail to set focus on the third actor as it's not focusable
262 DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
263 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
265 // Make the third actor focusable
266 third.SetKeyboardFocusable(true);
268 // Check that the focus is successfully moved to the third actor
269 DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
270 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
274 int UtcDaliKeyboardFocusManagerMoveFocus(void)
276 ToolkitTestApplication application;
278 tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocus");
282 type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
283 DALI_TEST_CHECK( type );
284 BaseHandle handle = type.CreateInstance();
285 DALI_TEST_CHECK( handle );
287 KeyboardFocusManager manager = KeyboardFocusManager::Get();
288 DALI_TEST_CHECK(manager);
290 bool preFocusChangeSignalVerified = false;
291 PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified);
292 manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
294 bool focusChangedSignalVerified = false;
295 FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
296 manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
298 // Create the first actor and add it to the stage
299 Actor first = Actor::New();
300 first.SetKeyboardFocusable(true);
301 Stage::GetCurrent().Add(first);
303 // Create the second actor and add it to the stage
304 Actor second = Actor::New();
305 second.SetKeyboardFocusable(true);
306 Stage::GetCurrent().Add(second);
308 // Move the focus to the right
309 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
311 // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
312 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
313 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
314 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
315 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
316 preFocusChangeCallback.Reset();
318 // Check that the focus is set on the first actor
319 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
320 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
321 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
322 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
323 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
324 focusChangedCallback.Reset();
326 // Move the focus towards right
327 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
329 // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal
330 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
331 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
332 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
333 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
334 preFocusChangeCallback.Reset();
336 // Check that the focus is set on the second actor
337 DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
338 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
339 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
340 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
341 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
342 focusChangedCallback.Reset();
344 // Move the focus towards up
345 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::UP) == false);
347 // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
348 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
349 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second);
350 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
351 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::UP);
352 preFocusChangeCallback.Reset();
353 DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
355 // Create a 2x2 table view and try to move focus inside it
356 TableView tableView = TableView::New( 2, 2 );
357 Stage::GetCurrent().Add(tableView);
359 // Create the third actor
360 Actor third = Actor::New();
361 third.SetKeyboardFocusable(true);
363 // Create the fourth actor
364 Actor fourth = Actor::New();
365 fourth.SetKeyboardFocusable(true);
367 // Add the four children to table view
368 tableView.AddChild(first, TableView::CellPosition(0, 0));
369 tableView.AddChild(second, TableView::CellPosition(0, 1));
370 tableView.AddChild(third, TableView::CellPosition(1, 0));
371 tableView.AddChild(fourth, TableView::CellPosition(1, 1));
373 // Set the focus to the first actor
374 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
375 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
376 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
377 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
378 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
379 focusChangedCallback.Reset();
381 // Move the focus towards right
382 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == true);
383 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
384 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
385 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
386 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
387 focusChangedCallback.Reset();
389 // Move the focus towards down
390 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::DOWN) == true);
391 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
392 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
393 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
394 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
395 focusChangedCallback.Reset();
397 // Move the focus towards left
398 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
399 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
400 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
401 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth);
402 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third);
403 focusChangedCallback.Reset();
405 // Move the focus towards up
406 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::UP) == true);
407 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
408 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
409 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third);
410 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
411 focusChangedCallback.Reset();
413 // Move the focus towards left. The focus move will fail as no way to move it upwards
414 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == false);
415 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
416 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
417 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
418 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
419 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::LEFT);
420 preFocusChangeCallback.Reset();
421 DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
424 manager.SetFocusGroupLoop(true);
425 DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
427 // Move the focus towards left again. The focus should move to the fourth actor.
428 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
429 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
430 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
431 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
432 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
433 focusChangedCallback.Reset();
437 int UtcDaliKeyboardFocusManagerClearFocus(void)
439 ToolkitTestApplication application;
441 tet_infoline(" UtcDaliKeyboardFocusManagerClearFocus");
443 KeyboardFocusManager manager = KeyboardFocusManager::Get();
444 DALI_TEST_CHECK(manager);
446 // Create the first actor and add it to the stage
447 Actor first = Actor::New();
448 first.SetKeyboardFocusable(true);
449 Stage::GetCurrent().Add(first);
451 // Create the second actor and add it to the stage
452 Actor second = Actor::New();
453 second.SetKeyboardFocusable(true);
454 Stage::GetCurrent().Add(second);
456 // Check that the focus is set on the first actor
457 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
458 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
460 // Check that the focus is set on the second actor
461 DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
462 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
465 manager.ClearFocus();
467 // Check that no actor is being focused now.
468 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
472 int UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop(void)
474 ToolkitTestApplication application;
476 tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop");
478 KeyboardFocusManager manager = KeyboardFocusManager::Get();
479 DALI_TEST_CHECK(manager);
481 // Check that the focus movement is not looped within the same focus group by default
482 DALI_TEST_CHECK(manager.GetFocusGroupLoop() == false);
485 manager.SetFocusGroupLoop(true);
486 DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
490 int UtcDaliKeyboardFocusManagerSetAsFocusGroup(void)
492 ToolkitTestApplication application;
494 tet_infoline(" UtcDaliKeyboardFocusManagerSetAsFocusGroup");
496 KeyboardFocusManager manager = KeyboardFocusManager::Get();
497 DALI_TEST_CHECK(manager);
499 // Create an actor and check that it is not a focus group by default
500 Actor actor = Actor::New();
501 DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false);
503 // Set the actor as focus group
504 manager.SetAsFocusGroup(actor, true);
506 // flush the queue and render once
507 application.SendNotification();
508 application.Render();
510 DALI_TEST_CHECK(manager.IsFocusGroup(actor) == true);
512 // Set the actor not as focus group
513 manager.SetAsFocusGroup(actor, false);
515 // flush the queue and render once
516 application.SendNotification();
517 application.Render();
519 DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false);
523 int UtcDaliKeyboardFocusManagerGetFocusGroup(void)
525 ToolkitTestApplication application;
527 tet_infoline(" UtcDaliKeyboardFocusManagerGetFocusGroup");
529 KeyboardFocusManager manager = KeyboardFocusManager::Get();
530 DALI_TEST_CHECK(manager);
532 // Create an actor with two child actors and add it to the stage
533 Actor parent = Actor::New();
534 Actor child = Actor::New();
536 Stage::GetCurrent().Add(parent);
538 // Create three actors and add them as the children of the first child actor
539 Actor grandChild = Actor::New();
540 child.Add(grandChild);
542 // Set the parent and the first child actor as focus groups
543 manager.SetAsFocusGroup(parent, true);
545 // flush the queue and render once
546 application.SendNotification();
547 application.Render();
549 DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
551 // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
552 DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == parent);
554 manager.SetAsFocusGroup(child, true);
556 // flush the queue and render once
557 application.SendNotification();
558 application.Render();
560 DALI_TEST_CHECK(manager.IsFocusGroup(child) == true);
562 // The focus group should be the child, As it is the immediate parent which is also a focus group.
563 DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == child);
565 manager.SetAsFocusGroup(grandChild, true);
567 // flush the queue and render once
568 application.SendNotification();
569 application.Render();
571 DALI_TEST_CHECK(manager.IsFocusGroup(grandChild) == true);
573 // The current focus group should be itself, As it is also a focus group.
574 DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == grandChild);
578 int UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator(void)
580 ToolkitTestApplication application;
582 tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator");
584 KeyboardFocusManager manager = KeyboardFocusManager::Get();
585 DALI_TEST_CHECK(manager);
587 Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
588 DALI_TEST_CHECK(defaultFocusIndicatorActor);
590 Actor newFocusIndicatorActor = Actor::New();
591 manager.SetFocusIndicatorActor(newFocusIndicatorActor);
592 DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
597 int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void)
599 ToolkitTestApplication application;
601 tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusedActorActivated");
603 KeyboardFocusManager manager = KeyboardFocusManager::Get();
604 DALI_TEST_CHECK(manager);
606 bool focusedActorActivatedSignalVerified = false;
607 FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified);
608 manager.FocusedActorEnterKeySignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
610 Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
612 // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
613 // It makes mIsFocusIndicatorEnabled true
614 application.ProcessEvent(returnEvent);
616 // Create the first button and add it to the stage
617 PushButton firstPushButton = PushButton::New();
618 firstPushButton.SetKeyboardFocusable(true);
619 Stage::GetCurrent().Add(firstPushButton);
621 // Create the second button and add it to the stage
622 PushButton secondPushButton = PushButton::New();
623 secondPushButton.SetKeyboardFocusable(true);
624 Stage::GetCurrent().Add(secondPushButton);
626 // Check that the focus is set on the first button
627 DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstPushButton) == true);
628 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstPushButton);
630 // Send the return event to activate the first button
631 application.ProcessEvent(returnEvent);
632 DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified);
633 DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == firstPushButton);
634 focusedActorActivatedCallback.Reset();
636 // Check that the focus is set on the second button
637 DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondPushButton) == true);
638 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondPushButton);
640 // Send the return event again to activate the second button
641 application.ProcessEvent(returnEvent);
642 DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified);
643 DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == secondPushButton);
644 focusedActorActivatedCallback.Reset();
648 int UtcDaliKeyboardFocusManagerSignalFocusGroupChanged(void)
650 ToolkitTestApplication application;
652 tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusGroupChanged");
656 type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
657 DALI_TEST_CHECK( type );
658 BaseHandle handle = type.CreateInstance();
659 DALI_TEST_CHECK( handle );
661 KeyboardFocusManager manager = KeyboardFocusManager::Get();
662 DALI_TEST_CHECK(manager);
664 bool focusGroupChangedSignalVerified = false;
665 FocusGroupChangedCallback focusGroupChangedCallback(focusGroupChangedSignalVerified);
666 manager.FocusGroupChangedSignal().Connect( &focusGroupChangedCallback, &FocusGroupChangedCallback::Callback );
668 Integration::KeyEvent tabEvent("Tab", "", 0, 0, 0, Integration::KeyEvent::Down);
669 Integration::KeyEvent shiftTabEvent("Tab", "", 0, 1, 0, Integration::KeyEvent::Down);
671 // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
672 // It makes mIsFocusIndicatorEnabled true
673 application.ProcessEvent(tabEvent);
675 // Send the tab event to change focus group in the forward direction
676 application.ProcessEvent(tabEvent);
677 DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
678 DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor());
679 DALI_TEST_CHECK(focusGroupChangedCallback.mForward == true);
680 focusGroupChangedCallback.Reset();
682 // Send the shift tab event to change focus group in the backward direction
683 application.ProcessEvent(shiftTabEvent);
684 DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
685 DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor());
686 DALI_TEST_CHECK(focusGroupChangedCallback.mForward == false);
687 focusGroupChangedCallback.Reset();
691 int UtcDaliKeyboardFocusManagerSignals(void)
693 ToolkitTestApplication application;
695 KeyboardFocusManager manager = KeyboardFocusManager::Get();
696 DALI_TEST_CHECK( manager );
698 ConnectionTracker* testTracker = new ConnectionTracker();
699 DALI_TEST_EQUALS( true, manager.ConnectSignal( testTracker, "keyboardPreFocusChange", CallbackFunctor() ), TEST_LOCATION );
700 DALI_TEST_EQUALS( true, manager.ConnectSignal( testTracker, "keyboardFocusChanged", CallbackFunctor() ), TEST_LOCATION );
701 DALI_TEST_EQUALS( true, manager.ConnectSignal( testTracker, "keyboardFocusGroupChanged", CallbackFunctor() ), TEST_LOCATION );
702 DALI_TEST_EQUALS( true, manager.ConnectSignal( testTracker, "keyboardFocusedActorEnterKey", CallbackFunctor() ), TEST_LOCATION );
707 int UtcDaliKeyboardFocusManagerMoveFocusBackward(void)
709 ToolkitTestApplication application;
711 tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocusBackward");
713 KeyboardFocusManager manager = KeyboardFocusManager::Get();
714 DALI_TEST_CHECK(manager);
716 // Make history stack full
717 for(int i = 0 ; i < 31 ; i ++)
719 Actor actor = Actor::New();
720 actor.SetKeyboardFocusable(true);
721 Stage::GetCurrent().Add(actor);
722 manager.SetCurrentFocusActor(actor);
725 // Create the first actor and add it to the stage
726 Actor first = Actor::New();
727 first.SetKeyboardFocusable(true);
728 Stage::GetCurrent().Add(first);
730 // Create the second actor and add it to the stage
731 Actor second = Actor::New();
732 second.SetKeyboardFocusable(true);
733 Stage::GetCurrent().Add(second);
735 // Create the second actor and add it to the stage
736 Actor third = Actor::New();
737 third.SetKeyboardFocusable(true);
738 Stage::GetCurrent().Add(third);
740 // Check that the focus is set on the second actor
741 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
742 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
744 // Check that the focus is set on the second actor
745 DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
746 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
748 // Check that the focus is set on the third actor
749 DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
750 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
752 // Move the focus backward
753 manager.MoveFocusBackward();
755 // Check that it current focused actor is second actor
756 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
758 // Check that the focus is set on the third actor
759 DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
760 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
762 // Remove the second actor on stage
765 // Move the focus backward
766 manager.MoveFocusBackward();
768 // Check that it current focused actor is first actor
769 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
774 int UtcDaliKeyboardFocusManagerChangeFocusDirectionByKeyEvents(void)
776 ToolkitTestApplication application;
778 tet_infoline(" UtcDaliKeyboardFocusManagerChangeFocusDirectionByKeyEvents");
780 KeyboardFocusManager manager = KeyboardFocusManager::Get();
781 DALI_TEST_CHECK(manager);
783 bool preFocusChangeSignalVerified = false;
784 PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified);
785 manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
787 bool focusChangedSignalVerified = false;
788 FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
789 manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
791 Integration::KeyEvent leftEvent("Left", "", 0, 0, 0, Integration::KeyEvent::Down);
792 Integration::KeyEvent rightEvent("Right", "", 0, 0, 0, Integration::KeyEvent::Down);
793 Integration::KeyEvent upEvent("Up", "", 0, 0, 0, Integration::KeyEvent::Down);
794 Integration::KeyEvent downEvent("Down", "", 0, 0, 0, Integration::KeyEvent::Down);
795 Integration::KeyEvent pageUpEvent("Prior", "", 0, 0, 0, Integration::KeyEvent::Down);
796 Integration::KeyEvent pageDownEvent("Next", "", 0, 0, 0, Integration::KeyEvent::Down);
798 // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
799 // It makes mIsFocusIndicatorEnabled true
800 application.ProcessEvent(leftEvent);
802 // Create a 2x2 table view and try to move focus inside it
803 TableView tableView = TableView::New( 2, 2 );
804 Stage::GetCurrent().Add(tableView);
806 // Create the first actor
807 Actor first = Actor::New();
808 first.SetKeyboardFocusable(true);
810 // Create the second actor
811 Actor second = Actor::New();
812 second.SetKeyboardFocusable(true);
814 // Create the third actor
815 Actor third = Actor::New();
816 third.SetKeyboardFocusable(true);
818 // Create the fourth actor
819 Actor fourth = Actor::New();
820 fourth.SetKeyboardFocusable(true);
822 // Add the four children to table view
823 tableView.AddChild(first, TableView::CellPosition(0, 0));
824 tableView.AddChild(second, TableView::CellPosition(0, 1));
825 tableView.AddChild(third, TableView::CellPosition(1, 0));
826 tableView.AddChild(fourth, TableView::CellPosition(1, 1));
828 // Set the focus to the first actor
829 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
830 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
831 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
832 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
833 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
834 focusChangedCallback.Reset();
836 // Send the right key event to move the focus towards right
837 application.ProcessEvent(rightEvent);
838 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
839 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
840 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
841 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
842 focusChangedCallback.Reset();
844 // Send the down key event to move the focus towards down
845 application.ProcessEvent(downEvent);
846 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
847 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
848 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
849 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
850 focusChangedCallback.Reset();
852 // Send the down event to move the focus towards left
853 application.ProcessEvent(leftEvent);
854 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
855 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
856 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth);
857 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third);
858 focusChangedCallback.Reset();
860 // Send the up event to move the focus towards up
861 application.ProcessEvent(upEvent);
862 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
863 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
864 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third);
865 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
866 focusChangedCallback.Reset();
868 // Send the pape up event, but focus should not be moved because page up is not supported by table view
869 application.ProcessEvent(pageUpEvent);
870 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
871 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
872 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
873 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == first);
874 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::PAGE_UP);
875 preFocusChangeCallback.Reset();
877 // Send the pape down event, but focus should not be moved because page down is not supported by table view
878 application.ProcessEvent(pageDownEvent);
879 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
880 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
881 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
882 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == first);
883 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::PAGE_DOWN);
884 preFocusChangeCallback.Reset();
887 manager.ClearFocus();
889 // Send the pape up event, but nothing was focued so focus manager will try the initial focus
890 preFocusChangeCallback.Reset();
891 application.ProcessEvent(pageUpEvent);
892 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
893 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
894 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
895 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
896 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
898 // Clear the focus again
899 manager.ClearFocus();
901 // Send the pape down event, but nothing was focued so focus manager will try the initial focus
902 preFocusChangeCallback.Reset();
903 application.ProcessEvent(pageDownEvent);
904 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
905 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
906 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
907 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
908 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
917 int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
919 ToolkitTestApplication application;
921 tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocusTestStateChange");
925 type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
926 DALI_TEST_CHECK( type );
927 BaseHandle handle = type.CreateInstance();
928 DALI_TEST_CHECK( handle );
930 KeyboardFocusManager manager = KeyboardFocusManager::Get();
931 DALI_TEST_CHECK(manager);
933 bool preFocusChangeSignalVerified = false;
934 PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified);
935 manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
937 bool focusChangedSignalVerified = false;
938 FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
939 manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
941 // Create the first actor and add it to the stage
942 Control first = Control::New();
943 first.SetKeyboardFocusable(true);
944 Stage::GetCurrent().Add(first);
946 // Create the second actor and add it to the stage
947 Control second = Control::New();
948 second.SetKeyboardFocusable(true);
949 Stage::GetCurrent().Add(second);
951 // Move the focus to the right
952 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
954 // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
955 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
956 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
957 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
958 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
959 preFocusChangeCallback.Reset();
961 // Check that the focus is set on the first actor
962 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
963 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
964 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
965 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
966 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
967 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
968 focusChangedCallback.Reset();
970 // Move the focus towards right
971 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
973 // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal
974 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
975 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
976 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
977 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
978 preFocusChangeCallback.Reset();
980 // Check that the focus is set on the second actor
981 DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
982 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
983 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
984 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
985 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
986 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
987 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
988 focusChangedCallback.Reset();
990 // Move the focus towards up
991 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::UP) == false);
993 // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
994 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
995 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second);
996 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
997 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::UP);
998 preFocusChangeCallback.Reset();
999 DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
1001 // Create a 2x2 table view and try to move focus inside it
1002 TableView tableView = TableView::New( 2, 2 );
1003 Stage::GetCurrent().Add(tableView);
1005 // Create the third actor
1006 Control third = Control::New();
1007 third.SetKeyboardFocusable(true);
1009 // Create the fourth actor
1010 Control fourth = Control::New();
1011 fourth.SetKeyboardFocusable(true);
1013 // Add the four children to table view
1014 tableView.AddChild(first, TableView::CellPosition(0, 0));
1015 tableView.AddChild(second, TableView::CellPosition(0, 1));
1016 tableView.AddChild(third, TableView::CellPosition(1, 0));
1017 tableView.AddChild(fourth, TableView::CellPosition(1, 1));
1019 // Set the focus to the first actor
1020 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
1021 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1022 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
1023 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
1024 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
1026 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
1027 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1029 focusChangedCallback.Reset();
1031 // Move the focus towards right
1032 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == true);
1033 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
1034 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
1035 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
1036 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
1037 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1038 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
1040 focusChangedCallback.Reset();
1042 // Move the focus towards down
1043 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::DOWN) == true);
1044 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
1045 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
1046 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
1047 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
1049 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1050 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1051 DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1052 DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
1054 focusChangedCallback.Reset();
1056 // Move the focus towards left
1057 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
1058 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
1059 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
1060 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth);
1061 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third);
1063 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1064 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1065 DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
1066 DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1068 focusChangedCallback.Reset();
1070 // Move the focus towards up
1071 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::UP) == true);
1072 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1073 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
1074 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third);
1075 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
1076 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
1077 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1078 DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1079 DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1080 focusChangedCallback.Reset();
1082 // Move the focus towards left. The focus move will fail as no way to move it upwards
1083 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == false);
1084 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1085 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
1086 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
1087 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
1088 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::LEFT);
1089 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
1090 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1091 DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1092 DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1094 preFocusChangeCallback.Reset();
1095 DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
1098 manager.SetFocusGroupLoop(true);
1099 DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
1101 // Move the focus towards left again. The focus should move to the fourth actor.
1102 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
1103 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
1104 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
1105 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
1106 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
1108 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1109 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1110 DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1111 DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
1113 focusChangedCallback.Reset();
1116 manager.ClearFocus();
1117 DALI_TEST_EQUALS(first.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1118 DALI_TEST_EQUALS(second.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1119 DALI_TEST_EQUALS(third.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );
1120 DALI_TEST_EQUALS(fourth.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::NORMAL, TEST_LOCATION );