DALI_TEST_CHECK(Dali::Accessibility::TestStateChangedResult("showing", 1));
DALI_TEST_CHECK(Accessibility::Bridge::GetCurrentBridge()->GetDefaultLabel(rootAccessible) != buttonAccessible);
+ Dali::Accessibility::TestEnableSC(false);
+
+ END_TEST;
+}
+
+int UtcDaliGetAcessibleTestWithSceneConnection(void)
+{
+ ToolkitTestApplication application;
+
+ Dali::Accessibility::TestEnableSC(true);
+
+ auto layer = Layer::New();
+
+ auto control = Control::New();
+
+ std::weak_ptr<Accessibility::Accessible> layerAccessible = Accessibility::Accessible::GetOwningPtr(layer); // AdaptorAccessible
+ std::weak_ptr<Accessibility::Accessible> controlAccessible = Accessibility::Accessible::GetOwningPtr(control); // ControlAccessible
+ DALI_TEST_CHECK(layerAccessible.lock());
+ DALI_TEST_CHECK(controlAccessible.lock());
+
+ // Test Getting already added accessible from the map
+ DALI_TEST_CHECK(!layerAccessible.expired());
+ DALI_TEST_CHECK(!controlAccessible.expired());
+ DALI_TEST_CHECK(Accessibility::Accessible::Get(layer) == layerAccessible.lock().get());
+ DALI_TEST_CHECK(Accessibility::Accessible::Get(control) == controlAccessible.lock().get());
+
+ // Test ControlAccessible Removal
+ control.Reset();
+ DALI_TEST_CHECK(controlAccessible.expired());
+ DALI_TEST_CHECK(Accessibility::Accessible::Get(control) == nullptr);
+
+ // Test AdaptorAccessible Removal
+ layer.Reset();
+ DALI_TEST_CHECK(layerAccessible.expired());
+ DALI_TEST_CHECK(Accessibility::Accessible::Get(layer) == nullptr);
+
+ Dali::Accessibility::TestEnableSC(false);
+
END_TEST;
}
// Core needs to be initialized next before we start the adaptor
InitializeCore();
- Accessibility::Accessible::SetObjectRegistry(mCore->GetObjectRegistry());
// This will also emit the window created signals
AdaptorImpl::GetImpl(*mAdaptor).Start(mMainWindow);
mDispatchKeyEvents(true),
mProcessorRegistered(false)
{
- Accessibility::Accessible::RegisterExternalAccessibleGetter([](Dali::Actor actor) -> std::shared_ptr<Accessibility::Accessible> {
+ Accessibility::Accessible::RegisterExternalAccessibleGetter([](Dali::Actor actor) -> std::pair<std::shared_ptr<Accessibility::Accessible>, bool> {
auto control = Toolkit::Control::DownCast(actor);
if(!control)
{
- return nullptr;
+ return {nullptr, true};
}
auto& controlImpl = Toolkit::Internal::GetImplementation(control);
+ if(controlImpl.mImpl->IsCreateAccessibleEnabled())
+ {
+ return {std::shared_ptr<DevelControl::ControlAccessible>(controlImpl.CreateAccessibleObject()), true};
+ }
- return controlImpl.GetAccessibleObject();
+ return {nullptr, false};
});
mAccessibilityProps.states[DevelControl::AccessibilityState::ENABLED] = true;
}
std::shared_ptr<Toolkit::DevelControl::ControlAccessible> Control::Impl::GetAccessibleObject()
{
- if(mAccessibleCreatable && !mAccessibleObject)
- {
- mAccessibleObject.reset(mControlImpl.CreateAccessibleObject());
- }
-
- return mAccessibleObject;
+ return std::dynamic_pointer_cast<DevelControl::ControlAccessible>(Accessibility::Accessible::GetOwningPtr(mControlImpl.Self()));
}
bool Control::Impl::IsAccessibleCreated() const
{
- return !!mAccessibleObject;
+ return !!Accessibility::Bridge::GetCurrentBridge()->GetAccessible(mControlImpl.Self());
}
void Control::Impl::EnableCreateAccessible(bool enable)
bool mIsAccessibilityPropertySetSignalRegistered{false};
Dali::PropertyNotification mAccessibilityPositionNotification;
Dali::Accessibility::ScreenRelativeMoveType mAccessibilityLastScreenRelativeMoveType{Accessibility::ScreenRelativeMoveType::OUTSIDE};
-
- std::shared_ptr<Toolkit::DevelControl::ControlAccessible> mAccessibleObject;
};
} // namespace Internal