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>
25 #include <dali-toolkit/dali-toolkit.h>
26 #include <dali/integration-api/events/key-event-integ.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;
181 int UtcDaliKeyboardFocusManagerGet(void)
183 ToolkitTestApplication application;
185 tet_infoline(" UtcDaliKeyboardKeyboardFocusManagerGet");
189 type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
190 DALI_TEST_CHECK( type );
191 BaseHandle handle = type.CreateInstance();
192 DALI_TEST_CHECK( handle );
194 KeyboardFocusManager manager;
196 manager = KeyboardFocusManager::Get();
197 DALI_TEST_CHECK(manager);
199 KeyboardFocusManager newManager = KeyboardFocusManager::Get();
200 DALI_TEST_CHECK(newManager);
202 // Check that focus manager is a singleton
203 DALI_TEST_CHECK(manager == newManager);
207 int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor(void)
209 ToolkitTestApplication application;
211 tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor");
213 KeyboardFocusManager manager = KeyboardFocusManager::Get();
214 DALI_TEST_CHECK(manager);
216 // Create the first actor and add it to the stage
217 Actor first = Actor::New();
218 first.SetKeyboardFocusable(true);
219 Stage::GetCurrent().Add(first);
221 // Create the second actor and add it to the stage
222 Actor second = Actor::New();
223 second.SetKeyboardFocusable(true);
224 Stage::GetCurrent().Add(second);
226 // Create the third actor but don't add it to the stage
227 Actor third = Actor::New();
229 // Check that no actor is being focused yet.
230 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
232 // Check that it will fail to set focus on an invalid actor
233 DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
235 // Check that the focus is set on the first actor
236 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
237 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
239 // Check that the focus is set on the second actor
240 DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
241 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
243 // Check that it will fail to set focus on the third actor as it's not in the stage
244 DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
245 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
247 // Add the third actor to the stage
248 Stage::GetCurrent().Add(third);
250 // Check that it will fail to set focus on the third actor as it's not focusable
251 DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
252 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
254 // Make the third actor focusable
255 third.SetKeyboardFocusable(true);
257 // Check that the focus is successfully moved to the third actor
258 DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
259 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
263 int UtcDaliKeyboardFocusManagerMoveFocus(void)
265 ToolkitTestApplication application;
267 tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocus");
271 type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
272 DALI_TEST_CHECK( type );
273 BaseHandle handle = type.CreateInstance();
274 DALI_TEST_CHECK( handle );
276 KeyboardFocusManager manager = KeyboardFocusManager::Get();
277 DALI_TEST_CHECK(manager);
279 bool preFocusChangeSignalVerified = false;
280 PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified);
281 manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
283 bool focusChangedSignalVerified = false;
284 FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
285 manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
287 // Create the first actor and add it to the stage
288 Actor first = Actor::New();
289 first.SetKeyboardFocusable(true);
290 Stage::GetCurrent().Add(first);
292 // Create the second actor and add it to the stage
293 Actor second = Actor::New();
294 second.SetKeyboardFocusable(true);
295 Stage::GetCurrent().Add(second);
297 // Move the focus to the right
298 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
300 // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
301 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
302 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
303 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
304 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
305 preFocusChangeCallback.Reset();
307 // Check that the focus is set on the first actor
308 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
309 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
310 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
311 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
312 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
313 focusChangedCallback.Reset();
315 // Move the focus towards right
316 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
318 // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal
319 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
320 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
321 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
322 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
323 preFocusChangeCallback.Reset();
325 // Check that the focus is set on the second actor
326 DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
327 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
328 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
329 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
330 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
331 focusChangedCallback.Reset();
333 // Move the focus towards up
334 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::UP) == false);
336 // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
337 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
338 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second);
339 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
340 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::UP);
341 preFocusChangeCallback.Reset();
342 DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
344 // Create a 2x2 table view and try to move focus inside it
345 TableView tableView = TableView::New( 2, 2 );
346 Stage::GetCurrent().Add(tableView);
348 // Create the third actor
349 Actor third = Actor::New();
350 third.SetKeyboardFocusable(true);
352 // Create the fourth actor
353 Actor fourth = Actor::New();
354 fourth.SetKeyboardFocusable(true);
356 // Add the four children to table view
357 tableView.AddChild(first, TableView::CellPosition(0, 0));
358 tableView.AddChild(second, TableView::CellPosition(0, 1));
359 tableView.AddChild(third, TableView::CellPosition(1, 0));
360 tableView.AddChild(fourth, TableView::CellPosition(1, 1));
362 // Set the focus to the first actor
363 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
364 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
365 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
366 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
367 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
368 focusChangedCallback.Reset();
370 // Move the focus towards right
371 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == true);
372 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
373 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
374 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
375 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
376 focusChangedCallback.Reset();
378 // Move the focus towards down
379 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::DOWN) == true);
380 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
381 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
382 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
383 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
384 focusChangedCallback.Reset();
386 // Move the focus towards left
387 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
388 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
389 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
390 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth);
391 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third);
392 focusChangedCallback.Reset();
394 // Move the focus towards up
395 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::UP) == true);
396 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
397 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
398 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third);
399 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
400 focusChangedCallback.Reset();
402 // Move the focus towards left. The focus move will fail as no way to move it upwards
403 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == false);
404 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
405 DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
406 DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
407 DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
408 DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::LEFT);
409 preFocusChangeCallback.Reset();
410 DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
413 manager.SetFocusGroupLoop(true);
414 DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
416 // Move the focus towards left again. The focus should move to the fourth actor.
417 DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
418 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
419 DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
420 DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
421 DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
422 focusChangedCallback.Reset();
426 int UtcDaliKeyboardFocusManagerClearFocus(void)
428 ToolkitTestApplication application;
430 tet_infoline(" UtcDaliKeyboardFocusManagerClearFocus");
432 KeyboardFocusManager manager = KeyboardFocusManager::Get();
433 DALI_TEST_CHECK(manager);
435 // Create the first actor and add it to the stage
436 Actor first = Actor::New();
437 first.SetKeyboardFocusable(true);
438 Stage::GetCurrent().Add(first);
440 // Create the second actor and add it to the stage
441 Actor second = Actor::New();
442 second.SetKeyboardFocusable(true);
443 Stage::GetCurrent().Add(second);
445 // Check that the focus is set on the first actor
446 DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
447 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
449 // Check that the focus is set on the second actor
450 DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
451 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
454 manager.ClearFocus();
456 // Check that no actor is being focused now.
457 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
461 int UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop(void)
463 ToolkitTestApplication application;
465 tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop");
467 KeyboardFocusManager manager = KeyboardFocusManager::Get();
468 DALI_TEST_CHECK(manager);
470 // Check that the focus movement is not looped within the same focus group by default
471 DALI_TEST_CHECK(manager.GetFocusGroupLoop() == false);
474 manager.SetFocusGroupLoop(true);
475 DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
479 int UtcDaliKeyboardFocusManagerSetAsFocusGroup(void)
481 ToolkitTestApplication application;
483 tet_infoline(" UtcDaliKeyboardFocusManagerSetAsFocusGroup");
485 KeyboardFocusManager manager = KeyboardFocusManager::Get();
486 DALI_TEST_CHECK(manager);
488 // Create an actor and check that it is not a focus group by default
489 Actor actor = Actor::New();
490 DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false);
492 // Set the actor as focus group
493 manager.SetAsFocusGroup(actor, true);
495 // flush the queue and render once
496 application.SendNotification();
497 application.Render();
499 DALI_TEST_CHECK(manager.IsFocusGroup(actor) == true);
501 // Set the actor not as focus group
502 manager.SetAsFocusGroup(actor, false);
504 // flush the queue and render once
505 application.SendNotification();
506 application.Render();
508 DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false);
512 int UtcDaliKeyboardFocusManagerGetFocusGroup(void)
514 ToolkitTestApplication application;
516 tet_infoline(" UtcDaliKeyboardFocusManagerGetFocusGroup");
518 KeyboardFocusManager manager = KeyboardFocusManager::Get();
519 DALI_TEST_CHECK(manager);
521 // Create an actor with two child actors and add it to the stage
522 Actor parent = Actor::New();
523 Actor child = Actor::New();
525 Stage::GetCurrent().Add(parent);
527 // Create three actors and add them as the children of the first child actor
528 Actor grandChild = Actor::New();
529 child.Add(grandChild);
531 // Set the parent and the first child actor as focus groups
532 manager.SetAsFocusGroup(parent, true);
534 // flush the queue and render once
535 application.SendNotification();
536 application.Render();
538 DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
540 // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
541 DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == parent);
543 manager.SetAsFocusGroup(child, true);
545 // flush the queue and render once
546 application.SendNotification();
547 application.Render();
549 DALI_TEST_CHECK(manager.IsFocusGroup(child) == true);
551 // The focus group should be the child, As it is the immediate parent which is also a focus group.
552 DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == child);
554 manager.SetAsFocusGroup(grandChild, true);
556 // flush the queue and render once
557 application.SendNotification();
558 application.Render();
560 DALI_TEST_CHECK(manager.IsFocusGroup(grandChild) == true);
562 // The current focus group should be itself, As it is also a focus group.
563 DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == grandChild);
567 int UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator(void)
569 ToolkitTestApplication application;
571 tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator");
573 KeyboardFocusManager manager = KeyboardFocusManager::Get();
574 DALI_TEST_CHECK(manager);
576 Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
577 DALI_TEST_CHECK(defaultFocusIndicatorActor);
579 Actor newFocusIndicatorActor = Actor::New();
580 manager.SetFocusIndicatorActor(newFocusIndicatorActor);
581 DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
586 int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void)
588 ToolkitTestApplication application;
590 tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusedActorActivated");
592 KeyboardFocusManager manager = KeyboardFocusManager::Get();
593 DALI_TEST_CHECK(manager);
595 bool focusedActorActivatedSignalVerified = false;
596 FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified);
597 manager.FocusedActorEnterKeySignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
599 Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
601 // Create the first button and add it to the stage
602 PushButton firstPushButton = PushButton::New();
603 firstPushButton.SetKeyboardFocusable(true);
604 Stage::GetCurrent().Add(firstPushButton);
606 // Create the second button and add it to the stage
607 PushButton secondPushButton = PushButton::New();
608 secondPushButton.SetKeyboardFocusable(true);
609 Stage::GetCurrent().Add(secondPushButton);
611 // Check that the focus is set on the first button
612 DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstPushButton) == true);
613 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstPushButton);
615 // Send the return event to activate the first button
616 application.ProcessEvent(returnEvent);
617 DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified);
618 DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == firstPushButton);
619 focusedActorActivatedCallback.Reset();
621 // Check that the focus is set on the second button
622 DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondPushButton) == true);
623 DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondPushButton);
625 // Send the return event again to activate the second button
626 application.ProcessEvent(returnEvent);
627 DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified);
628 DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == secondPushButton);
629 focusedActorActivatedCallback.Reset();
633 int UtcDaliKeyboardFocusManagerSignalFocusGroupChanged(void)
635 ToolkitTestApplication application;
637 tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusGroupChanged");
641 type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
642 DALI_TEST_CHECK( type );
643 BaseHandle handle = type.CreateInstance();
644 DALI_TEST_CHECK( handle );
646 KeyboardFocusManager manager = KeyboardFocusManager::Get();
647 DALI_TEST_CHECK(manager);
649 bool focusGroupChangedSignalVerified = false;
650 FocusGroupChangedCallback focusGroupChangedCallback(focusGroupChangedSignalVerified);
651 manager.FocusGroupChangedSignal().Connect( &focusGroupChangedCallback, &FocusGroupChangedCallback::Callback );
653 Integration::KeyEvent tabEvent("Tab", "", 0, 0, 0, Integration::KeyEvent::Down);
654 Integration::KeyEvent shiftTabEvent("Tab", "", 0, 1, 0, Integration::KeyEvent::Down);
656 // Send the tab event to change focus group in the forward direction
657 application.ProcessEvent(tabEvent);
658 DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
659 DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor());
660 DALI_TEST_CHECK(focusGroupChangedCallback.mForward == true);
661 focusGroupChangedCallback.Reset();
663 // Send the shift tab event to change focus group in the backward direction
664 application.ProcessEvent(shiftTabEvent);
665 DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
666 DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor());
667 DALI_TEST_CHECK(focusGroupChangedCallback.mForward == false);
668 focusGroupChangedCallback.Reset();