1 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.h>
2 #include <dali-toolkit-test-suite-utils.h>
3 #include <dali-toolkit/dali-toolkit.h>
5 #include <dali-toolkit/devel-api/controls/control-accessible.h>
6 #include <dali-toolkit/devel-api/controls/control-devel.h>
7 #include <dali-toolkit/devel-api/controls/table-view/table-view.h>
8 #include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
9 #include <dali/devel-api/atspi-interfaces/accessible.h>
10 #include <dali/devel-api/atspi-interfaces/action.h>
11 #include <dali/devel-api/atspi-interfaces/editable-text.h>
12 #include <dali/devel-api/atspi-interfaces/hyperlink.h>
13 #include <dali/devel-api/atspi-interfaces/hypertext.h>
14 #include <dali/devel-api/atspi-interfaces/text.h>
16 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
18 using namespace Dali::Toolkit;
20 void utc_dali_accessibility_controls_startup(void)
22 test_return_value = TET_UNDEF;
23 DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
26 void utc_dali_accessibility_controls_cleanup(void)
28 test_return_value = TET_PASS;
29 //DBusWrapper::Install({}) is a de-install
30 DBusWrapper::Install({});
33 int UtcDaliControlAccessibileGet01(void)
35 ToolkitTestApplication application;
37 auto control = Control::New();
38 auto accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(control));
39 DALI_TEST_CHECK(accessible);
44 int UtcDaliControlAccessibileGet02(void)
46 ToolkitTestApplication application;
48 auto control = Control::New();
51 DALI_TEST_EQUALS(DevelControl::IsCreateAccessibleEnabled(control), true, TEST_LOCATION);
52 DALI_TEST_EQUALS(DevelControl::IsAccessibleCreated(control), false, TEST_LOCATION);
54 DevelControl::EnableCreateAccessible(control, false);
55 DALI_TEST_EQUALS(DevelControl::IsCreateAccessibleEnabled(control), false, TEST_LOCATION);
56 auto accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(control));
58 // Check that we don't create accessible yet.
59 DALI_TEST_EQUALS(DevelControl::IsAccessibleCreated(control), false, TEST_LOCATION);
60 DALI_TEST_CHECK(!accessible);
62 DevelControl::EnableCreateAccessible(control, true);
63 DALI_TEST_EQUALS(DevelControl::IsCreateAccessibleEnabled(control), true, TEST_LOCATION);
64 accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(control));
65 DALI_TEST_EQUALS(DevelControl::IsAccessibleCreated(control), true, TEST_LOCATION);
66 DALI_TEST_CHECK(accessible);
68 DevelControl::EnableCreateAccessible(control, false);
69 DALI_TEST_EQUALS(DevelControl::IsCreateAccessibleEnabled(control), false, TEST_LOCATION);
70 accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(control));
72 // Check that we got created accessible well.
73 DALI_TEST_EQUALS(DevelControl::IsAccessibleCreated(control), true, TEST_LOCATION);
74 DALI_TEST_CHECK(accessible);
79 int UtcDaliControlAccessibileBlockAccessibleCreation(void)
81 ToolkitTestApplication application;
83 auto control = Control::New();
86 DALI_TEST_EQUALS(DevelControl::IsCreateAccessibleEnabled(control), true, TEST_LOCATION);
87 DALI_TEST_EQUALS(DevelControl::IsAccessibleCreated(control), false, TEST_LOCATION);
89 DevelControl::EnableCreateAccessible(control, false);
90 DALI_TEST_EQUALS(DevelControl::IsCreateAccessibleEnabled(control), false, TEST_LOCATION);
94 // Should not throw exception even if accessible is not created.
95 DALI_TEST_EQUALS(DevelControl::ClearAccessibilityHighlight(control), false, TEST_LOCATION);
96 DALI_TEST_EQUALS(DevelControl::GrabAccessibilityHighlight(control), false, TEST_LOCATION);
98 DevelControl::GetAccessibilityStates(control);
99 DevelControl::NotifyAccessibilityStateChange(control, Dali::Accessibility::States{}, false);
100 DevelControl::NotifyAccessibilityStateChange(control, Dali::Accessibility::States{}, true);
101 DALI_TEST_CHECK(true);
105 DALI_TEST_CHECK(false);
108 // Check that we don't create accessible yet.
109 DALI_TEST_EQUALS(DevelControl::IsAccessibleCreated(control), false, TEST_LOCATION);
111 // Dummy function call - for line coverage
112 DevelControl::EnableCreateAccessible(control, true);
113 DALI_TEST_EQUALS(DevelControl::IsCreateAccessibleEnabled(control), true, TEST_LOCATION);
114 DALI_TEST_EQUALS(DevelControl::IsAccessibleCreated(control), false, TEST_LOCATION);
118 // Should not throw exception even if accessible is not created.
119 DevelControl::ClearAccessibilityHighlight(control);
120 DevelControl::GrabAccessibilityHighlight(control);
121 DevelControl::GetAccessibilityStates(control);
122 DevelControl::NotifyAccessibilityStateChange(control, Dali::Accessibility::States{}, false);
123 DevelControl::NotifyAccessibilityStateChange(control, Dali::Accessibility::States{}, true);
124 DALI_TEST_CHECK(true);
128 DALI_TEST_CHECK(false);
134 int UtcDaliControlPropertyAccessibilityTranslationDomain(void)
136 ToolkitTestApplication application;
138 auto control = Control::New();
140 auto accessibility_translation_domain = DevelControl::Property::ACCESSIBILITY_TRANSLATION_DOMAIN;
141 DALI_TEST_EQUALS("", control.GetProperty<std::string>(accessibility_translation_domain), TEST_LOCATION);
143 control.SetProperty(accessibility_translation_domain, "translation_domain_test_1");
144 DALI_TEST_EQUALS("translation_domain_test_1", control.GetProperty(accessibility_translation_domain).Get<std::string>(), TEST_LOCATION);
146 control.SetProperty(accessibility_translation_domain, "translation_domain_test_2");
147 DALI_TEST_EQUALS("translation_domain_test_2", control.GetProperty(accessibility_translation_domain).Get<std::string>(), TEST_LOCATION);
152 // This test shows that when the accessibility bridge is
153 // not up, there is no possibility to grab or clear highlight
154 int UtcDaliControlAccessibilityHighlight(void)
156 ToolkitTestApplication application;
157 auto controla = Control::New();
158 auto controlb = Control::New();
160 DALI_TEST_EQUALS(false, DevelControl::GrabAccessibilityHighlight(controla), TEST_LOCATION);
161 DALI_TEST_EQUALS(false, DevelControl::GrabAccessibilityHighlight(controlb), TEST_LOCATION);
162 DALI_TEST_EQUALS(false, DevelControl::ClearAccessibilityHighlight(controla), TEST_LOCATION);
163 DALI_TEST_EQUALS(false, DevelControl::ClearAccessibilityHighlight(controlb), TEST_LOCATION);
168 #include <dali-toolkit/devel-api/controls/tool-bar/tool-bar.h>
169 int UtcDaliAccessibilityToolBarConstructor(void)
171 ToolkitTestApplication application;
173 auto toolbar = ToolBar::New();
174 DALI_TEST_CHECK(toolbar);
176 auto accessible = Dali::Accessibility::Accessible::Get(toolbar);
177 DALI_TEST_CHECK(accessible);
178 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::TOOL_BAR, TEST_LOCATION);
183 int UtcDaliAccessibilityPushButtonConstructor(void)
185 ToolkitTestApplication application;
187 auto pushbutton = PushButton::New();
188 DALI_TEST_CHECK(pushbutton);
190 auto accessible = Dali::Accessibility::Accessible::Get(pushbutton);
191 DALI_TEST_CHECK(accessible);
192 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::PUSH_BUTTON, TEST_LOCATION);
197 int UtcDaliAccessibilityPushButtonStates(void)
199 ToolkitTestApplication application;
201 auto pushbutton = PushButton::New();
202 DALI_TEST_CHECK(pushbutton);
204 auto accessible = Dali::Accessibility::Accessible::Get(pushbutton);
205 DALI_TEST_CHECK(accessible);
207 Dali::Accessibility::TestEnableSC(true);
209 /* add to scene and remove from scene to touch AccessibilityDeregister */
210 application.GetScene().Add(pushbutton);
212 auto states = accessible->GetStates();
213 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::PRESSED]), false, TEST_LOCATION);
215 // auto button = dynamic_cast<Dali::Toolkit::Button* >( accessible ) ;
216 pushbutton.SetProperty(Toolkit::Button::Property::TOGGLABLE, true);
217 pushbutton.SetProperty(Toolkit::Button::Property::SELECTED, true);
219 states = accessible->GetStates();
220 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::PRESSED]), true, TEST_LOCATION);
222 // Grab highlite now.
223 auto i = dynamic_cast<Dali::Accessibility::Component*>(accessible);
227 pushbutton.SetProperty(Toolkit::Button::Property::SELECTED, false);
229 states = accessible->GetStates();
230 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::PRESSED]), false, TEST_LOCATION);
232 /* add to scene and remove from scene to touch AccessibilityDeregister */
233 application.GetScene().Remove(pushbutton);
235 Dali::Accessibility::TestEnableSC(false);
240 #include <dali-toolkit/devel-api/controls/buttons/toggle-button.h>
241 int UtcDaliAccessibilityToggleButtonConstructor(void)
243 ToolkitTestApplication application;
245 auto togglebutton = ToggleButton::New();
246 DALI_TEST_CHECK(togglebutton);
248 auto accessible = Dali::Accessibility::Accessible::Get(togglebutton);
249 DALI_TEST_CHECK(accessible);
250 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::TOGGLE_BUTTON, TEST_LOCATION);
255 int UtcDaliAccessibilityToggleButtonStates(void)
257 ToolkitTestApplication application;
259 auto togglebutton = ToggleButton::New();
260 DALI_TEST_CHECK(togglebutton);
262 auto accessible = Dali::Accessibility::Accessible::Get(togglebutton);
263 DALI_TEST_CHECK(accessible);
265 Dali::Accessibility::TestEnableSC(true);
267 /* add to scene and remove from scene to touch AccessibilityDeregister */
268 application.GetScene().Add(togglebutton);
270 auto states = accessible->GetStates();
271 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), false, TEST_LOCATION);
273 // auto button = dynamic_cast<Dali::Toolkit::Button* >( accessible ) ;
274 togglebutton.SetProperty(Toolkit::Button::Property::TOGGLABLE, true);
275 togglebutton.SetProperty(Toolkit::Button::Property::SELECTED, true);
277 states = accessible->GetStates();
278 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), true, TEST_LOCATION);
280 // Grab highlite now.
281 auto i = dynamic_cast<Dali::Accessibility::Component*>(accessible);
285 togglebutton.SetProperty(Toolkit::Button::Property::SELECTED, false);
287 states = accessible->GetStates();
288 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), false, TEST_LOCATION);
290 /* add to scene and remove from scene to touch AccessibilityDeregister */
291 application.GetScene().Remove(togglebutton);
293 Dali::Accessibility::TestEnableSC(false);
300 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
301 int UtcDaliAccessibilityTextSelectionPopupConstructor(void)
303 ToolkitTestApplication application;
305 auto textselectionpopup = TextSelectionPopup::New(NULL);
306 DALI_TEST_CHECK(textselectionpopup);
308 auto accessible = Dali::Accessibility::Accessible::Get(textselectionpopup);
309 DALI_TEST_CHECK(accessible);
310 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::DIALOG, TEST_LOCATION);
315 int UtcDaliAccessibilityAlignmentConstructor(void)
317 ToolkitTestApplication application;
319 auto alignment = Alignment::New();
320 DALI_TEST_CHECK(alignment);
322 auto accessible = Dali::Accessibility::Accessible::Get(alignment);
323 DALI_TEST_CHECK(accessible);
324 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::FILLER, TEST_LOCATION);
329 int UtcDaliAccessibilityRadioButtonStates(void)
331 ToolkitTestApplication application;
333 auto radiobutton = RadioButton::New();
334 DALI_TEST_CHECK(radiobutton);
336 auto accessible = Dali::Accessibility::Accessible::Get(radiobutton);
337 DALI_TEST_CHECK(accessible);
339 Dali::Accessibility::TestEnableSC(true);
341 application.GetScene().Add(radiobutton);
343 auto states = accessible->GetStates();
344 DALI_TEST_CHECK(states);
345 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), false, TEST_LOCATION);
346 radiobutton.SetProperty(Toolkit::RadioButton::Property::SELECTED, true);
347 states = accessible->GetStates();
348 DALI_TEST_CHECK(states);
349 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), true, TEST_LOCATION);
351 // Grab highlite now.
352 auto i = dynamic_cast<Dali::Accessibility::Component*>(accessible);
356 radiobutton.SetProperty(Toolkit::RadioButton::Property::SELECTED, false);
357 states = accessible->GetStates();
358 DALI_TEST_CHECK(states);
359 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), false, TEST_LOCATION);
361 application.GetScene().Remove(radiobutton);
363 Dali::Accessibility::TestEnableSC(false);
368 int UtcDaliAccessibilityFlexContainerConstructor(void)
370 ToolkitTestApplication application;
372 auto flexcontainer = FlexContainer::New();
373 DALI_TEST_CHECK(flexcontainer);
375 auto accessible = Dali::Accessibility::Accessible::Get(flexcontainer);
376 DALI_TEST_CHECK(accessible);
377 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::FILLER, TEST_LOCATION);
382 int UtcDaliAccessibilityCheckBoxButton(void)
384 ToolkitTestApplication application;
386 auto checkboxbutton = CheckBoxButton::New();
387 DALI_TEST_CHECK(checkboxbutton);
389 auto accessible = Dali::Accessibility::Accessible::Get(checkboxbutton);
390 DALI_TEST_CHECK(accessible);
392 Dali::Accessibility::TestEnableSC(true);
394 application.GetScene().Add(checkboxbutton);
396 auto states = accessible->GetStates();
397 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), false, TEST_LOCATION);
398 checkboxbutton.SetProperty(Toolkit::CheckBoxButton::Property::SELECTED, true);
399 states = accessible->GetStates();
400 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), true, TEST_LOCATION);
402 // Grab highlite now.
403 auto i = dynamic_cast<Dali::Accessibility::Component*>(accessible);
407 checkboxbutton.SetProperty(Toolkit::CheckBoxButton::Property::SELECTED, false);
408 states = accessible->GetStates();
409 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::CHECKED]), false, TEST_LOCATION);
411 application.GetScene().Remove(checkboxbutton);
413 Dali::Accessibility::TestEnableSC(false);
418 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
419 int UtcDaliAccessibilityTextSelectionConstructor(void)
421 ToolkitTestApplication application;
423 auto textselectiontoolbar = TextSelectionToolbar::New();
424 DALI_TEST_CHECK(textselectiontoolbar);
426 auto accessible = Dali::Accessibility::Accessible::Get(textselectiontoolbar);
427 DALI_TEST_CHECK(accessible);
428 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::TOOL_BAR, TEST_LOCATION);
433 #include <dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h>
434 int UtcDaliAccessibilityManager(void)
436 using attr = Toolkit::AccessibilityManager::AccessibilityAttribute;
438 ToolkitTestApplication application;
440 Dali::Accessibility::TestEnableSC(true);
442 auto accessmanager = new Dali::Toolkit::Internal::AccessibilityManager;
443 auto actor = Control::New();
445 const std::string name = "Name";
446 const std::string descr = "Description";
448 accessmanager->SetAccessibilityAttribute(actor, attr::ACCESSIBILITY_LABEL, name);
449 DALI_TEST_EQUALS(accessmanager->GetAccessibilityAttribute(actor, attr::ACCESSIBILITY_LABEL), name, TEST_LOCATION);
450 DALI_TEST_EQUALS(actor.GetProperty<std::string>(DevelControl::Property::ACCESSIBILITY_NAME), name, TEST_LOCATION);
452 accessmanager->SetAccessibilityAttribute(actor, attr::ACCESSIBILITY_TRAIT, "Whatever");
453 DALI_TEST_EQUALS(accessmanager->GetAccessibilityAttribute(actor, attr::ACCESSIBILITY_TRAIT), "", TEST_LOCATION);
455 accessmanager->SetAccessibilityAttribute(actor, attr::ACCESSIBILITY_VALUE, "Whatever");
456 DALI_TEST_EQUALS(accessmanager->GetAccessibilityAttribute(actor, attr::ACCESSIBILITY_VALUE), "", TEST_LOCATION);
458 accessmanager->SetAccessibilityAttribute(actor, attr::ACCESSIBILITY_HINT, descr);
459 DALI_TEST_EQUALS(accessmanager->GetAccessibilityAttribute(actor, attr::ACCESSIBILITY_HINT), descr, TEST_LOCATION);
460 DALI_TEST_EQUALS(actor.GetProperty<std::string>(DevelControl::Property::ACCESSIBILITY_DESCRIPTION), descr, TEST_LOCATION);
462 DALI_TEST_EQUALS(accessmanager->GetFocusOrder(actor), 0, TEST_LOCATION);
463 DALI_TEST_EQUALS(accessmanager->GenerateNewFocusOrder(), 1, TEST_LOCATION);
465 accessmanager->SetFocusOrder({}, 0);
466 accessmanager->SetFocusOrder(Control::New(), 1);
467 accessmanager->SetFocusOrder(actor, 2);
468 accessmanager->SetFocusOrder(Control::New(), 3);
470 DALI_TEST_EQUALS(accessmanager->GetFocusOrder(actor), 2, TEST_LOCATION);
471 DALI_TEST_EQUALS(accessmanager->GetActorByFocusOrder(2), actor, TEST_LOCATION);
473 accessmanager->SetCurrentFocusActor(actor);
474 DALI_TEST_EQUALS(accessmanager->GetCurrentFocusActor(), actor, TEST_LOCATION);
475 DALI_TEST_EQUALS(accessmanager->GetCurrentFocusOrder(), 2, TEST_LOCATION);
477 accessmanager->MoveFocusForward();
478 accessmanager->MoveFocusBackward();
479 DALI_TEST_EQUALS(accessmanager->GetCurrentFocusActor(), actor, TEST_LOCATION);
480 accessmanager->SetCurrentFocusActor({});
482 accessmanager->Reset();
483 accessmanager->MoveFocusBackward();
484 accessmanager->MoveFocusForward();
486 accessmanager->GetCurrentFocusGroup();
487 DALI_TEST_EQUALS(accessmanager->IsFocusGroup(actor), false, TEST_LOCATION);
488 accessmanager->GetFocusGroup(actor);
490 DALI_TEST_EQUALS(accessmanager->GetGroupMode(), false, TEST_LOCATION);
491 DALI_TEST_EQUALS(accessmanager->GetWrapMode(), true, TEST_LOCATION);
493 auto vector = accessmanager->GetReadPosition();
494 DALI_TEST_EQUALS(vector.x, 0.0f, TEST_LOCATION);
495 DALI_TEST_EQUALS(vector.y, 0.0f, TEST_LOCATION);
497 accessmanager->SetFocusIndicatorActor(Dali::Actor{});
498 accessmanager->GetFocusIndicatorActor();
500 Dali::Accessibility::TestEnableSC(false);
505 int UtcDaliAccessibilityModel3dViewConstructor(void)
507 ToolkitTestApplication application;
509 auto model3dview = Model3dView::New();
510 DALI_TEST_CHECK(model3dview);
512 auto accessible = Dali::Accessibility::Accessible::Get(model3dview);
513 DALI_TEST_CHECK(accessible);
514 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::IMAGE, TEST_LOCATION);
519 #include <dali-toolkit/internal/controls/effects-view/effects-view-impl.h>
520 int UtcDaliAccessibilityEffectsViewConstructor(void)
522 ToolkitTestApplication application;
524 auto etype = Dali::Toolkit::EffectsView::EffectType::DROP_SHADOW;
525 auto effectsview = EffectsView::New(etype);
526 DALI_TEST_CHECK(effectsview);
528 auto accessible = Dali::Accessibility::Accessible::Get(effectsview);
529 DALI_TEST_CHECK(accessible);
530 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::FILLER, TEST_LOCATION);
535 #include <dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h>
536 int UtcDaliAccessibilitySuperBlurViewConstructor(void)
538 ToolkitTestApplication application;
540 auto superblurview = SuperBlurView::New(1);
541 DALI_TEST_CHECK(superblurview);
543 auto accessible = Dali::Accessibility::Accessible::Get(superblurview);
544 DALI_TEST_CHECK(accessible);
545 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::FILLER, TEST_LOCATION);
550 int UtcDaliAccessibilityImageViewConstructor(void)
552 ToolkitTestApplication application;
554 auto imageview = ImageView::New();
555 DALI_TEST_CHECK(imageview);
557 auto accessible = Dali::Accessibility::Accessible::Get(imageview);
558 DALI_TEST_CHECK(accessible);
559 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::IMAGE, TEST_LOCATION);
564 #include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
565 class TestPageFactory : public PageFactory
568 TestPageFactory(bool returnValidTexture = true)
569 : mValidTexture(returnValidTexture)
571 mTotalPageNumber = 100;
575 * Query the number of pages available from the factory.
576 * The maximum available page has an ID of GetNumberOfPages()-1.
578 virtual unsigned int GetNumberOfPages()
580 return mTotalPageNumber;
584 * Create an texture to represent a page content.
585 * @param[in] pageId The ID of the page to create.
586 * @return An image, or an empty handle if the ID is out of range.
588 virtual Texture NewPage(unsigned int pageId)
592 return Texture::New(Dali::TextureType::TEXTURE_2D, Pixel::RGB888, 100, 100);
594 return Texture(); // empty handle
598 unsigned int mTotalPageNumber;
602 #include <dali-toolkit/internal/controls/page-turn-view/page-turn-landscape-view-impl.h>
603 int UtcDaliAccessibilityPageTurnViewConstructor(void)
605 ToolkitTestApplication application;
607 auto testpagefactory = TestPageFactory();
608 auto vector2 = Vector2(1.0, 1.0);
609 auto pageturnlandscapeview = PageTurnLandscapeView::New(testpagefactory, vector2);
610 DALI_TEST_CHECK(pageturnlandscapeview);
612 auto accessible = Dali::Accessibility::Accessible::Get(pageturnlandscapeview);
613 DALI_TEST_CHECK(accessible);
614 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::PAGE_TAB_LIST, TEST_LOCATION);
619 int UtcDaliAccessibilityGaussianBlurViewConstructor(void)
621 ToolkitTestApplication application;
623 auto gaussianblurview = GaussianBlurView::New();
624 DALI_TEST_CHECK(gaussianblurview);
626 auto accessible = Dali::Accessibility::Accessible::Get(gaussianblurview);
627 DALI_TEST_CHECK(accessible);
628 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::FILLER, TEST_LOCATION);
633 int UtcDaliAccessibilityShadowViewConstructor(void)
635 ToolkitTestApplication application;
637 auto shadowview = ShadowView::New();
638 DALI_TEST_CHECK(shadowview);
640 auto accessible = Dali::Accessibility::Accessible::Get(shadowview);
641 DALI_TEST_CHECK(accessible);
642 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::FILLER, TEST_LOCATION);
647 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
648 #include <dali-toolkit/public-api/controls/control-impl.h>
649 int UtcDaliAccessibilityScrollableConstructor(void)
651 ToolkitTestApplication application;
653 auto scrollview = ScrollView::New();
654 DALI_TEST_CHECK(scrollview);
656 auto accessible = Dali::Accessibility::Accessible::Get(scrollview);
657 DALI_TEST_CHECK(accessible);
658 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::SCROLL_PANE, TEST_LOCATION);
663 #include <dali-toolkit/internal/controls/magnifier/magnifier-impl.h>
664 int UtcDaliAccessibilityMagnifierConstructor(void)
666 ToolkitTestApplication application;
668 auto magnifier = Magnifier::New();
669 DALI_TEST_CHECK(magnifier);
671 auto accessible = Dali::Accessibility::Accessible::Get(magnifier);
672 DALI_TEST_CHECK(accessible);
673 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::FILLER, TEST_LOCATION);
678 int UtcDaliAccessibilityTableViewConstructor(void)
680 ToolkitTestApplication application;
682 auto tableview = TableView::New(10, 10);
683 DALI_TEST_CHECK(tableview);
685 auto accessible = Dali::Accessibility::Accessible::Get(tableview);
686 DALI_TEST_CHECK(accessible);
687 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::TABLE, TEST_LOCATION);
692 #include <dali-toolkit/internal/controls/bloom-view/bloom-view-impl.h>
693 int UtcDaliAccessibilityBloomViewConstructor(void)
695 ToolkitTestApplication application;
697 auto bloomview = BloomView::New();
698 DALI_TEST_CHECK(bloomview);
700 auto accessible = Dali::Accessibility::Accessible::Get(bloomview);
701 DALI_TEST_CHECK(accessible);
702 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::ANIMATION, TEST_LOCATION);
707 #include <dali-toolkit/internal/controls/text-controls/text-anchor-impl.h>
708 #include <dali-toolkit/internal/controls/text-controls/text-field-impl.h>
709 int UtcDaliAccessibilityTextAnchor(void)
711 ToolkitTestApplication application;
713 auto textanchor = TextAnchor::New();
714 DALI_TEST_CHECK(textanchor);
716 auto textlabel = TextLabel::New();
717 DALI_TEST_CHECK(textlabel);
719 Dali::Accessibility::TestEnableSC(true);
721 textlabel.Add(textanchor);
722 auto accessible = Dali::Accessibility::Accessible::Get(textanchor);
723 DALI_TEST_CHECK(accessible);
724 auto hyperlink = dynamic_cast<Dali::Accessibility::Hyperlink*>(accessible);
725 DALI_TEST_CHECK(hyperlink);
726 textanchor.SetProperty(Toolkit::TextAnchor::Property::URI, "https://www.tizen.org");
727 DALI_TEST_EQUALS(hyperlink->IsValid(), true, TEST_LOCATION);
728 auto action = dynamic_cast<Dali::Accessibility::Action*>(accessible);
729 // activation of valid hyperlink
730 DALI_TEST_CHECK(action->DoAction("accessibilityActivated"));
731 // making hyperlink invalid
732 textanchor.SetProperty(Toolkit::TextAnchor::Property::URI, "");
733 DALI_TEST_EQUALS(hyperlink->IsValid(), false, TEST_LOCATION);
734 DALI_TEST_CHECK(!action->DoAction("accessibilityActivated"));
736 Dali::Accessibility::TestEnableSC(false);
741 int UtcDaliAccessibilityTextField(void)
743 ToolkitTestApplication application;
745 auto textfield = TextField::New();
746 DALI_TEST_CHECK(textfield);
748 textfield.SetProperty(Actor::Property::NAME, "test");
749 DALI_TEST_EQUALS(textfield.GetProperty<std::string>(Actor::Property::NAME), "test", TEST_LOCATION);
751 auto accessible = Dali::Accessibility::Accessible::Get(textfield);
752 DALI_TEST_CHECK(accessible);
754 DALI_TEST_EQUALS(accessible->GetName(), "", TEST_LOCATION);
755 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::ENTRY, TEST_LOCATION);
756 auto states = accessible->GetStates();
757 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::EDITABLE]), true, TEST_LOCATION);
759 Dali::Accessibility::TestEnableSC(true);
761 textfield.SetProperty(Toolkit::TextField::Property::TEXT, "test");
762 auto text = dynamic_cast<Dali::Accessibility::Text*>(accessible);
763 DALI_TEST_CHECK(text);
764 DALI_TEST_EQUALS(text->GetText(0, 10), "", TEST_LOCATION);
765 DALI_TEST_EQUALS(text->SetCursorOffset(100), false, TEST_LOCATION);
766 DALI_TEST_EQUALS(text->SetCursorOffset(2), true, TEST_LOCATION);
767 DALI_TEST_EQUALS(text->GetCursorOffset(), 2, TEST_LOCATION);
769 auto editabletext = dynamic_cast<Dali::Accessibility::EditableText*>(accessible);
770 DALI_TEST_CHECK(editabletext);
771 DALI_TEST_EQUALS(editabletext->CopyText(3, 1), false, TEST_LOCATION);
772 DALI_TEST_EQUALS(editabletext->CopyText(1, 3), true, TEST_LOCATION);
773 DALI_TEST_EQUALS(editabletext->CutText(3, 1), false, TEST_LOCATION);
774 DALI_TEST_EQUALS(editabletext->CutText(1, 3), true, TEST_LOCATION);
775 DALI_TEST_EQUALS(text->GetText(0, 1), "t", TEST_LOCATION);
777 auto range = text->GetRangeOfSelection(1);
778 DALI_TEST_EQUALS(range.startOffset, 0, TEST_LOCATION);
779 DALI_TEST_EQUALS(range.endOffset, 0, TEST_LOCATION);
780 DALI_TEST_EQUALS(range.content, "", TEST_LOCATION);
781 DALI_TEST_EQUALS(text->SetRangeOfSelection(1, 0, 1), false, TEST_LOCATION);
782 DALI_TEST_EQUALS(text->RemoveSelection(1), false, TEST_LOCATION);
784 // Insert into empty field
785 DALI_TEST_EQUALS(editabletext->SetTextContents(""), true, TEST_LOCATION);
786 DALI_TEST_EQUALS(editabletext->InsertText(1, "xyz"), false, TEST_LOCATION);
787 DALI_TEST_EQUALS(editabletext->InsertText(0, "abc"), true, TEST_LOCATION);
788 DALI_TEST_EQUALS(text->GetText(0, 3), "abc", TEST_LOCATION);
791 DALI_TEST_EQUALS(editabletext->InsertText(3, "xyz"), true, TEST_LOCATION);
792 DALI_TEST_EQUALS(text->GetText(0, 6), "abcxyz", TEST_LOCATION);
794 DALI_TEST_EQUALS(editabletext->SetTextContents("adef"), true, TEST_LOCATION);
795 DALI_TEST_EQUALS(editabletext->InsertText(1, "bc"), true, TEST_LOCATION);
796 DALI_TEST_EQUALS(text->GetText(0, 6), "abcdef", TEST_LOCATION);
797 DALI_TEST_EQUALS(editabletext->DeleteText(5, 1), false, TEST_LOCATION);
798 DALI_TEST_EQUALS(editabletext->DeleteText(1, 5), true, TEST_LOCATION);
799 DALI_TEST_EQUALS(text->GetText(0, 2), "af", TEST_LOCATION);
801 auto hypertext = dynamic_cast<Dali::Accessibility::Hypertext*>(accessible);
802 DALI_TEST_CHECK(hypertext);
803 // text without the anchors markup and ENABLE_MARKUP property set (by default) to false
804 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 0, TEST_LOCATION);
805 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
806 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
807 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), -1, TEST_LOCATION);
808 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
809 DALI_TEST_EQUALS(hypertext->GetLink(0) == nullptr, true, TEST_LOCATION);
810 DALI_TEST_EQUALS(hypertext->GetLink(5) == nullptr, true, TEST_LOCATION);
811 // text with the anchors markup and ENABLE_MARKUP property set (by default) to false
812 textfield.SetProperty(Toolkit::TextField::Property::TEXT, "12345<a href = 'https://www.tizen.org'>anchor1</a>12345<a href = 'https://www.tizen.org' >veryveryveryveryveryveryveryverylonganchor2</a>12345<a href = 'https://www.tizen.org'>anchor3</a>12345");
813 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 0, TEST_LOCATION);
814 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
815 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
816 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), -1, TEST_LOCATION);
817 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
818 DALI_TEST_EQUALS(hypertext->GetLink(0) == nullptr, true, TEST_LOCATION);
819 DALI_TEST_EQUALS(hypertext->GetLink(5) == nullptr, true, TEST_LOCATION);
820 // text with the anchors markup and ENABLE_MARKUP property set to true
821 textfield.SetProperty(Toolkit::TextField::Property::ENABLE_MARKUP, true);
822 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 3, TEST_LOCATION);
823 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
824 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
825 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), 0, TEST_LOCATION); //1st anchor index
826 DALI_TEST_EQUALS(hypertext->GetLinkIndex(17), 1, TEST_LOCATION); //2nd anchor index
827 DALI_TEST_EQUALS(hypertext->GetLinkIndex(66), 2, TEST_LOCATION); //3rd anchor index
828 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
829 auto hyperlink = hypertext->GetLink(0);
830 DALI_TEST_CHECK(hyperlink);
831 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 5, TEST_LOCATION);
832 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 12, TEST_LOCATION);
833 DALI_TEST_EQUALS(hyperlink->GetAnchorCount(), 1, TEST_LOCATION);
834 DALI_TEST_EQUALS(hyperlink->GetAnchorUri(0), "https://www.tizen.org", TEST_LOCATION);
835 auto anchorAccessible = hyperlink->GetAnchorAccessible(0);
836 DALI_TEST_EQUALS(hyperlink == anchorAccessible, true, TEST_LOCATION);
837 hyperlink = hypertext->GetLink(1);
838 DALI_TEST_CHECK(hyperlink);
839 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 17, TEST_LOCATION);
840 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 60, TEST_LOCATION);
841 hyperlink = hypertext->GetLink(2);
842 DALI_TEST_CHECK(hyperlink);
843 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 65, TEST_LOCATION);
844 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 72, TEST_LOCATION);
846 Dali::Accessibility::TestEnableSC(false);
851 #include <dali-toolkit/internal/controls/text-controls/text-editor-impl.h>
852 int UtcDaliAccessibilityTextEditor(void)
854 ToolkitTestApplication application;
856 auto texteditor = TextEditor::New();
857 DALI_TEST_CHECK(texteditor);
859 texteditor.SetProperty(Actor::Property::NAME, "test");
860 DALI_TEST_EQUALS(texteditor.GetProperty<std::string>(Actor::Property::NAME), "test", TEST_LOCATION);
862 auto accessible = Dali::Accessibility::Accessible::Get(texteditor);
863 DALI_TEST_CHECK(accessible);
865 DALI_TEST_EQUALS(accessible->GetName(), "", TEST_LOCATION);
866 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::ENTRY, TEST_LOCATION);
867 auto states = accessible->GetStates();
868 DALI_TEST_EQUALS(static_cast<unsigned int>(states[Accessibility::State::EDITABLE]), true, TEST_LOCATION);
870 Dali::Accessibility::TestEnableSC(true);
872 texteditor.SetProperty(Toolkit::TextEditor::Property::TEXT, "test");
873 auto text = dynamic_cast<Dali::Accessibility::Text*>(accessible);
874 DALI_TEST_CHECK(text);
875 DALI_TEST_EQUALS(text->GetText(0, 10), "", TEST_LOCATION);
876 DALI_TEST_EQUALS(text->SetCursorOffset(100), false, TEST_LOCATION);
877 DALI_TEST_EQUALS(text->SetCursorOffset(2), true, TEST_LOCATION);
878 DALI_TEST_EQUALS(text->GetCursorOffset(), 2, TEST_LOCATION);
880 auto editabletext = dynamic_cast<Dali::Accessibility::EditableText*>(accessible);
881 DALI_TEST_CHECK(editabletext);
882 DALI_TEST_EQUALS(editabletext->CopyText(3, 1), false, TEST_LOCATION);
883 DALI_TEST_EQUALS(editabletext->CopyText(1, 3), true, TEST_LOCATION);
884 DALI_TEST_EQUALS(editabletext->CutText(3, 1), false, TEST_LOCATION);
885 DALI_TEST_EQUALS(editabletext->CutText(1, 3), true, TEST_LOCATION);
886 DALI_TEST_EQUALS(text->GetText(0, 1), "t", TEST_LOCATION);
888 auto range = text->GetRangeOfSelection(1);
889 DALI_TEST_EQUALS(range.startOffset, 0, TEST_LOCATION);
890 DALI_TEST_EQUALS(range.endOffset, 0, TEST_LOCATION);
891 DALI_TEST_EQUALS(range.content, "", TEST_LOCATION);
892 DALI_TEST_EQUALS(text->SetRangeOfSelection(1, 0, 1), false, TEST_LOCATION);
893 DALI_TEST_EQUALS(text->RemoveSelection(1), false, TEST_LOCATION);
895 // Insert into empty field
896 DALI_TEST_EQUALS(editabletext->SetTextContents(""), true, TEST_LOCATION);
897 DALI_TEST_EQUALS(editabletext->InsertText(1, "xyz"), false, TEST_LOCATION);
898 DALI_TEST_EQUALS(editabletext->InsertText(0, "abc"), true, TEST_LOCATION);
899 DALI_TEST_EQUALS(text->GetText(0, 3), "abc", TEST_LOCATION);
902 DALI_TEST_EQUALS(editabletext->InsertText(3, "xyz"), true, TEST_LOCATION);
903 DALI_TEST_EQUALS(text->GetText(0, 6), "abcxyz", TEST_LOCATION);
905 DALI_TEST_EQUALS(editabletext->SetTextContents("adef"), true, TEST_LOCATION);
906 DALI_TEST_EQUALS(editabletext->InsertText(1, "bc"), true, TEST_LOCATION);
907 DALI_TEST_EQUALS(text->GetText(0, 6), "abcdef", TEST_LOCATION);
908 DALI_TEST_EQUALS(editabletext->DeleteText(5, 1), false, TEST_LOCATION);
909 DALI_TEST_EQUALS(editabletext->DeleteText(1, 5), true, TEST_LOCATION);
910 DALI_TEST_EQUALS(text->GetText(0, 2), "af", TEST_LOCATION);
912 auto hypertext = dynamic_cast<Dali::Accessibility::Hypertext*>(accessible);
913 DALI_TEST_CHECK(hypertext);
914 // text without the anchors markup and ENABLE_MARKUP property set (by default) to false
915 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 0, TEST_LOCATION);
916 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
917 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
918 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), -1, TEST_LOCATION);
919 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
920 DALI_TEST_EQUALS(hypertext->GetLink(0) == nullptr, true, TEST_LOCATION);
921 DALI_TEST_EQUALS(hypertext->GetLink(5) == nullptr, true, TEST_LOCATION);
922 // text with the anchors markup and ENABLE_MARKUP property set (by default) to false
923 texteditor.SetProperty(Toolkit::TextEditor::Property::TEXT, "12345<a href = 'https://www.tizen.org'>anchor1</a>12345<a href = 'https://www.tizen.org' >veryveryveryveryveryveryveryverylonganchor2</a>12345<a href = 'https://www.tizen.org'>anchor3</a>12345");
924 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 0, TEST_LOCATION);
925 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
926 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
927 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), -1, TEST_LOCATION);
928 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
929 DALI_TEST_EQUALS(hypertext->GetLink(0) == nullptr, true, TEST_LOCATION);
930 DALI_TEST_EQUALS(hypertext->GetLink(5) == nullptr, true, TEST_LOCATION);
931 // text with the anchors markup and ENABLE_MARKUP property set to true
932 texteditor.SetProperty(Toolkit::TextEditor::Property::ENABLE_MARKUP, true);
933 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 3, TEST_LOCATION);
934 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
935 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
936 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), 0, TEST_LOCATION); //1st anchor index
937 DALI_TEST_EQUALS(hypertext->GetLinkIndex(17), 1, TEST_LOCATION); //2nd anchor index
938 DALI_TEST_EQUALS(hypertext->GetLinkIndex(66), 2, TEST_LOCATION); //3rd anchor index
939 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
940 auto hyperlink = hypertext->GetLink(0);
941 DALI_TEST_CHECK(hyperlink);
942 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 5, TEST_LOCATION);
943 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 12, TEST_LOCATION);
944 DALI_TEST_EQUALS(hyperlink->GetAnchorCount(), 1, TEST_LOCATION);
945 DALI_TEST_EQUALS(hyperlink->GetAnchorUri(0), "https://www.tizen.org", TEST_LOCATION);
946 auto anchorAccessible = hyperlink->GetAnchorAccessible(0);
947 DALI_TEST_EQUALS(hyperlink == anchorAccessible, true, TEST_LOCATION);
948 hyperlink = hypertext->GetLink(1);
949 DALI_TEST_CHECK(hyperlink);
950 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 17, TEST_LOCATION);
951 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 60, TEST_LOCATION);
952 hyperlink = hypertext->GetLink(2);
953 DALI_TEST_CHECK(hyperlink);
954 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 65, TEST_LOCATION);
955 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 72, TEST_LOCATION);
957 Dali::Accessibility::TestEnableSC(false);
962 int UtcDaliAccessibilityTextLabel(void)
964 ToolkitTestApplication application;
966 auto textlabel = TextLabel::New();
967 DALI_TEST_CHECK(textlabel);
969 textlabel.SetProperty(Actor::Property::NAME, "test");
970 DALI_TEST_EQUALS(textlabel.GetProperty<std::string>(Actor::Property::NAME), "test", TEST_LOCATION);
972 auto accessible = Dali::Accessibility::Accessible::Get(textlabel);
973 DALI_TEST_CHECK(accessible);
975 DALI_TEST_EQUALS(accessible->GetName(), "test", TEST_LOCATION);
976 DALI_TEST_EQUALS(accessible->GetRole(), Accessibility::Role::LABEL, TEST_LOCATION);
978 Dali::Accessibility::TestEnableSC(true);
980 textlabel.SetProperty(Toolkit::TextLabel::Property::TEXT, "test");
981 auto text = dynamic_cast<Dali::Accessibility::Text*>(accessible);
982 DALI_TEST_CHECK(text);
983 DALI_TEST_EQUALS(text->GetText(0, 10), "", TEST_LOCATION);
984 DALI_TEST_EQUALS(text->GetText(0, 4), "test", TEST_LOCATION);
985 DALI_TEST_EQUALS(text->SetCursorOffset(0), false, TEST_LOCATION);
986 DALI_TEST_EQUALS(text->GetCursorOffset(), 0, TEST_LOCATION);
988 auto range = text->GetRangeOfSelection(1);
989 DALI_TEST_EQUALS(range.startOffset, 0, TEST_LOCATION);
990 DALI_TEST_EQUALS(range.endOffset, 0, TEST_LOCATION);
991 DALI_TEST_EQUALS(range.content, "", TEST_LOCATION);
992 DALI_TEST_EQUALS(text->SetRangeOfSelection(1, 0, 1), false, TEST_LOCATION);
993 DALI_TEST_EQUALS(text->RemoveSelection(1), false, TEST_LOCATION);
995 auto hypertext = dynamic_cast<Dali::Accessibility::Hypertext*>(accessible);
996 DALI_TEST_CHECK(hypertext);
997 // text without the anchors markup and ENABLE_MARKUP property set (by default) to false
998 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 0, TEST_LOCATION);
999 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
1000 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
1001 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), -1, TEST_LOCATION);
1002 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
1003 DALI_TEST_EQUALS(hypertext->GetLink(0) == nullptr, true, TEST_LOCATION);
1004 DALI_TEST_EQUALS(hypertext->GetLink(5) == nullptr, true, TEST_LOCATION);
1005 // text with the anchors markup and ENABLE_MARKUP property set (by default) to false
1006 textlabel.SetProperty(Toolkit::TextLabel::Property::TEXT, "12345<a href = 'https://www.tizen.org'>anchor1</a>12345<a href = 'https://www.tizen.org' >veryveryveryveryveryveryveryverylonganchor2</a>12345<a href = 'https://www.tizen.org'>anchor3</a>12345");
1007 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 0, TEST_LOCATION);
1008 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
1009 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
1010 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), -1, TEST_LOCATION);
1011 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
1012 DALI_TEST_EQUALS(hypertext->GetLink(0) == nullptr, true, TEST_LOCATION);
1013 DALI_TEST_EQUALS(hypertext->GetLink(5) == nullptr, true, TEST_LOCATION);
1014 // text with the anchors markup and ENABLE_MARKUP property set to true
1015 textlabel.SetProperty(Toolkit::TextLabel::Property::ENABLE_MARKUP, true);
1016 DALI_TEST_EQUALS(hypertext->GetLinkCount(), 3, TEST_LOCATION);
1017 DALI_TEST_EQUALS(hypertext->GetLinkIndex(-1), -1, TEST_LOCATION);
1018 DALI_TEST_EQUALS(hypertext->GetLinkIndex(0), -1, TEST_LOCATION);
1019 DALI_TEST_EQUALS(hypertext->GetLinkIndex(5), 0, TEST_LOCATION); //1st anchor index
1020 DALI_TEST_EQUALS(hypertext->GetLinkIndex(17), 1, TEST_LOCATION); //2nd anchor index
1021 DALI_TEST_EQUALS(hypertext->GetLinkIndex(66), 2, TEST_LOCATION); //3rd anchor index
1022 DALI_TEST_EQUALS(hypertext->GetLink(-1) == nullptr, true, TEST_LOCATION);
1023 auto hyperlink = hypertext->GetLink(0);
1024 DALI_TEST_CHECK(hyperlink);
1025 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 5, TEST_LOCATION);
1026 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 12, TEST_LOCATION);
1027 DALI_TEST_EQUALS(hyperlink->GetAnchorCount(), 1, TEST_LOCATION);
1028 DALI_TEST_EQUALS(hyperlink->GetAnchorUri(0), "https://www.tizen.org", TEST_LOCATION);
1029 auto anchorAccessible = hyperlink->GetAnchorAccessible(0);
1030 DALI_TEST_EQUALS(hyperlink == anchorAccessible, true, TEST_LOCATION);
1031 hyperlink = hypertext->GetLink(1);
1032 DALI_TEST_CHECK(hyperlink);
1033 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 17, TEST_LOCATION);
1034 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 60, TEST_LOCATION);
1035 hyperlink = hypertext->GetLink(2);
1036 DALI_TEST_CHECK(hyperlink);
1037 DALI_TEST_EQUALS(hyperlink->GetStartIndex(), 65, TEST_LOCATION);
1038 DALI_TEST_EQUALS(hyperlink->GetEndIndex(), 72, TEST_LOCATION);
1040 Dali::Accessibility::TestEnableSC(false);
1045 #include <dali-toolkit/internal/controls/navigation-view/navigation-view-impl.h>
1046 int UtcDaliAccessibilityNavigationViewConstructor(void)
1048 ToolkitTestApplication application;
1050 auto navigationview = NavigationView::New();
1051 DALI_TEST_CHECK(navigationview);
1053 auto accessible = Dali::Accessibility::Accessible::Get(navigationview);
1054 DALI_TEST_CHECK(accessible);
1056 DALI_TEST_EQUALS(accessible->GetRole(), Dali::Accessibility::Role::FILLER, TEST_LOCATION);
1061 int UtcDaliAccessibilityVideoViewConstructor(void)
1063 ToolkitTestApplication application;
1065 auto videoview = VideoView::New();
1066 DALI_TEST_CHECK(videoview);
1068 auto accessible = Dali::Accessibility::Accessible::Get(videoview);
1069 DALI_TEST_CHECK(accessible);
1071 DALI_TEST_EQUALS(accessible->GetRole(), Dali::Accessibility::Role::VIDEO, TEST_LOCATION);