2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 // Need to override adaptor classes for toolkit test harness, so include
19 // test harness headers before dali headers.
20 #include <dali-toolkit-test-suite-utils.h>
23 #include <dali-toolkit/dali-toolkit.h>
25 #include <dali/devel-api/adaptor-framework/accessibility.h>
26 #include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
27 #include <dali/devel-api/atspi-interfaces/accessible.h>
29 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
31 void utc_dali_toolkit_accessibility_accessible_startup(void)
33 test_return_value = TET_UNDEF;
34 DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
37 void utc_dali_toolkit_accessibility_accessible_cleanup(void)
39 test_return_value = TET_PASS;
42 int utcDaliAccessibilityCheckBoxButtonGetStates(void)
44 ToolkitTestApplication application;
46 auto check_box_button = Toolkit::CheckBoxButton::New();
47 auto q = Dali::Accessibility::Accessible::Get( check_box_button );
49 auto states = q->GetStates();
50 DALI_TEST_EQUALS( (int) states[ Dali::Accessibility::State::SELECTABLE ], (int) true, TEST_LOCATION );
55 int utcDaliAccessibilityCheckLabelText(void)
57 ToolkitTestApplication application;
59 auto check_box_button = Toolkit::CheckBoxButton::New();
60 //check_box_button.SetLabelText( "button" );
61 check_box_button.SetProperty(Toolkit::Button::Property::LABEL, "button");
62 auto q = Dali::Accessibility::Accessible::Get( check_box_button );
64 DALI_TEST_EQUALS( q->GetName(), "button", TEST_LOCATION );
69 int UtcDaliAccessibilityCheckShowingState(void)
71 ToolkitTestApplication application;
73 auto parentButton = Toolkit::PushButton::New();
74 parentButton.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
75 parentButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
76 parentButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
77 parentButton.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f));
78 parentButton.SetProperty(Actor::Property::SIZE, Dali::Vector2(200.0f, 200.0f));
79 application.GetScene().Add( parentButton );
81 // Toatally inside of parent
82 auto buttonA = Toolkit::PushButton::New();
83 buttonA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
84 buttonA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
85 buttonA.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f));
86 buttonA.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f));
87 parentButton.Add(buttonA);
89 // Toatally outside of parent
90 auto buttonB = Toolkit::PushButton::New();
91 buttonB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
92 buttonB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
93 buttonB.SetProperty(Actor::Property::POSITION, Dali::Vector2(300.0f, 300.0f));
94 buttonB.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f));
95 parentButton.Add(buttonB);
97 // Partially inside of parent
98 auto buttonC = Toolkit::PushButton::New();
99 buttonC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
100 buttonC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
101 buttonC.SetProperty(Actor::Property::POSITION, Dali::Vector2(100.0f,100.0f));
102 buttonC.SetProperty(Actor::Property::SIZE, Dali::Vector2(200.0f, 200.0f));
103 parentButton.Add(buttonC);
105 application.SendNotification();
106 application.Render(16);
108 auto q = Dali::Accessibility::Accessible::Get(buttonA);
110 auto states = q->GetStates();
111 DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) true, TEST_LOCATION);
113 q = Dali::Accessibility::Accessible::Get(buttonB);
115 states = q->GetStates();
116 DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION);
118 q = Dali::Accessibility::Accessible::Get(buttonC);
120 states = q->GetStates();
121 DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) true, TEST_LOCATION);
123 // Make SHOWING object invisible
124 buttonC.SetProperty(Actor::Property::VISIBLE, false);
126 application.SendNotification();
127 application.Render(16);
129 states = q->GetStates();
130 DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION);
132 // Make SHOWING parent invisible
133 parentButton.SetProperty(Actor::Property::VISIBLE, false);
135 application.SendNotification();
136 application.Render(16);
138 q = Dali::Accessibility::Accessible::Get(buttonA);
140 states = q->GetStates();
141 DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION);