License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-toolkit.git] / automated-tests / TET / dali-test-suite / focus-manager / utc-Dali-FocusManager.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <iostream>
19
20 #include <stdlib.h>
21 #include <tet_api.h>
22
23 #include <dali/dali.h>
24 #include <dali-toolkit/dali-toolkit.h>
25
26 #include <dali-toolkit-test-suite-utils.h>
27
28 using namespace Dali;
29 using namespace Toolkit;
30
31 namespace
32 {
33
34 static bool gObjectCreatedCallBackCalled;
35
36 static void TestCallback(BaseHandle handle)
37 {
38   gObjectCreatedCallBackCalled = true;
39 }
40
41 // Functors to test whether focus changed signal is emitted when the focus is changed
42 class FocusChangedCallback : public Dali::ConnectionTracker
43 {
44 public:
45   FocusChangedCallback(bool& signalReceived)
46   : mSignalVerified(signalReceived),
47     mOriginalFocusedActor(),
48     mCurrentFocusedActor()
49   {
50   }
51
52   void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
53   {
54     tet_infoline("Verifying FocusChangedCallback()");
55
56     if(originalFocusedActor == mCurrentFocusedActor)
57     {
58       mSignalVerified = true;
59     }
60
61     mOriginalFocusedActor = originalFocusedActor;
62     mCurrentFocusedActor = currentFocusedActor;
63   }
64
65   void Reset()
66   {
67     mSignalVerified = false;
68   }
69
70   bool& mSignalVerified;
71   Actor mOriginalFocusedActor;
72   Actor mCurrentFocusedActor;
73 };
74
75 // Functors to test whether focus overshot signal is emitted when there is no way to move focus further.
76 class FocusOvershotCallback : public Dali::ConnectionTracker
77 {
78 public:
79   FocusOvershotCallback(bool& signalReceived)
80   : mSignalVerified(signalReceived),
81     mCurrentFocusedActor(),
82     mFocusOvershotDirection(Toolkit::FocusManager::OVERSHOT_NEXT)
83   {
84   }
85
86   void Callback(Actor currentFocusedActor, Toolkit::FocusManager::FocusOvershotDirection direction)
87   {
88     tet_infoline("Verifying FocusOvershotCallback()");
89
90     if(currentFocusedActor == mCurrentFocusedActor && direction == mFocusOvershotDirection)
91     {
92       mSignalVerified = true;
93     }
94   }
95
96   void Reset()
97   {
98     mSignalVerified = false;
99   }
100
101   bool& mSignalVerified;
102   Actor mCurrentFocusedActor;
103   Toolkit::FocusManager::FocusOvershotDirection mFocusOvershotDirection;
104 };
105
106 } // namespace
107
108 static void Startup();
109 static void Cleanup();
110
111 extern "C" {
112   void (*tet_startup)() = Startup;
113   void (*tet_cleanup)() = Cleanup;
114 }
115
116 enum {
117   POSITIVE_TC_IDX = 0x01,
118   NEGATIVE_TC_IDX,
119 };
120
121 #define MAX_NUMBER_OF_TESTS 10000
122 extern "C" {
123   struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
124 }
125
126 // Add test functionality for all APIs in the class (Positive and Negative)
127 TEST_FUNCTION( UtcDaliFocusManagerGet,                              POSITIVE_TC_IDX );
128 TEST_FUNCTION( UtcDaliFocusManagerSetAndGetAccessibilityAttribute,  POSITIVE_TC_IDX );
129 TEST_FUNCTION( UtcDaliFocusManagerSetAndGetFocusOrder,              POSITIVE_TC_IDX );
130 TEST_FUNCTION( UtcDaliFocusManagerGenerateNewFocusOrder,            POSITIVE_TC_IDX );
131 TEST_FUNCTION( UtcDaliFocusManagerGetActorByFocusOrder,             POSITIVE_TC_IDX );
132 TEST_FUNCTION( UtcDaliFocusManagerSetAndGetCurrentFocusActor,       POSITIVE_TC_IDX );
133 TEST_FUNCTION( UtcDaliFocusManagerGetCurrentFocusGroup,             POSITIVE_TC_IDX );
134 TEST_FUNCTION( UtcDaliFocusManagerGetCurrentFocusOrder,             POSITIVE_TC_IDX );
135 TEST_FUNCTION( UtcDaliFocusManagerMoveFocusForward,                 POSITIVE_TC_IDX );
136 TEST_FUNCTION( UtcDaliFocusManagerMoveFocusBackward,                POSITIVE_TC_IDX );
137 TEST_FUNCTION( UtcDaliFocusManagerClearFocus,                       POSITIVE_TC_IDX );
138 TEST_FUNCTION( UtcDaliFocusManagerReset,                            POSITIVE_TC_IDX );
139 TEST_FUNCTION( UtcDaliFocusManagerFocusGroup,                       POSITIVE_TC_IDX );
140 TEST_FUNCTION( UtcDaliFocusManagerSetAndGetFocusIndicator,          POSITIVE_TC_IDX );
141 TEST_FUNCTION( UtcDaliFocusManagerSignalFocusChanged,               POSITIVE_TC_IDX );
142 TEST_FUNCTION( UtcDaliFocusManagerSignalFocusOvershot,              POSITIVE_TC_IDX );
143
144 // Called only once before first test is run.
145 static void Startup()
146 {
147 }
148
149 // Called only once after last test is run
150 static void Cleanup()
151 {
152 }
153
154 static void UtcDaliFocusManagerGet()
155 {
156   ToolkitTestApplication application;
157
158   tet_infoline(" UtcDaliFocusManagerGet");
159
160   FocusManager manager;
161
162   //Ensure object is created by checking if it's registered
163   ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
164   DALI_TEST_CHECK(registry);
165
166   gObjectCreatedCallBackCalled = false;
167   registry.ObjectCreatedSignal().Connect( &TestCallback );
168   {
169     manager = FocusManager::Get();
170     DALI_TEST_CHECK(manager);
171   }
172   DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
173
174   FocusManager newManager = FocusManager::Get();
175   DALI_TEST_CHECK(newManager);
176
177   // Check that focus manager is a singleton
178   DALI_TEST_CHECK(manager == newManager);
179 }
180
181 static void UtcDaliFocusManagerSetAndGetAccessibilityAttribute()
182 {
183   ToolkitTestApplication application;
184
185   tet_infoline(" UtcDaliFocusManagerSetAndGetAccessibilityAttribute");
186
187   FocusManager manager = FocusManager::Get();
188   DALI_TEST_CHECK(manager);
189
190   Actor actor = Actor::New();
191   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "");
192
193   manager.SetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL, "Description");
194   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "Description");
195
196   manager.SetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL, "New description");
197   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "New description");
198 }
199
200 static void UtcDaliFocusManagerSetAndGetFocusOrder()
201 {
202   ToolkitTestApplication application;
203
204   tet_infoline(" UtcDaliFocusManagerSetAndGetFocusOrder");
205
206   FocusManager manager = FocusManager::Get();
207   DALI_TEST_CHECK(manager);
208
209   Actor first = Actor::New();
210   Actor second = Actor::New();
211   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
212   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 0);
213
214   // Set the focus order and description for the first actor
215   manager.SetFocusOrder(first, 1);
216   manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
217   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
218   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
219
220   // Set the focus order and description for the second actor
221   manager.SetFocusOrder(second, 2);
222   manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
223   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
224   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
225
226   // check that the focus order of the first actor is changed
227   manager.SetFocusOrder(first, 2);
228   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 2);
229   // make sure the change of focus order doesn't affect the actor's description
230   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
231
232   // check that the focus order of the second actor is increased to 3
233   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 3);
234   // make sure the change of focus order doesn't affect the actor's description
235   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
236
237   // check that the focus order of the second actor is changed to 1
238   manager.SetFocusOrder(second, 1);
239   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 1);
240   // make sure the change of focus order doesn't affect the actor's description
241   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
242
243   // Set the focus order and description for the third actor
244   Actor third = Actor::New();
245   manager.SetFocusOrder(third, 1);
246   manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
247   DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1);
248   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
249
250   // check that the focus order of the second actor is increased to 2.
251   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
252   // make sure the change of focus order doesn't affect the actor's description
253   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
254
255   // check that the focus order of the first actor is increased to 3.
256   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 3);
257   // make sure the change of focus order doesn't affect the actor's description
258   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
259 }
260
261 static void UtcDaliFocusManagerGenerateNewFocusOrder()
262 {
263   ToolkitTestApplication application;
264
265   tet_infoline(" UtcDaliFocusManagerGenerateNewFocusOrder");
266
267   FocusManager manager = FocusManager::Get();
268   DALI_TEST_CHECK(manager);
269
270   DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
271   DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
272
273   Actor first = Actor::New();
274   Actor second = Actor::New();
275
276   // Set the focus order for the first actor
277   manager.SetFocusOrder(first, 1);
278   manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
279   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
280
281   //Test for new focus order
282   DALI_TEST_CHECK(2 == manager.GenerateNewFocusOrder());
283
284   // Set the focus order for the first actor
285   manager.SetFocusOrder(second, 2);
286   manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "first");
287   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
288 }
289
290 static void UtcDaliFocusManagerGetActorByFocusOrder()
291 {
292   ToolkitTestApplication application;
293
294   tet_infoline(" UtcDaliFocusManagerGetActorByFocusOrder");
295
296   FocusManager manager = FocusManager::Get();
297   DALI_TEST_CHECK(manager);
298
299   // Create the actors and set their focus orders
300   Actor first = Actor::New();
301   manager.SetFocusOrder(first, 1);
302
303   Actor second = Actor::New();
304   manager.SetFocusOrder(second, 2);
305
306   Actor third = Actor::New();
307   manager.SetFocusOrder(third, 3);
308
309   // Check that we get an empty handle as no actor is added to the stage yet.
310   DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == Actor());
311   DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == Actor());
312   DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == Actor());
313
314   // Add the actors to the stage
315   Stage::GetCurrent().Add(first);
316   Stage::GetCurrent().Add(second);
317   Stage::GetCurrent().Add(third);
318
319   // Check that we get an empty handle because focus order 0 means undefined.
320   DALI_TEST_CHECK(manager.GetActorByFocusOrder(0) == Actor());
321
322   // Check that we get correct actors for the specified focus orders
323   DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == first);
324   DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == second);
325   DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == third);
326
327   // Change the focus order of the third actor to 1
328   manager.SetFocusOrder(third, 1);
329
330   // Check that we still get correct actors after changing their focus orders
331   DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == third);
332   DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == first);
333   DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == second);
334
335   // Check that we get an empty handle because no actor has a focus order of 4
336   DALI_TEST_CHECK(manager.GetActorByFocusOrder(4) == Actor());
337 }
338
339 static void UtcDaliFocusManagerSetAndGetCurrentFocusActor()
340 {
341   ToolkitTestApplication application;
342
343   tet_infoline(" UtcDaliFocusManagerSetAndGetCurrentFocusActor");
344
345   FocusManager manager = FocusManager::Get();
346   DALI_TEST_CHECK(manager);
347
348   // Create the first actor and add it to the stage
349   Actor first = Actor::New();
350   manager.SetFocusOrder(first, 1);
351   Stage::GetCurrent().Add(first);
352
353   // Create the second actor and add it to the stage
354   Actor second = Actor::New();
355   manager.SetFocusOrder(second, 2);
356   Stage::GetCurrent().Add(second);
357
358   // Create the third actor but don't add it to the stage
359   Actor third = Actor::New();
360   manager.SetFocusOrder(third, 3);
361
362   // Check that no actor is being focused yet.
363   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
364
365   // Check that it will fail to set focus on an invalid actor
366   DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
367
368   // Check that the focus is set on the first actor
369   DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
370   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
371
372   // Check that the focus is set on the second actor
373   DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
374   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
375
376   // Check that it will fail to set focus on the third actor as it's not in the stage
377   DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
378
379   // Add the third actor to the stage
380   Stage::GetCurrent().Add(third);
381
382   // make the third actor invisible
383   third.SetVisible(false);
384   // flush the queue and render once
385   application.SendNotification();
386   application.Render();
387
388   // Check that it will fail to set focus on the third actor as it's invisible
389   DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
390
391   // Make the third actor visible
392   third.SetVisible(true);
393   // flush the queue and render once
394   application.SendNotification();
395   application.Render();
396
397   // Make the third actor not focusable
398   Property::Index propertyActorFocusable = third.GetPropertyIndex("focusable");
399   third.SetProperty(propertyActorFocusable, false);
400   // flush the queue and render once
401   application.SendNotification();
402   application.Render();
403
404   // Check that it will fail to set focus on the third actor as it's not focusable
405   DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
406
407   // Make the third actor focusable
408   third.SetProperty(propertyActorFocusable, true);
409   // flush the queue and render once
410   application.SendNotification();
411   application.Render();
412
413   // Check that the focus is successfully moved to the third actor
414   DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
415
416   // Make the current focused actor to be not focusable by setting its focus order to be 0
417   manager.SetFocusOrder(third, 0);
418
419   // Check that the focus is automatically cleared
420   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
421
422   // Set the focus order of the third actor again
423   manager.SetFocusOrder(third, 3);
424
425   // Check that the third actor can be focused successfully now
426   DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
427 }
428
429 static void UtcDaliFocusManagerGetCurrentFocusGroup()
430 {
431   ToolkitTestApplication application;
432
433   tet_infoline(" UtcDaliFocusManagerGetCurrentFocusGroup");
434
435   FocusManager manager = FocusManager::Get();
436   DALI_TEST_CHECK(manager);
437
438   // Create an actor with two child actors and add it to the stage
439   Actor parent = Actor::New();
440   Actor firstChild = Actor::New();
441   Actor secondChild = Actor::New();
442   parent.Add(firstChild);
443   parent.Add(secondChild);
444   Stage::GetCurrent().Add(parent);
445
446   // Create three actors and add them as the children of the first child actor
447   Actor firstGrandChild = Actor::New();
448   Actor secondGrandChild = Actor::New();
449   Actor thirdGrandChild = Actor::New();
450   firstChild.Add(firstGrandChild);
451   firstChild.Add(secondGrandChild);
452   firstChild.Add(thirdGrandChild);
453
454   // Set focus order to the actors
455   manager.SetFocusOrder(parent, 1);
456   manager.SetFocusOrder(firstChild, 2);
457   manager.SetFocusOrder(firstGrandChild, 3);
458   manager.SetFocusOrder(secondGrandChild, 4);
459   manager.SetFocusOrder(thirdGrandChild, 5);
460   manager.SetFocusOrder(secondChild, 6);
461
462   // Set the parent and the first child actor as focus groups
463   manager.SetFocusGroup(parent, true);
464   DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
465
466   // Set focus to the first grand child actor
467   DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstGrandChild) == true);
468   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
469
470   // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
471   DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == parent);
472
473   manager.SetFocusGroup(firstChild, true);
474   DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
475
476   // The current focus group should be the firstChild, As it is the immediate parent which is also a focus group.
477   DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
478
479   manager.SetFocusGroup(firstGrandChild, true);
480   DALI_TEST_CHECK(manager.IsFocusGroup(firstGrandChild) == true);
481
482   // The current focus group should be itself, As it is also a focus group.
483   DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstGrandChild);
484
485   // Set focus to the second grand child actor
486   DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondGrandChild) == true);
487   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
488
489   // The current focus group should be the firstChild, As it is the immediate parent which is also a
490   // focus group for the current focus actor.
491   DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
492
493 }
494
495 static void UtcDaliFocusManagerGetCurrentFocusOrder()
496 {
497   ToolkitTestApplication application;
498
499   tet_infoline(" UtcDaliFocusManagerGetCurrentFocusOrder");
500
501   FocusManager manager = FocusManager::Get();
502   DALI_TEST_CHECK(manager);
503
504   Actor first = Actor::New();
505   Stage::GetCurrent().Add(first);
506
507   Actor second = Actor::New();
508   Stage::GetCurrent().Add(second);
509
510   Actor third = Actor::New();
511   Stage::GetCurrent().Add(third);
512
513   // Set the focus order and description for the first actor
514   manager.SetFocusOrder(first, 1);
515   manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
516   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
517   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
518
519   // Set the focus order and description for the second actor
520   manager.SetFocusOrder(second, 2);
521   manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
522   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
523   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
524
525   // Set the focus order and description for the second actor
526   manager.SetFocusOrder(third, 3);
527   manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
528   DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
529   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
530
531   // Check that no actor is being focused yet.
532   DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
533
534   // Set the focus on the first actor and test
535   DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
536   DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 1);
537
538   // Move the focus forward to the second actor and test
539   manager.MoveFocusForward();
540   DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 2);
541
542   // Move the focus forward to the third actor and test
543   manager.MoveFocusForward();
544   DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 3);
545
546   // Clear focus and test
547   manager.ClearFocus();
548   DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
549 }
550
551 static void UtcDaliFocusManagerMoveFocusForward()
552 {
553   ToolkitTestApplication application;
554
555   tet_infoline(" UtcDaliFocusManagerMoveFocusForward");
556
557   FocusManager manager = FocusManager::Get();
558   DALI_TEST_CHECK(manager);
559
560   Actor first = Actor::New();
561   Stage::GetCurrent().Add(first);
562
563   Actor second = Actor::New();
564   Stage::GetCurrent().Add(second);
565
566   Actor third = Actor::New();
567   Stage::GetCurrent().Add(third);
568
569   // Set the focus order and description for the first actor
570   manager.SetFocusOrder(first, 1);
571   manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
572   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
573   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
574
575   // Set the focus order and description for the second actor
576   manager.SetFocusOrder(second, 2);
577   manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
578   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
579   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
580
581   // Set the focus order and description for the second actor
582   manager.SetFocusOrder(third, 3);
583   manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
584   DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
585   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
586
587   // Check that no actor is being focused yet.
588   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
589
590   // Set the focus on the first actor
591   DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
592   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
593   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
594
595   // Test the non-wrapped move first
596   manager.SetWrapMode(false);
597   DALI_TEST_CHECK(manager.GetWrapMode() == false);
598
599   // Move the focus forward to the second actor
600   manager.MoveFocusForward();
601   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
602   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "second");
603
604   // Move the focus forward to the third actor
605   manager.MoveFocusForward();
606   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
607   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
608
609   // Check that it will fail to move the focus forward again as the third actor is the last
610   // focusable actor in the focus chain
611   manager.MoveFocusForward();
612   // The focus should still be set on the third actor
613   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
614   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
615
616   // Now test the wrapped move
617   manager.SetWrapMode(true);
618   DALI_TEST_CHECK(manager.GetWrapMode() == true);
619
620   // Move the focus forward recursively and this time the first actor should be focused
621   manager.MoveFocusForward();
622   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
623   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
624
625   // Make the second actor not focusable
626   Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
627   second.SetProperty(propertyActorFocusable, false);
628   // flush the queue and render once
629   application.SendNotification();
630   application.Render();
631
632   // Move the focus forward and check that the second actor should be skipped and
633   // the third actor should be focused now.
634   manager.MoveFocusForward();
635   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
636   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
637
638   // Make the first actor invisible
639   first.SetVisible(false);
640   // flush the queue and render once
641   application.SendNotification();
642   application.Render();
643
644   // Move the focus forward and check that the first actor should be skipped as it's
645   // invisible and the second actor should also be skipped as it's not focusable,
646   // so the focus will still be on the third actor
647   manager.MoveFocusForward();
648   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
649   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
650
651   // Make the third actor invisible so that no actor can be focused.
652   third.SetVisible(false);
653   // flush the queue and render once
654   application.SendNotification();
655   application.Render();
656
657   // Check that the focus move is failed as all the three actors can not be focused
658   manager.MoveFocusForward();
659   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
660   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
661 }
662
663 static void UtcDaliFocusManagerMoveFocusBackward()
664 {
665   ToolkitTestApplication application;
666
667   tet_infoline(" UtcDaliFocusManagerMoveFocusBackward");
668
669   FocusManager manager = FocusManager::Get();
670   DALI_TEST_CHECK(manager);
671
672   Actor first = Actor::New();
673   Stage::GetCurrent().Add(first);
674
675   Actor second = Actor::New();
676   Stage::GetCurrent().Add(second);
677
678   Actor third = Actor::New();
679   Stage::GetCurrent().Add(third);
680
681   // Set the focus order and description for the first actor
682   manager.SetFocusOrder(first, 1);
683   manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
684   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
685   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
686
687   // Set the focus order and description for the second actor
688   manager.SetFocusOrder(second, 2);
689   manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
690   DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
691   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
692
693   // Set the focus order and description for the second actor
694   manager.SetFocusOrder(third, 3);
695   manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
696   DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
697   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
698
699   // Check that no actor is being focused yet.
700   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
701
702   // Set the focus on the third actor
703   DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
704   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
705   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
706
707   // Test the non-wrapped move first
708   manager.SetWrapMode(false);
709   DALI_TEST_CHECK(manager.GetWrapMode() == false);
710
711   // Move the focus backward to the second actor
712   manager.MoveFocusBackward();
713   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
714   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "second");
715
716   // Move the focus backward to the first actor
717   manager.MoveFocusBackward();
718   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
719   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
720
721   // Check that it will fail to move the focus backward again as the first actor is the first
722   // focusable actor in the focus chain
723   manager.MoveFocusBackward();
724   // The focus should still be set on the first actor
725   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
726   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
727
728   // Now test the wrapped move
729   manager.SetWrapMode(true);
730   DALI_TEST_CHECK(manager.GetWrapMode() == true);
731
732   // Move the focus backward recursively and this time the third actor should be focused
733   manager.MoveFocusBackward();
734   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
735   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
736
737   // Make the second actor not focusable
738   Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
739   second.SetProperty(propertyActorFocusable, false);
740   // flush the queue and render once
741   application.SendNotification();
742   application.Render();
743
744   // Move the focus backward and check that the second actor should be skipped and
745   // the first actor should be focused now.
746   manager.MoveFocusBackward();
747   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
748   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
749
750   // Make the third actor invisible
751   third.SetVisible(false);
752   // flush the queue and render once
753   application.SendNotification();
754   application.Render();
755
756   // Move the focus backward and check that the third actor should be skipped as it's
757   // invisible and the second actor should also be skipped as it's not focusable,
758   // so the focus will still be on the first actor
759   manager.MoveFocusBackward();
760   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
761   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
762
763   // Make the first actor invisible so that no actor can be focused.
764   first.SetVisible(false);
765   // flush the queue and render once
766   application.SendNotification();
767   application.Render();
768
769   // Check that the focus move is failed as all the three actors can not be focused
770   manager.MoveFocusBackward();
771   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
772   DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
773 }
774
775 static void UtcDaliFocusManagerClearFocus()
776 {
777   ToolkitTestApplication application;
778
779   tet_infoline(" UtcDaliFocusManagerClearFocus");
780
781   FocusManager manager = FocusManager::Get();
782   DALI_TEST_CHECK(manager);
783
784   // Create the first actor and add it to the stage
785   Actor first = Actor::New();
786   manager.SetFocusOrder(first, 1);
787   Stage::GetCurrent().Add(first);
788
789   // Create the second actor and add it to the stage
790   Actor second = Actor::New();
791   manager.SetFocusOrder(second, 2);
792   Stage::GetCurrent().Add(second);
793
794   // Check that no actor is being focused yet.
795   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
796
797   // Check that the focus is set on the first actor
798   DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
799   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
800
801   // Check that the focus is set on the second actor
802   DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
803   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
804
805   // Clear the focus
806   manager.ClearFocus();
807
808   // Check that no actor is being focused now.
809   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
810 }
811
812 static void UtcDaliFocusManagerReset()
813 {
814   ToolkitTestApplication application;
815
816   tet_infoline(" UtcDaliFocusManagerReset");
817
818   FocusManager manager = FocusManager::Get();
819   DALI_TEST_CHECK(manager);
820
821   // Create the first actor and add it to the stage
822   Actor first = Actor::New();
823   manager.SetFocusOrder(first, 1);
824   Stage::GetCurrent().Add(first);
825
826   // Create the second actor and add it to the stage
827   Actor second = Actor::New();
828   manager.SetFocusOrder(second, 2);
829   Stage::GetCurrent().Add(second);
830
831   // Check that no actor is being focused yet.
832   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
833
834   // Check that the focus is set on the first actor
835   DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
836   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
837
838   // Check that the focus is set on the second actor
839   DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
840   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
841
842   // Clear the focus
843   manager.Reset();
844
845   // Check that no actor is being focused now and the focus order of actors have been cleared
846   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
847   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
848   DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
849 }
850
851 static void UtcDaliFocusManagerFocusGroup()
852 {
853   ToolkitTestApplication application;
854
855   tet_infoline(" UtcDaliFocusManagerFocusGroup");
856
857   FocusManager manager = FocusManager::Get();
858   DALI_TEST_CHECK(manager);
859
860   // Create an actor with two child actors and add it to the stage
861   Actor parent = Actor::New();
862   Actor firstChild = Actor::New();
863   Actor secondChild = Actor::New();
864   parent.Add(firstChild);
865   parent.Add(secondChild);
866   Stage::GetCurrent().Add(parent);
867
868   // Create three actors and add them as the children of the first child actor
869   Actor firstGrandChild = Actor::New();
870   Actor secondGrandChild = Actor::New();
871   Actor thirdGrandChild = Actor::New();
872   firstChild.Add(firstGrandChild);
873   firstChild.Add(secondGrandChild);
874   firstChild.Add(thirdGrandChild);
875
876   // Set focus order to the actors
877   manager.SetFocusOrder(parent, 1);
878   manager.SetFocusOrder(firstChild, 2);
879   manager.SetFocusOrder(firstGrandChild, 3);
880   manager.SetFocusOrder(secondGrandChild, 4);
881   manager.SetFocusOrder(thirdGrandChild, 5);
882   manager.SetFocusOrder(secondChild, 6);
883
884   // Set the parent and the first child actor as focus groups
885   manager.SetFocusGroup(parent, true);
886   DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
887
888   // The focus group of the parent should be itself, as it is set to be a focus group.
889   DALI_TEST_CHECK(manager.GetFocusGroup(parent) == parent);
890
891   // The focus group of the firstChild should be its parent, as it is the immediate parent which is also a group.
892   DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == parent);
893
894   manager.SetFocusGroup(firstChild, true);
895   DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
896
897   // The focus group of the firstChild should be itself, as it is set to be a focus group now.
898   DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == firstChild);
899
900   // Enable wrap mode for focus movement.
901   manager.SetWrapMode(true);
902   DALI_TEST_CHECK(manager.GetWrapMode() == true);
903
904   // Check that no actor is being focused yet.
905   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
906
907   // Check that the focus is set on the parent actor.
908   DALI_TEST_CHECK(manager.SetCurrentFocusActor(parent) == true);
909   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
910
911   // Check that group mode is disabled.
912   DALI_TEST_CHECK(manager.GetGroupMode() == false);
913
914   // Check that the focus movement is wrapped as normal.
915   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
916   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
917   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
918   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
919   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
920   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
921   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
922   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
923   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
924   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondChild);
925   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
926   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
927   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
928   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
929   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
930   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
931
932   // Enable the group mode.
933   manager.SetGroupMode(true);
934   DALI_TEST_CHECK(manager.GetGroupMode() == true);
935
936   // Check that the focus movement is now limited to the current focus group.
937   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
938   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
939   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
940   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
941   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
942   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
943   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
944   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
945 }
946
947 static void UtcDaliFocusManagerSetAndGetFocusIndicator()
948 {
949   ToolkitTestApplication application;
950
951   tet_infoline(" UtcDaliFocusManagerSetAndGetFocusIndicator");
952
953   FocusManager manager = FocusManager::Get();
954   DALI_TEST_CHECK(manager);
955
956   Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
957   DALI_TEST_CHECK(defaultFocusIndicatorActor);
958
959   Actor newFocusIndicatorActor = Actor::New();
960   manager.SetFocusIndicatorActor(newFocusIndicatorActor);
961   DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
962 }
963
964 static void UtcDaliFocusManagerSignalFocusChanged()
965 {
966   ToolkitTestApplication application;
967
968   tet_infoline(" UtcDaliFocusManagerSignalFocusChanged");
969
970   FocusManager manager = FocusManager::Get();
971   DALI_TEST_CHECK(manager);
972
973   bool signalVerified = false;
974   FocusChangedCallback callback(signalVerified);
975   manager.FocusChangedSignal().Connect( &callback, &FocusChangedCallback::Callback );
976
977   // Create the first actor and add it to the stage
978   Actor first = Actor::New();
979   manager.SetFocusOrder(first, 1);
980   Stage::GetCurrent().Add(first);
981
982   // Create the second actor and add it to the stage
983   Actor second = Actor::New();
984   manager.SetFocusOrder(second, 2);
985   Stage::GetCurrent().Add(second);
986
987   // Check that no actor is being focused yet.
988   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
989
990   // Check that the focus is set on the first actor
991   DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
992   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
993   DALI_TEST_CHECK(callback.mSignalVerified);
994   callback.Reset();
995
996   // Check that the focus is set on the second actor
997   DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
998   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
999   DALI_TEST_CHECK(callback.mSignalVerified);
1000   callback.Reset();
1001
1002   // Clear the focus
1003   manager.ClearFocus();
1004
1005   // Check that no actor is being focused now.
1006   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
1007   DALI_TEST_CHECK(callback.mSignalVerified);
1008 }
1009
1010 static void UtcDaliFocusManagerSignalFocusOvershot()
1011 {
1012   ToolkitTestApplication application;
1013
1014   tet_infoline(" UtcDaliFocusManagerSignalFocusOvershot");
1015
1016   FocusManager manager = FocusManager::Get();
1017   DALI_TEST_CHECK(manager);
1018
1019   bool signalVerified = false;
1020   FocusOvershotCallback callback(signalVerified);
1021   manager.FocusOvershotSignal().Connect(&callback, &FocusOvershotCallback::Callback);
1022
1023   // Create the first actor and add it to the stage
1024   Actor first = Actor::New();
1025   manager.SetFocusOrder(first, 1);
1026   Stage::GetCurrent().Add(first);
1027
1028   // Create the second actor and add it to the stage
1029   Actor second = Actor::New();
1030   manager.SetFocusOrder(second, 2);
1031   Stage::GetCurrent().Add(second);
1032
1033   // Check that the wrap mode is disabled
1034   DALI_TEST_CHECK(manager.GetWrapMode() == false);
1035
1036   // Check that the focus is set on the first actor
1037   DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
1038   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1039
1040   // Check that the focus is moved to the second actor successfully.
1041   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
1042   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
1043
1044   // Check that the forward focus movement is overshot.
1045   callback.mCurrentFocusedActor = second;
1046   callback.mFocusOvershotDirection = Toolkit::FocusManager::OVERSHOT_NEXT;
1047   DALI_TEST_CHECK(manager.MoveFocusForward() == false);
1048   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
1049   DALI_TEST_CHECK(signalVerified);
1050   callback.Reset();
1051
1052   // Enable the wrap mode
1053   manager.SetWrapMode(true);
1054   DALI_TEST_CHECK(manager.GetWrapMode() == true);
1055
1056   // Check that the forward focus movement is wrapped and no overshot happens.
1057   DALI_TEST_CHECK(manager.MoveFocusForward() == true);
1058   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1059   DALI_TEST_CHECK(signalVerified == false);
1060
1061   // Disable the wrap mode
1062   manager.SetWrapMode(false);
1063   DALI_TEST_CHECK(manager.GetWrapMode() == false);
1064
1065   // Check that the backward focus movement is overshot.
1066   callback.mCurrentFocusedActor = first;
1067   callback.mFocusOvershotDirection = Toolkit::FocusManager::OVERSHOT_PREVIOUS;
1068   DALI_TEST_CHECK(manager.MoveFocusBackward() == false);
1069   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1070   DALI_TEST_CHECK(signalVerified);
1071 }