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