Dali 3D User Interface Engine
utc-Dali-AccessibilityManager.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 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 #include <stdlib.h>
20 
21 // Need to override adaptor classes for toolkit test harness, so include
22 // test harness headers before dali headers.
25 
27 
28 using namespace Dali;
29 using namespace Toolkit;
30 
31 
33 {
35 }
36 
38 {
40 }
41 
42 
43 namespace
44 {
45 
47 
48 static void TestCallback(BaseHandle handle)
49 {
50  gObjectCreatedCallBackCalled = true;
51 }
52 
53 // Functors to test whether focus changed signal is emitted when the focus is changed
55 {
56 public:
57  FocusChangedCallback(bool& signalReceived)
58  : mSignalVerified(signalReceived),
59  mOriginalFocusedActor(),
60  mCurrentFocusedActor()
61  {
62  }
63 
64  void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
65  {
66  tet_infoline("Verifying FocusChangedCallback()");
67 
68  if(originalFocusedActor == mCurrentFocusedActor)
69  {
70  mSignalVerified = true;
71  }
72 
73  mOriginalFocusedActor = originalFocusedActor;
74  mCurrentFocusedActor = currentFocusedActor;
75  }
76 
77  void Reset()
78  {
79  mSignalVerified = false;
80  }
81 
85 };
86 
87 // Functors to test whether focus overshot signal is emitted when there is no way to move focus further.
89 {
90 public:
91  FocusOvershotCallback(bool& signalReceived)
92  : mSignalVerified(signalReceived),
93  mCurrentFocusedActor(),
94  mFocusOvershotDirection(Toolkit::AccessibilityManager::OVERSHOT_NEXT)
95  {
96  }
97 
99  {
100  tet_infoline("Verifying FocusOvershotCallback()");
101 
102  if(currentFocusedActor == mCurrentFocusedActor && direction == mFocusOvershotDirection)
103  {
104  mSignalVerified = true;
105  }
106  }
107 
108  void Reset()
109  {
110  mSignalVerified = false;
111  }
112 
116 };
117 
118 // Functor to test whether focused actor activated signal is emitted.
120 {
121 public:
123  {
124  }
125 
126  void Callback(Actor activatedActor)
127  {
128  tet_infoline("Verifying FocusedActorActivatedCallback()");
129  }
130 };
131 
132 } // namespace
133 
134 
136 {
137  ToolkitTestApplication application;
138 
139  tet_infoline(" UtcDaliAccessibilityManagerGet");
140 
141  AccessibilityManager manager;
142 
143  //Ensure object is created by checking if it's registered
145  DALI_TEST_CHECK(registry);
146 
148  registry.ObjectCreatedSignal().Connect( &TestCallback );
149  {
150  manager = AccessibilityManager::Get();
151  DALI_TEST_CHECK(manager);
152  }
154 
156  DALI_TEST_CHECK(newManager);
157 
158  // Check that accessibility manager is a singleton
159  DALI_TEST_CHECK(manager == newManager);
160  END_TEST;
161 }
162 
164 {
165  ToolkitTestApplication application;
166 
167  tet_infoline(" UtcDaliAccessibilityManagerSetAndGetAccessibilityAttribute");
168 
170  DALI_TEST_CHECK(manager);
171 
172  Actor actor = Actor::New();
174 
177 
178  manager.SetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL, "New description");
180  END_TEST;
181 }
182 
184 {
185  ToolkitTestApplication application;
186 
187  tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusOrder");
188 
190  DALI_TEST_CHECK(manager);
191 
192  Actor first = Actor::New();
193  Actor second = Actor::New();
194  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
195  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 0);
196 
197  // Set the focus order and description for the first actor
198  manager.SetFocusOrder(first, 1);
200  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
202 
203  // Set the focus order and description for the second actor
204  manager.SetFocusOrder(second, 2);
206  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
208 
209  // check that the focus order of the first actor is changed
210  manager.SetFocusOrder(first, 2);
211  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 2);
212  // make sure the change of focus order doesn't affect the actor's description
214 
215  // check that the focus order of the second actor is increased to 3
216  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 3);
217  // make sure the change of focus order doesn't affect the actor's description
219 
220  // check that the focus order of the second actor is changed to 1
221  manager.SetFocusOrder(second, 1);
222  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 1);
223  // make sure the change of focus order doesn't affect the actor's description
225 
226  // Set the focus order and description for the third actor
227  Actor third = Actor::New();
228  manager.SetFocusOrder(third, 1);
230  DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1);
232 
233  // check that the focus order of the second actor is increased to 2.
234  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
235  // make sure the change of focus order doesn't affect the actor's description
237 
238  // check that the focus order of the first actor is increased to 3.
239  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 3);
240  // make sure the change of focus order doesn't affect the actor's description
242  END_TEST;
243 }
244 
246 {
247  ToolkitTestApplication application;
248 
249  tet_infoline(" UtcDaliAccessibilityManagerGenerateNewFocusOrder");
250 
252  DALI_TEST_CHECK(manager);
253 
254  DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
255  DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
256 
257  Actor first = Actor::New();
258  Actor second = Actor::New();
259 
260  // Set the focus order for the first actor
261  manager.SetFocusOrder(first, 1);
263  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
264 
265  //Test for new focus order
266  DALI_TEST_CHECK(2 == manager.GenerateNewFocusOrder());
267 
268  // Set the focus order for the first actor
269  manager.SetFocusOrder(second, 2);
271  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
272  END_TEST;
273 }
274 
276 {
277  ToolkitTestApplication application;
278 
279  tet_infoline(" UtcDaliAccessibilityManagerGetActorByFocusOrder");
280 
282  DALI_TEST_CHECK(manager);
283 
284  // Create the actors and set their focus orders
285  Actor first = Actor::New();
286  manager.SetFocusOrder(first, 1);
287 
288  Actor second = Actor::New();
289  manager.SetFocusOrder(second, 2);
290 
291  Actor third = Actor::New();
292  manager.SetFocusOrder(third, 3);
293 
294  // Check that we get an empty handle as no actor is added to the stage yet.
295  DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == Actor());
296  DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == Actor());
297  DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == Actor());
298 
299  // Add the actors to the stage
300  Stage::GetCurrent().Add(first);
301  Stage::GetCurrent().Add(second);
302  Stage::GetCurrent().Add(third);
303 
304  // Check that we get an empty handle because focus order 0 means undefined.
305  DALI_TEST_CHECK(manager.GetActorByFocusOrder(0) == Actor());
306 
307  // Check that we get correct actors for the specified focus orders
308  DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == first);
309  DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == second);
310  DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == third);
311 
312  // Change the focus order of the third actor to 1
313  manager.SetFocusOrder(third, 1);
314 
315  // Check that we still get correct actors after changing their focus orders
316  DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == third);
317  DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == first);
318  DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == second);
319 
320  // Check that we get an empty handle because no actor has a focus order of 4
321  DALI_TEST_CHECK(manager.GetActorByFocusOrder(4) == Actor());
322  END_TEST;
323 }
324 
326 {
327  ToolkitTestApplication application;
328 
329  tet_infoline(" UtcDaliAccessibilityManagerSetAndGetCurrentFocusActor");
330 
332  DALI_TEST_CHECK(manager);
333 
334  // Create the first actor and add it to the stage
335  Actor first = Actor::New();
336  manager.SetFocusOrder(first, 1);
337  Stage::GetCurrent().Add(first);
338 
339  // Create the second actor and add it to the stage
340  Actor second = Actor::New();
341  manager.SetFocusOrder(second, 2);
342  Stage::GetCurrent().Add(second);
343 
344  // Create the third actor but don't add it to the stage
345  Actor third = Actor::New();
346  manager.SetFocusOrder(third, 3);
347 
348  // Check that no actor is being focused yet.
350 
351  // Check that it will fail to set focus on an invalid actor
352  DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
353 
354  // Check that the focus is set on the first actor
355  DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
356  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
357 
358  // Check that the focus is set on the second actor
359  DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
360  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
361 
362  // Check that it will fail to set focus on the third actor as it's not in the stage
363  DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
364 
365  // Add the third actor to the stage
366  Stage::GetCurrent().Add(third);
367 
368  // make the third actor invisible
369  third.SetVisible(false);
370  // flush the queue and render once
371  application.SendNotification();
372  application.Render();
373 
374  // Check that it will fail to set focus on the third actor as it's invisible
375  DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
376 
377  // Make the third actor visible
378  third.SetVisible(true);
379  // flush the queue and render once
380  application.SendNotification();
381  application.Render();
382 
383  // Make the third actor not focusable
384  Property::Index propertyActorFocusable = third.GetPropertyIndex("focusable");
385  third.SetProperty(propertyActorFocusable, false);
386  // flush the queue and render once
387  application.SendNotification();
388  application.Render();
389 
390  // Check that it will fail to set focus on the third actor as it's not focusable
391  DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
392 
393  // Make the third actor focusable
394  third.SetProperty(propertyActorFocusable, true);
395  // flush the queue and render once
396  application.SendNotification();
397  application.Render();
398 
399  // Check that the focus is successfully moved to the third actor
400  DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
401 
402  // Make the current focused actor to be not focusable by setting its focus order to be 0
403  manager.SetFocusOrder(third, 0);
404 
405  // Check that the focus is automatically cleared
407 
408  // Set the focus order of the third actor again
409  manager.SetFocusOrder(third, 3);
410 
411  // Check that the third actor can be focused successfully now
412  DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
413  END_TEST;
414 }
415 
417 {
418  ToolkitTestApplication application;
419 
420  tet_infoline(" UtcDaliAccessibilityManagerGetCurrentFocusGroup");
421 
423  DALI_TEST_CHECK(manager);
424 
425  // Create an actor with two child actors and add it to the stage
426  Actor parent = Actor::New();
427  Actor firstChild = Actor::New();
428  Actor secondChild = Actor::New();
429  parent.Add(firstChild);
430  parent.Add(secondChild);
431  Stage::GetCurrent().Add(parent);
432 
433  // Create three actors and add them as the children of the first child actor
434  Actor firstGrandChild = Actor::New();
435  Actor secondGrandChild = Actor::New();
436  Actor thirdGrandChild = Actor::New();
437  firstChild.Add(firstGrandChild);
438  firstChild.Add(secondGrandChild);
439  firstChild.Add(thirdGrandChild);
440 
441  // Set focus order to the actors
442  manager.SetFocusOrder(parent, 1);
443  manager.SetFocusOrder(firstChild, 2);
444  manager.SetFocusOrder(firstGrandChild, 3);
445  manager.SetFocusOrder(secondGrandChild, 4);
446  manager.SetFocusOrder(thirdGrandChild, 5);
447  manager.SetFocusOrder(secondChild, 6);
448 
449  // Set the parent and the first child actor as focus groups
450  manager.SetFocusGroup(parent, true);
451  DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
452 
453  // Set focus to the first grand child actor
454  DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstGrandChild) == true);
455  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
456 
457  // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
458  DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == parent);
459 
460  manager.SetFocusGroup(firstChild, true);
461  DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
462 
463  // The current focus group should be the firstChild, As it is the immediate parent which is also a focus group.
464  DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
465 
466  manager.SetFocusGroup(firstGrandChild, true);
467  DALI_TEST_CHECK(manager.IsFocusGroup(firstGrandChild) == true);
468 
469  // The current focus group should be itself, As it is also a focus group.
470  DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstGrandChild);
471 
472  // Set focus to the second grand child actor
473  DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondGrandChild) == true);
474  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
475 
476  // The current focus group should be the firstChild, As it is the immediate parent which is also a
477  // focus group for the current focus actor.
478  DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
479 
480  END_TEST;
481 }
482 
484 {
485  ToolkitTestApplication application;
486 
487  tet_infoline(" UtcDaliAccessibilityManagerGetCurrentFocusOrder");
488 
490  DALI_TEST_CHECK(manager);
491 
492  Actor first = Actor::New();
493  Stage::GetCurrent().Add(first);
494 
495  Actor second = Actor::New();
496  Stage::GetCurrent().Add(second);
497 
498  Actor third = Actor::New();
499  Stage::GetCurrent().Add(third);
500 
501  // Set the focus order and description for the first actor
502  manager.SetFocusOrder(first, 1);
504  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
506 
507  // Set the focus order and description for the second actor
508  manager.SetFocusOrder(second, 2);
510  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
512 
513  // Set the focus order and description for the second actor
514  manager.SetFocusOrder(third, 3);
516  DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
518 
519  // Check that no actor is being focused yet.
520  DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
521 
522  // Set the focus on the first actor and test
523  DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
524  DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 1);
525 
526  // Move the focus forward to the second actor and test
527  manager.MoveFocusForward();
528  DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 2);
529 
530  // Move the focus forward to the third actor and test
531  manager.MoveFocusForward();
532  DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 3);
533 
534  // Clear focus and test
535  manager.ClearFocus();
536  DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
537  END_TEST;
538 }
539 
541 {
542  ToolkitTestApplication application;
543 
544  tet_infoline(" UtcDaliAccessibilityManagerMoveFocusForward");
545 
547  DALI_TEST_CHECK(manager);
548 
549  Actor first = Actor::New();
550  Stage::GetCurrent().Add(first);
551 
552  Actor second = Actor::New();
553  Stage::GetCurrent().Add(second);
554 
555  Actor third = Actor::New();
556  Stage::GetCurrent().Add(third);
557 
558  // Set the focus order and description for the first actor
559  manager.SetFocusOrder(first, 1);
561  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
563 
564  // Set the focus order and description for the second actor
565  manager.SetFocusOrder(second, 2);
567  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
569 
570  // Set the focus order and description for the second actor
571  manager.SetFocusOrder(third, 3);
573  DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
575 
576  // Check that no actor is being focused yet.
578 
579  // Set the focus on the first actor
580  DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
581  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
583 
584  // Test the non-wrapped move first
585  manager.SetWrapMode(false);
586  DALI_TEST_CHECK(manager.GetWrapMode() == false);
587 
588  // Move the focus forward to the second actor
589  manager.MoveFocusForward();
590  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
592 
593  // Move the focus forward to the third actor
594  manager.MoveFocusForward();
595  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
597 
598  // Check that it will fail to move the focus forward again as the third actor is the last
599  // focusable actor in the focus chain
600  manager.MoveFocusForward();
601  // The focus should still be set on the third actor
602  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
604 
605  // Now test the wrapped move
606  manager.SetWrapMode(true);
607  DALI_TEST_CHECK(manager.GetWrapMode() == true);
608 
609  // Move the focus forward recursively and this time the first actor should be focused
610  manager.MoveFocusForward();
611  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
613 
614  // Make the second actor not focusable
615  Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
616  second.SetProperty(propertyActorFocusable, false);
617  // flush the queue and render once
618  application.SendNotification();
619  application.Render();
620 
621  // Move the focus forward and check that the second actor should be skipped and
622  // the third actor should be focused now.
623  manager.MoveFocusForward();
624  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
626 
627  // Make the first actor invisible
628  first.SetVisible(false);
629  // flush the queue and render once
630  application.SendNotification();
631  application.Render();
632 
633  // Move the focus forward and check that the first actor should be skipped as it's
634  // invisible and the second actor should also be skipped as it's not focusable,
635  // so the focus will still be on the third actor
636  manager.MoveFocusForward();
637  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
639 
640  // Make the third actor invisible so that no actor can be focused.
641  third.SetVisible(false);
642  // flush the queue and render once
643  application.SendNotification();
644  application.Render();
645 
646  // Check that the focus move is failed as all the three actors can not be focused
647  manager.MoveFocusForward();
648  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
650  END_TEST;
651 }
652 
654 {
655  ToolkitTestApplication application;
656 
657  tet_infoline(" UtcDaliAccessibilityManagerMoveFocusBackward");
658 
660  DALI_TEST_CHECK(manager);
661 
662  Actor first = Actor::New();
663  Stage::GetCurrent().Add(first);
664 
665  Actor second = Actor::New();
666  Stage::GetCurrent().Add(second);
667 
668  Actor third = Actor::New();
669  Stage::GetCurrent().Add(third);
670 
671  // Set the focus order and description for the first actor
672  manager.SetFocusOrder(first, 1);
674  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
676 
677  // Set the focus order and description for the second actor
678  manager.SetFocusOrder(second, 2);
680  DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
682 
683  // Set the focus order and description for the second actor
684  manager.SetFocusOrder(third, 3);
686  DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
688 
689  // Check that no actor is being focused yet.
691 
692  // Set the focus on the third actor
693  DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
694  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
696 
697  // Test the non-wrapped move first
698  manager.SetWrapMode(false);
699  DALI_TEST_CHECK(manager.GetWrapMode() == false);
700 
701  // Move the focus backward to the second actor
702  manager.MoveFocusBackward();
703  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
705 
706  // Move the focus backward to the first actor
707  manager.MoveFocusBackward();
708  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
710 
711  // Check that it will fail to move the focus backward again as the first actor is the first
712  // focusable actor in the focus chain
713  manager.MoveFocusBackward();
714  // The focus should still be set on the first actor
715  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
717 
718  // Now test the wrapped move
719  manager.SetWrapMode(true);
720  DALI_TEST_CHECK(manager.GetWrapMode() == true);
721 
722  // Move the focus backward recursively and this time the third actor should be focused
723  manager.MoveFocusBackward();
724  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
726 
727  // Make the second actor not focusable
728  Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
729  second.SetProperty(propertyActorFocusable, false);
730  // flush the queue and render once
731  application.SendNotification();
732  application.Render();
733 
734  // Move the focus backward and check that the second actor should be skipped and
735  // the first actor should be focused now.
736  manager.MoveFocusBackward();
737  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
739 
740  // Make the third actor invisible
741  third.SetVisible(false);
742  // flush the queue and render once
743  application.SendNotification();
744  application.Render();
745 
746  // Move the focus backward and check that the third actor should be skipped as it's
747  // invisible and the second actor should also be skipped as it's not focusable,
748  // so the focus will still be on the first actor
749  manager.MoveFocusBackward();
750  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
752 
753  // Make the first actor invisible so that no actor can be focused.
754  first.SetVisible(false);
755  // flush the queue and render once
756  application.SendNotification();
757  application.Render();
758 
759  // Check that the focus move is failed as all the three actors can not be focused
760  manager.MoveFocusBackward();
761  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
763  END_TEST;
764 }
765 
767 {
768  ToolkitTestApplication application;
769 
770  tet_infoline(" UtcDaliAccessibilityManagerClearFocus");
771 
773  DALI_TEST_CHECK(manager);
774 
775  // Create the first actor and add it to the stage
776  Actor first = Actor::New();
777  manager.SetFocusOrder(first, 1);
778  Stage::GetCurrent().Add(first);
779 
780  // Create the second actor and add it to the stage
781  Actor second = Actor::New();
782  manager.SetFocusOrder(second, 2);
783  Stage::GetCurrent().Add(second);
784 
785  // Check that no actor is being focused yet.
787 
788  // Check that the focus is set on the first actor
789  DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
790  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
791 
792  // Check that the focus is set on the second actor
793  DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
794  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
795 
796  // Clear the focus
797  manager.ClearFocus();
798 
799  // Check that no actor is being focused now.
801  END_TEST;
802 }
803 
805 {
806  ToolkitTestApplication application;
807 
808  tet_infoline(" UtcDaliAccessibilityManagerReset");
809 
811  DALI_TEST_CHECK(manager);
812 
813  // Create the first actor and add it to the stage
814  Actor first = Actor::New();
815  manager.SetFocusOrder(first, 1);
816  Stage::GetCurrent().Add(first);
817 
818  // Create the second actor and add it to the stage
819  Actor second = Actor::New();
820  manager.SetFocusOrder(second, 2);
821  Stage::GetCurrent().Add(second);
822 
823  // Check that no actor is being focused yet.
825 
826  // Check that the focus is set on the first actor
827  DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
828  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
829 
830  // Check that the focus is set on the second actor
831  DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
832  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
833 
834  // Clear the focus
835  manager.Reset();
836 
837  // Check that no actor is being focused now and the focus order of actors have been cleared
839  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
840  DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
841  END_TEST;
842 }
843 
845 {
846  ToolkitTestApplication application;
847 
848  tet_infoline(" UtcDaliAccessibilityManagerFocusGroup");
849 
851  DALI_TEST_CHECK(manager);
852 
853  // Create an actor with two child actors and add it to the stage
854  Actor parent = Actor::New();
855  Actor firstChild = Actor::New();
856  Actor secondChild = Actor::New();
857  parent.Add(firstChild);
858  parent.Add(secondChild);
859  Stage::GetCurrent().Add(parent);
860 
861  // Create three actors and add them as the children of the first child actor
862  Actor firstGrandChild = Actor::New();
863  Actor secondGrandChild = Actor::New();
864  Actor thirdGrandChild = Actor::New();
865  firstChild.Add(firstGrandChild);
866  firstChild.Add(secondGrandChild);
867  firstChild.Add(thirdGrandChild);
868 
869  // Set focus order to the actors
870  manager.SetFocusOrder(parent, 1);
871  manager.SetFocusOrder(firstChild, 2);
872  manager.SetFocusOrder(firstGrandChild, 3);
873  manager.SetFocusOrder(secondGrandChild, 4);
874  manager.SetFocusOrder(thirdGrandChild, 5);
875  manager.SetFocusOrder(secondChild, 6);
876 
877  // Set the parent and the first child actor as focus groups
878  manager.SetFocusGroup(parent, true);
879  DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
880 
881  // The focus group of the parent should be itself, as it is set to be a focus group.
882  DALI_TEST_CHECK(manager.GetFocusGroup(parent) == parent);
883 
884  // The focus group of the firstChild should be its parent, as it is the immediate parent which is also a group.
885  DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == parent);
886 
887  manager.SetFocusGroup(firstChild, true);
888  DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
889 
890  // The focus group of the firstChild should be itself, as it is set to be a focus group now.
891  DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == firstChild);
892 
893  // Enable wrap mode for focus movement.
894  manager.SetWrapMode(true);
895  DALI_TEST_CHECK(manager.GetWrapMode() == true);
896 
897  // Check that no actor is being focused yet.
899 
900  // Check that the focus is set on the parent actor.
901  DALI_TEST_CHECK(manager.SetCurrentFocusActor(parent) == true);
902  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
903 
904  // Check that group mode is disabled.
905  DALI_TEST_CHECK(manager.GetGroupMode() == false);
906 
907  // Check that the focus movement is wrapped as normal.
908  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
909  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
910  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
911  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
912  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
913  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
914  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
915  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
916  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
917  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondChild);
918  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
919  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
920  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
921  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
922  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
923  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
924 
925  // Enable the group mode.
926  manager.SetGroupMode(true);
927  DALI_TEST_CHECK(manager.GetGroupMode() == true);
928 
929  // Check that the focus movement is now limited to the current focus group.
930  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
931  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
932  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
933  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
934  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
935  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
936  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
937  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
938  END_TEST;
939 }
940 
942 {
943  ToolkitTestApplication application;
944 
945  tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusIndicator");
946 
948  DALI_TEST_CHECK(manager);
949 
950  Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
951  DALI_TEST_CHECK(defaultFocusIndicatorActor);
952 
953  Actor newFocusIndicatorActor = Actor::New();
954  manager.SetFocusIndicatorActor(newFocusIndicatorActor);
955  DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
956  END_TEST;
957 }
958 
960 {
961  ToolkitTestApplication application;
962 
963  tet_infoline(" UtcDaliAccessibilityManagerSignalFocusChanged");
964 
966  DALI_TEST_CHECK(manager);
967 
968  bool signalVerified = false;
969  FocusChangedCallback callback(signalVerified);
970  manager.FocusChangedSignal().Connect( &callback, &FocusChangedCallback::Callback );
971 
972  // Create the first actor and add it to the stage
973  Actor first = Actor::New();
974  manager.SetFocusOrder(first, 1);
975  Stage::GetCurrent().Add(first);
976 
977  // Create the second actor and add it to the stage
978  Actor second = Actor::New();
979  manager.SetFocusOrder(second, 2);
980  Stage::GetCurrent().Add(second);
981 
982  // Check that no actor is being focused yet.
984 
985  // Check that the focus is set on the first actor
986  DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
987  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
988  DALI_TEST_CHECK(callback.mSignalVerified);
989  callback.Reset();
990 
991  // Check that the focus is set on the second actor
992  DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
993  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
994  DALI_TEST_CHECK(callback.mSignalVerified);
995  callback.Reset();
996 
997  // Clear the focus
998  manager.ClearFocus();
999 
1000  // Check that no actor is being focused now.
1001  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
1002  DALI_TEST_CHECK(callback.mSignalVerified);
1003  END_TEST;
1004 }
1005 
1007 {
1008  ToolkitTestApplication application;
1009 
1010  tet_infoline(" UtcDaliAccessibilityManagerSignalFocusOvershot");
1011 
1013  DALI_TEST_CHECK(manager);
1014 
1015  bool signalVerified = false;
1016  FocusOvershotCallback callback(signalVerified);
1017  manager.FocusOvershotSignal().Connect(&callback, &FocusOvershotCallback::Callback);
1018 
1019  // Create the first actor and add it to the stage
1020  Actor first = Actor::New();
1021  manager.SetFocusOrder(first, 1);
1022  Stage::GetCurrent().Add(first);
1023 
1024  // Create the second actor and add it to the stage
1025  Actor second = Actor::New();
1026  manager.SetFocusOrder(second, 2);
1027  Stage::GetCurrent().Add(second);
1028 
1029  // Check that the wrap mode is disabled
1030  DALI_TEST_CHECK(manager.GetWrapMode() == false);
1031 
1032  // Check that the focus is set on the first actor
1033  DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
1034  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1035 
1036  // Check that the focus is moved to the second actor successfully.
1037  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
1038  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
1039 
1040  // Check that the forward focus movement is overshot.
1041  callback.mCurrentFocusedActor = second;
1042  callback.mFocusOvershotDirection = Toolkit::AccessibilityManager::OVERSHOT_NEXT;
1043  DALI_TEST_CHECK(manager.MoveFocusForward() == false);
1044  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
1045  DALI_TEST_CHECK(signalVerified);
1046  callback.Reset();
1047 
1048  // Enable the wrap mode
1049  manager.SetWrapMode(true);
1050  DALI_TEST_CHECK(manager.GetWrapMode() == true);
1051 
1052  // Check that the forward focus movement is wrapped and no overshot happens.
1053  DALI_TEST_CHECK(manager.MoveFocusForward() == true);
1054  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1055  DALI_TEST_CHECK(signalVerified == false);
1056 
1057  // Disable the wrap mode
1058  manager.SetWrapMode(false);
1059  DALI_TEST_CHECK(manager.GetWrapMode() == false);
1060 
1061  // Check that the backward focus movement is overshot.
1062  callback.mCurrentFocusedActor = first;
1063  callback.mFocusOvershotDirection = Toolkit::AccessibilityManager::OVERSHOT_PREVIOUS;
1064  DALI_TEST_CHECK(manager.MoveFocusBackward() == false);
1065  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
1066  DALI_TEST_CHECK(signalVerified);
1067  END_TEST;
1068 }
1069 
1071 {
1072  ToolkitTestApplication application;
1073 
1074  tet_infoline(" UtcDaliAccessibilityManagerSignalFocusedActorActivated");
1075 
1077  DALI_TEST_CHECK(manager);
1078 
1079  FocusedActorActivatedCallback callback;
1080  manager.FocusedActorActivatedSignal().Connect(&callback, &FocusedActorActivatedCallback::Callback);
1081  DALI_TEST_CHECK(true);
1082 
1083  END_TEST;
1084 }
1085 
1086 // Note: No negative test for GetReadPosition as it will always return something.
1088 {
1089  ToolkitTestApplication application;
1090  tet_infoline(" UtcDaliAccessibilityManagerGetReadPositionP");
1091 
1093  DALI_TEST_CHECK( manager );
1094 
1095  Vector2 readPosition( manager.GetReadPosition() );
1096  DALI_TEST_EQUALS( readPosition.x, 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1097  DALI_TEST_EQUALS( readPosition.y, 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
1098 
1099  END_TEST;
1100 }
1101 
1102 // Functor to test if an accessibility signal has been called.
1104 {
1105 public:
1107  mCalls( 0 )
1108  {
1109  }
1110 
1111  bool Callback( AccessibilityManager& accessibilityManager )
1112  {
1113  mCalls++;
1114  tet_infoline( "Signal called" );
1115  return true;
1116  }
1117 
1118  unsigned int GetCalls() const
1119  {
1120  return mCalls;
1121  }
1122 
1123 private:
1124  unsigned int mCalls;
1125 };
1126 
1128 {
1129  ToolkitTestApplication application;
1130  tet_infoline( " UtcDaliAccessibilityManagerStatusChangedSignalP" );
1131 
1133 
1135  DALI_TEST_CHECK( manager );
1136 
1137  manager.StatusChangedSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1138 
1139  // Cause a state change.
1141  accessibilityAdaptor.HandleActionEnableEvent();
1142 
1143  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1144 
1145  END_TEST;
1146 }
1147 
1149 {
1150  ToolkitTestApplication application;
1151  tet_infoline( " UtcDaliAccessibilityManagerStatusChangedSignalN" );
1152 
1154 
1156  DALI_TEST_CHECK( manager );
1157 
1158  manager.StatusChangedSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1159  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1160 
1161  END_TEST;
1162 }
1163 
1165 {
1166  ToolkitTestApplication application;
1167  tet_infoline( " UtcDaliAccessibilityManagerActionNextSignalP" );
1168 
1170 
1172  DALI_TEST_CHECK( manager );
1173 
1174  manager.ActionNextSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1175 
1177  accessibilityAdaptor.HandleActionNextEvent();
1178 
1179  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1180 
1181  END_TEST;
1182 }
1183 
1185 {
1186  ToolkitTestApplication application;
1187  tet_infoline( " UtcDaliAccessibilityManagerActionNextSignalN" );
1188 
1190 
1192  DALI_TEST_CHECK( manager );
1193 
1194  manager.ActionNextSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1195  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1196 
1197  END_TEST;
1198 }
1199 
1201 {
1202  ToolkitTestApplication application;
1203  tet_infoline( " UtcDaliAccessibilityManagerActionPreviousSignalP" );
1204 
1206 
1208  DALI_TEST_CHECK( manager );
1209 
1210  manager.ActionPreviousSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1211 
1213  accessibilityAdaptor.HandleActionPreviousEvent();
1214 
1215  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1216 
1217  END_TEST;
1218 }
1219 
1221 {
1222  ToolkitTestApplication application;
1223  tet_infoline( " UtcDaliAccessibilityManagerActionPreviousSignalN" );
1224 
1226 
1228  DALI_TEST_CHECK( manager );
1229 
1230  manager.ActionPreviousSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1231  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1232 
1233  END_TEST;
1234 }
1235 
1237 {
1238  ToolkitTestApplication application;
1239  tet_infoline( " UtcDaliAccessibilityManagerActionActivateSignalP" );
1240 
1242 
1244  DALI_TEST_CHECK( manager );
1245 
1246  manager.ActionActivateSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1247 
1249  accessibilityAdaptor.HandleActionActivateEvent();
1250 
1251  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1252 
1253  END_TEST;
1254 }
1255 
1257 {
1258  ToolkitTestApplication application;
1259  tet_infoline( " UtcDaliAccessibilityManagerActionActivateSignalN" );
1260 
1262 
1264  DALI_TEST_CHECK( manager );
1265 
1266  manager.ActionActivateSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1267  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1268 
1269  END_TEST;
1270 }
1271 
1273 {
1274  ToolkitTestApplication application;
1275  tet_infoline( " UtcDaliAccessibilityManagerActionReadSignalP" );
1276 
1278 
1280  DALI_TEST_CHECK( manager );
1281 
1282  manager.ActionReadSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1283 
1285  accessibilityAdaptor.HandleActionReadEvent( 100.0f, 200.0f, true );
1286 
1287  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1288 
1289  END_TEST;
1290 }
1291 
1293 {
1294  ToolkitTestApplication application;
1295  tet_infoline( " UtcDaliAccessibilityManagerActionReadSignalN" );
1296 
1298 
1300  DALI_TEST_CHECK( manager );
1301 
1302  manager.ActionReadSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1303  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1304 
1305  END_TEST;
1306 }
1307 
1309 {
1310  ToolkitTestApplication application;
1311  tet_infoline( " UtcDaliAccessibilityManagerActionOverSignalP" );
1312 
1314 
1316  DALI_TEST_CHECK( manager );
1317 
1318  manager.ActionOverSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1319 
1321  // Note that the ActionOverSignal is provoked by a read even when "allow read again" is set to false.
1322  accessibilityAdaptor.HandleActionReadEvent( 100.0f, 200.0f, false );
1323 
1324  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1325 
1326  END_TEST;
1327 }
1328 
1330 {
1331  ToolkitTestApplication application;
1332  tet_infoline( " UtcDaliAccessibilityManagerActionOverSignalN" );
1333 
1335 
1337  DALI_TEST_CHECK( manager );
1338 
1339  manager.ActionOverSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1340  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1341 
1342  END_TEST;
1343 }
1344 
1346 {
1347  ToolkitTestApplication application;
1348  tet_infoline( " UtcDaliAccessibilityManagerActionReadNextSignalP" );
1349 
1351 
1353  DALI_TEST_CHECK( manager );
1354 
1355  manager.ActionReadNextSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1356 
1358  accessibilityAdaptor.HandleActionReadNextEvent();
1359 
1360  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1361 
1362  END_TEST;
1363 }
1364 
1366 {
1367  ToolkitTestApplication application;
1368  tet_infoline( " UtcDaliAccessibilityManagerActionReadNextSignalN" );
1369 
1371 
1373  DALI_TEST_CHECK( manager );
1374 
1375  manager.ActionReadNextSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1376  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1377 
1378  END_TEST;
1379 }
1380 
1382 {
1383  ToolkitTestApplication application;
1384  tet_infoline( " UtcDaliAccessibilityManagerActionReadPreviousSignalP" );
1385 
1387 
1389  DALI_TEST_CHECK( manager );
1390 
1392 
1394  accessibilityAdaptor.HandleActionReadPreviousEvent();
1395 
1396  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1397 
1398  END_TEST;
1399 }
1400 
1402 {
1403  ToolkitTestApplication application;
1404  tet_infoline( " UtcDaliAccessibilityManagerActionReadPreviousSignalN" );
1405 
1407 
1409  DALI_TEST_CHECK( manager );
1410 
1412  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1413 
1414  END_TEST;
1415 }
1416 
1418 {
1419  ToolkitTestApplication application;
1420  tet_infoline( " UtcDaliAccessibilityManagerActionUpSignalP" );
1421 
1423 
1425  DALI_TEST_CHECK( manager );
1426 
1427  manager.ActionUpSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1428 
1430  accessibilityAdaptor.HandleActionUpEvent();
1431 
1432  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1433 
1434  END_TEST;
1435 }
1436 
1438 {
1439  ToolkitTestApplication application;
1440  tet_infoline( " UtcDaliAccessibilityManagerActionUpSignalN" );
1441 
1443 
1445  DALI_TEST_CHECK( manager );
1446 
1447  manager.ActionUpSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1448  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1449 
1450  END_TEST;
1451 }
1452 
1454 {
1455  ToolkitTestApplication application;
1456  tet_infoline( " UtcDaliAccessibilityManagerActionDownSignalP" );
1457 
1459 
1461  DALI_TEST_CHECK( manager );
1462 
1463  manager.ActionDownSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1464 
1466  accessibilityAdaptor.HandleActionDownEvent();
1467 
1468  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1469 
1470  END_TEST;
1471 }
1472 
1474 {
1475  ToolkitTestApplication application;
1476  tet_infoline( " UtcDaliAccessibilityManagerActionDownSignalN" );
1477 
1479 
1481  DALI_TEST_CHECK( manager );
1482 
1483  manager.ActionDownSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1484  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1485 
1486  END_TEST;
1487 }
1488 
1490 {
1491  ToolkitTestApplication application;
1492  tet_infoline( " UtcDaliAccessibilityManagerActionClearFocusSignalP" );
1493 
1495 
1497  DALI_TEST_CHECK( manager );
1498 
1500 
1502  accessibilityAdaptor.HandleActionClearFocusEvent();
1503 
1504  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1505 
1506  END_TEST;
1507 }
1508 
1510 {
1511  ToolkitTestApplication application;
1512  tet_infoline( " UtcDaliAccessibilityManagerActionClearFocusSignalN" );
1513 
1515 
1517  DALI_TEST_CHECK( manager );
1518 
1520  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1521 
1522  END_TEST;
1523 }
1524 
1526 {
1527  ToolkitTestApplication application;
1528  tet_infoline( " UtcDaliAccessibilityManagerActionBackSignalP" );
1529 
1531 
1533  DALI_TEST_CHECK( manager );
1534 
1535  manager.ActionBackSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1536 
1538  accessibilityAdaptor.HandleActionBackEvent();
1539 
1540  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1541 
1542  END_TEST;
1543 }
1544 
1546 {
1547  ToolkitTestApplication application;
1548  tet_infoline( " UtcDaliAccessibilityManagerActionBackSignalN" );
1549 
1551 
1553  DALI_TEST_CHECK( manager );
1554 
1555  manager.ActionBackSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1556  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1557 
1558  END_TEST;
1559 }
1560 
1562 {
1563  ToolkitTestApplication application;
1564  tet_infoline( " UtcDaliAccessibilityManagerActionScrollUpSignalP" );
1565 
1567 
1569  DALI_TEST_CHECK( manager );
1570 
1571  manager.ActionScrollUpSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1572 
1574  accessibilityAdaptor.HandleActionScrollUpEvent();
1575 
1576  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1577 
1578  END_TEST;
1579 }
1580 
1582 {
1583  ToolkitTestApplication application;
1584  tet_infoline( " UtcDaliAccessibilityManagerActionScrollUpSignalN" );
1585 
1587 
1589  DALI_TEST_CHECK( manager );
1590 
1591  manager.ActionScrollUpSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1592  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1593 
1594  END_TEST;
1595 }
1596 
1598 {
1599  ToolkitTestApplication application;
1600  tet_infoline( " UtcDaliAccessibilityManagerActionScrollDownSignalP" );
1601 
1603 
1605  DALI_TEST_CHECK( manager );
1606 
1608 
1610  accessibilityAdaptor.HandleActionScrollDownEvent();
1611 
1612  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1613 
1614  END_TEST;
1615 }
1616 
1618 {
1619  ToolkitTestApplication application;
1620  tet_infoline( " UtcDaliAccessibilityManagerActionScrollDownSignalN" );
1621 
1623 
1625  DALI_TEST_CHECK( manager );
1626 
1628  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1629 
1630  END_TEST;
1631 }
1632 
1634 {
1635  ToolkitTestApplication application;
1636  tet_infoline( " UtcDaliAccessibilityManagerActionPageLeftSignalP" );
1637 
1639 
1641  DALI_TEST_CHECK( manager );
1642 
1643  manager.ActionPageLeftSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1644 
1646  accessibilityAdaptor.HandleActionPageLeftEvent();
1647 
1648  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1649 
1650  END_TEST;
1651 }
1652 
1654 {
1655  ToolkitTestApplication application;
1656  tet_infoline( " UtcDaliAccessibilityManagerActionPageLeftSignalN" );
1657 
1659 
1661  DALI_TEST_CHECK( manager );
1662 
1663  manager.ActionPageLeftSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1664  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1665 
1666  END_TEST;
1667 }
1668 
1670 {
1671  ToolkitTestApplication application;
1672  tet_infoline( " UtcDaliAccessibilityManagerActionPageRightSignalP" );
1673 
1675 
1677  DALI_TEST_CHECK( manager );
1678 
1679  manager.ActionPageRightSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1680 
1682  accessibilityAdaptor.HandleActionPageRightEvent();
1683 
1684  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1685 
1686  END_TEST;
1687 }
1688 
1690 {
1691  ToolkitTestApplication application;
1692  tet_infoline( " UtcDaliAccessibilityManagerActionPageRightSignalN" );
1693 
1695 
1697  DALI_TEST_CHECK( manager );
1698 
1699  manager.ActionPageRightSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1700  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1701 
1702  END_TEST;
1703 }
1704 
1706 {
1707  ToolkitTestApplication application;
1708  tet_infoline( " UtcDaliAccessibilityManagerActionPageUpSignalP" );
1709 
1711 
1713  DALI_TEST_CHECK( manager );
1714 
1715  manager.ActionPageUpSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1716 
1718  accessibilityAdaptor.HandleActionPageUpEvent();
1719 
1720  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1721 
1722  END_TEST;
1723 }
1724 
1726 {
1727  ToolkitTestApplication application;
1728  tet_infoline( " UtcDaliAccessibilityManagerActionPageUpSignalN" );
1729 
1731 
1733  DALI_TEST_CHECK( manager );
1734 
1735  manager.ActionPageUpSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1736  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1737 
1738  END_TEST;
1739 }
1740 
1742 {
1743  ToolkitTestApplication application;
1744  tet_infoline( " UtcDaliAccessibilityManagerActionPageDownSignalP" );
1745 
1747 
1749  DALI_TEST_CHECK( manager );
1750 
1751  manager.ActionPageDownSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1752 
1754  accessibilityAdaptor.HandleActionPageDownEvent();
1755 
1756  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1757 
1758  END_TEST;
1759 }
1760 
1762 {
1763  ToolkitTestApplication application;
1764  tet_infoline( " UtcDaliAccessibilityManagerActionPageDownSignalN" );
1765 
1767 
1769  DALI_TEST_CHECK( manager );
1770 
1771  manager.ActionPageDownSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1772  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1773 
1774  END_TEST;
1775 }
1776 
1778 {
1779  ToolkitTestApplication application;
1780  tet_infoline( " UtcDaliAccessibilityManagerActionMoveToFirstSignalP" );
1781 
1783 
1785  DALI_TEST_CHECK( manager );
1786 
1788 
1790  accessibilityAdaptor.HandleActionMoveToFirstEvent();
1791 
1792  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1793 
1794  END_TEST;
1795 }
1796 
1798 {
1799  ToolkitTestApplication application;
1800  tet_infoline( " UtcDaliAccessibilityManagerActionMoveToFirstSignalN" );
1801 
1803 
1805  DALI_TEST_CHECK( manager );
1806 
1808  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1809 
1810  END_TEST;
1811 }
1812 
1814 {
1815  ToolkitTestApplication application;
1816  tet_infoline( " UtcDaliAccessibilityManagerActionMoveToLastSignalP" );
1817 
1819 
1821  DALI_TEST_CHECK( manager );
1822 
1824 
1826  accessibilityAdaptor.HandleActionMoveToLastEvent();
1827 
1828  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1829 
1830  END_TEST;
1831 }
1832 
1834 {
1835  ToolkitTestApplication application;
1836  tet_infoline( " UtcDaliAccessibilityManagerActionMoveToLastSignalN" );
1837 
1839 
1841  DALI_TEST_CHECK( manager );
1842 
1844  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1845 
1846  END_TEST;
1847 }
1848 
1850 {
1851  ToolkitTestApplication application;
1852  tet_infoline( " UtcDaliAccessibilityManagerActionReadFromTopSignalP" );
1853 
1855 
1857  DALI_TEST_CHECK( manager );
1858 
1860 
1862  accessibilityAdaptor.HandleActionReadFromTopEvent();
1863 
1864  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1865 
1866  END_TEST;
1867 }
1868 
1870 {
1871  ToolkitTestApplication application;
1872  tet_infoline( " UtcDaliAccessibilityManagerActionReadFromTopSignalN" );
1873 
1875 
1877  DALI_TEST_CHECK( manager );
1878 
1880  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1881 
1882  END_TEST;
1883 }
1884 
1886 {
1887  ToolkitTestApplication application;
1888  tet_infoline( " UtcDaliAccessibilityManagerActionReadFromNextSignalP" );
1889 
1891 
1893  DALI_TEST_CHECK( manager );
1894 
1896 
1898  accessibilityAdaptor.HandleActionReadFromNextEvent();
1899 
1900  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1901 
1902  END_TEST;
1903 }
1904 
1906 {
1907  ToolkitTestApplication application;
1908  tet_infoline( " UtcDaliAccessibilityManagerActionReadFromNextSignalN" );
1909 
1911 
1913  DALI_TEST_CHECK( manager );
1914 
1916  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1917 
1918  END_TEST;
1919 }
1920 
1922 {
1923  ToolkitTestApplication application;
1924  tet_infoline( " UtcDaliAccessibilityManagerActionZoomSignalP" );
1925 
1927 
1929  DALI_TEST_CHECK( manager );
1930 
1931  manager.ActionZoomSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1932 
1934  accessibilityAdaptor.HandleActionZoomEvent();
1935 
1936  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1937 
1938  END_TEST;
1939 }
1940 
1942 {
1943  ToolkitTestApplication application;
1944  tet_infoline( " UtcDaliAccessibilityManagerActionZoomSignalN" );
1945 
1947 
1949  DALI_TEST_CHECK( manager );
1950 
1951  manager.ActionZoomSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
1952  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1953 
1954  END_TEST;
1955 }
1956 
1958 {
1959  ToolkitTestApplication application;
1960  tet_infoline( " UtcDaliAccessibilityManagerActionReadIndicatorInformationSignalP" );
1961 
1963 
1965  DALI_TEST_CHECK( manager );
1966 
1968 
1970  accessibilityAdaptor.HandleActionReadIndicatorInformationEvent();
1971 
1972  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
1973 
1974  END_TEST;
1975 }
1976 
1978 {
1979  ToolkitTestApplication application;
1980  tet_infoline( " UtcDaliAccessibilityManagerActionReadIndicatorInformationSignalN" );
1981 
1983 
1985  DALI_TEST_CHECK( manager );
1986 
1988  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
1989 
1990  END_TEST;
1991 }
1992 
1994 {
1995  ToolkitTestApplication application;
1996  tet_infoline( " UtcDaliAccessibilityManagerActionReadPauseResumeSignalP" );
1997 
1999 
2001  DALI_TEST_CHECK( manager );
2002 
2004 
2006  accessibilityAdaptor.HandleActionReadPauseResumeEvent();
2007 
2008  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
2009 
2010  END_TEST;
2011 }
2012 
2014 {
2015  ToolkitTestApplication application;
2016  tet_infoline( " UtcDaliAccessibilityManagerActionReadPauseResumeSignalN" );
2017 
2019 
2021  DALI_TEST_CHECK( manager );
2022 
2024  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
2025 
2026  END_TEST;
2027 }
2028 
2030 {
2031  ToolkitTestApplication application;
2032  tet_infoline( " UtcDaliAccessibilityManagerActionStartStopSignalP" );
2033 
2035 
2037  DALI_TEST_CHECK( manager );
2038 
2039  manager.ActionStartStopSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
2040 
2042  accessibilityAdaptor.HandleActionStartStopEvent();
2043 
2044  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
2045 
2046  END_TEST;
2047 }
2048 
2050 {
2051  ToolkitTestApplication application;
2052  tet_infoline( " UtcDaliAccessibilityManagerActionStartStopSignalN" );
2053 
2055 
2057  DALI_TEST_CHECK( manager );
2058 
2059  manager.ActionStartStopSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
2060  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
2061 
2062  END_TEST;
2063 }
2064 
2065 // Functor to test if a accessibility scroll signal has been called.
2067 {
2068 public:
2070  mCalls( 0 )
2071  {
2072  }
2073 
2074  bool Callback( AccessibilityManager& accessibilityManager, const Dali::TouchEvent& touchEvent )
2075  {
2076  mCalls++;
2077  mTouchEvent = touchEvent;
2078  tet_infoline( "Signal called" );
2079  return true;
2080  }
2081 
2082  unsigned int GetCalls() const
2083  {
2084  return mCalls;
2085  }
2086 
2087  const Dali::TouchEvent& GetTouchEvent() const
2088  {
2089  return mTouchEvent;
2090  }
2091 
2092 private:
2093  unsigned int mCalls;
2095 };
2096 
2098 {
2099  ToolkitTestApplication application;
2100  tet_infoline( " UtcDaliAccessibilityManagerActionScrollSignalP" );
2101 
2103 
2105  DALI_TEST_CHECK( manager );
2106 
2108 
2110 
2111  TouchPoint point( 0, TouchPoint::Started, 100.0f, 200.0f );
2112  accessibilityAdaptor.HandleActionScrollEvent( point, 0u );
2113 
2114  DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
2115 
2116  const TouchEvent& signalTouchEvent = callback.GetTouchEvent();
2117  DALI_TEST_EQUALS( signalTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
2118 
2119  const TouchPoint& signalTouchPoint = signalTouchEvent.GetPoint( 0u );
2120 
2121  DALI_TEST_EQUALS( signalTouchPoint.state, TouchPoint::Started, TEST_LOCATION );
2122  DALI_TEST_EQUALS( signalTouchPoint.screen.x, 100.0f, TEST_LOCATION );
2123  DALI_TEST_EQUALS( signalTouchPoint.screen.y, 200.0f, TEST_LOCATION );
2124 
2125  END_TEST;
2126 }
2127 
2129 {
2130  ToolkitTestApplication application;
2131  tet_infoline( " UtcDaliAccessibilityManagerActionScrollSignalN" );
2132 
2134 
2136  DALI_TEST_CHECK( manager );
2137 
2139 
2140  DALI_TEST_EQUALS( callback.GetCalls(), 0u, TEST_LOCATION );
2141 
2142  END_TEST;
2143 }
Dali Docs Home
Read more about Dali