From: Hosang Kim Date: Thu, 1 Feb 2024 08:03:00 +0000 (+0900) Subject: Aurum: Introduce description property X-Git-Tag: accepted/tizen/unified/20240216.161327~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a54dd55b4ce58bdcd1b7048341076edc8a45022;p=platform%2Fcore%2Fuifw%2Faurum.git Aurum: Introduce description property Some widget use description property for subtext. Change-Id: Ie7504bba3afdd5d0571ee304eb23d23ba81433c0 --- diff --git a/libaurum/inc/Accessibility/AccessibleNode.h b/libaurum/inc/Accessibility/AccessibleNode.h index 88a04a0..3dcc22f 100644 --- a/libaurum/inc/Accessibility/AccessibleNode.h +++ b/libaurum/inc/Accessibility/AccessibleNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -327,6 +327,11 @@ public: std::string getInterface() const; /** + * @copydoc UiObject::getDescription() + */ + std::string getDescription() const; + + /** * @copydoc UiObject::isCheckable() */ bool isCheckable() const; @@ -580,6 +585,7 @@ protected: std::string mXPath; std::string mToolkitName; std::string mInterface; + std::string mDescription; Rect mScreenBoundingBox; Rect mWindowBoundingBox; Rect mTextMinBoundingRect; diff --git a/libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h b/libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h index eb78152..43d20f6 100644 --- a/libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h +++ b/libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/libaurum/inc/Impl/Accessibility/AtspiWrapper.h b/libaurum/inc/Impl/Accessibility/AtspiWrapper.h index e7901c4..6e84b2a 100644 --- a/libaurum/inc/Impl/Accessibility/AtspiWrapper.h +++ b/libaurum/inc/Impl/Accessibility/AtspiWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ public: static GArray *Atspi_accessible_get_children(AtspiAccessible *node, GError **error); static AtspiAccessible *Atspi_accessible_get_child_at_index(AtspiAccessible *node, int index, GError **error); static AtspiAccessible *Atspi_accessible_get_parent(AtspiAccessible *node, GError **error); + static gchar *Atspi_accessible_get_description(AtspiAccessible *node, GError **error); static AtspiStateSet *Atspi_accessible_get_state_set(AtspiAccessible *node); static gboolean Atspi_state_set_contains(AtspiStateSet *set , AtspiStateType state); static gchar *Atspi_accessible_get_role_name(AtspiAccessible *node, GError **error); diff --git a/libaurum/inc/UiObject.h b/libaurum/inc/UiObject.h index 187d48e..f9904bd 100644 --- a/libaurum/inc/UiObject.h +++ b/libaurum/inc/UiObject.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -482,6 +482,15 @@ public: bool setValue(double value); /** + * @brief Gets object's description. + * + * @return string + * + * @since_tizen 7.0 + */ + std::string getDescription() const; + + /** * @brief Gets object's checkable property. * * @return true if checkable else false diff --git a/libaurum/inc/UiSelector.h b/libaurum/inc/UiSelector.h index 4d2a129..24519dc 100644 --- a/libaurum/inc/UiSelector.h +++ b/libaurum/inc/UiSelector.h @@ -393,6 +393,17 @@ public: */ UiSelector *geometry(Rect geometry, bool isEqual); + /** + * @brief Sets the search criteria to match the object's description. + * + * @param[in] description object description + * + * @return UiSelector class instance + * + * @since_tizen 7.0 + */ + UiSelector *description(std::string description); + public: std::string mId; std::string mAutomationId; @@ -404,6 +415,7 @@ public: std::string mTextPartialMatch; std::string mXPath; std::string mOcrText; + std::string mDescription; bool mMatchId; bool mMatchAutomationId; @@ -416,6 +428,7 @@ public: bool mMatchXPath; bool mMatchOcrText; bool mMatchGeometry; + bool mMatchDescription; bool mMatchChecked; bool mMatchCheckable; diff --git a/libaurum/src/Accessibility/AccessibleNode.cc b/libaurum/src/Accessibility/AccessibleNode.cc index e2d0539..d84643e 100644 --- a/libaurum/src/Accessibility/AccessibleNode.cc +++ b/libaurum/src/Accessibility/AccessibleNode.cc @@ -56,8 +56,8 @@ AccessibleNode::~AccessibleNode() } AccessibleNode::AccessibleNode() -: mText{""}, mOcrText{""}, mPkg{""}, mRole{""}, mId{""}, mAutomationId{""}, mType{""}, mStyle{""}, mXPath{""}, mToolkitName{""}, - mScreenBoundingBox{0,0,0,0}, mWindowBoundingBox{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0), mPid(0), mWindowAngle(0), mTargetAngle(0), mMinValue{0.0}, mMaxValue{0.0}, mValue{0.0}, mIncrement{0.0}, mValid{true}, mLock{} +: mText{""}, mOcrText{""}, mPkg{""}, mRole{""}, mId{""}, mAutomationId{""}, mType{""}, mStyle{""}, mXPath{""}, mToolkitName{""}, mInterface{""}, mDescription{""}, + mScreenBoundingBox{0,0,0,0}, mWindowBoundingBox{0,0,0,0}, mTextMinBoundingRect{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0), mPid(0), mWindowAngle(0), mTargetAngle(0), mMinValue{0.0}, mMaxValue{0.0}, mValue{0.0}, mIncrement{0.0}, mValid{true}, mLock{} { } @@ -69,6 +69,7 @@ std::string AccessibleNode::description() { ss << "\"mAutomationId\":\"" << this->mAutomationId << "\", "; ss << "\"mRole\":\"" << this->mRole << "\", "; ss << "\"mText\":\"" << this->mText << "\", "; + ss << "\"mDescription\":\"" << this->mDescription << "\", "; ss << "\"mOcrText\":\"" << this->mOcrText << "\", "; ss << "\"mPkg\":\"" << this->mPkg << "\", "; ss << "\"mType\":\"" << this->mType << "\", "; @@ -233,6 +234,11 @@ std::string AccessibleNode::getInterface() const return mInterface; } +std::string AccessibleNode::getDescription() const +{ + return mDescription; +} + bool AccessibleNode::isCheckable() const { return hasFeatureProperty(NodeFeatureProperties::CHECKABLE); @@ -331,4 +337,4 @@ int AccessibleNode::getPid() const Rect AccessibleNode::getTextMinBoundingRect() const { return mTextMinBoundingRect; -} \ No newline at end of file +} diff --git a/libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc b/libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc index 2c2180b..7f45da2 100644 --- a/libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc +++ b/libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc @@ -151,6 +151,12 @@ void AtspiAccessibleNode::updateName() mText = name; g_free(name); } + + gchar *description = AtspiWrapper::Atspi_accessible_get_description(mNode, NULL); + if (description) { + mDescription = description; + g_free(description); + } } void AtspiAccessibleNode::updateToolkitName() diff --git a/libaurum/src/Impl/Accessibility/AtspiWrapper.cc b/libaurum/src/Impl/Accessibility/AtspiWrapper.cc index 33c1832..f18867d 100644 --- a/libaurum/src/Impl/Accessibility/AtspiWrapper.cc +++ b/libaurum/src/Impl/Accessibility/AtspiWrapper.cc @@ -69,6 +69,12 @@ AtspiAccessible *AtspiWrapper::Atspi_accessible_get_parent(AtspiAccessible *node return atspi_accessible_get_parent(node, error); } +gchar *AtspiWrapper::Atspi_accessible_get_description(AtspiAccessible *node, GError **error) +{ + std::unique_lock lock(mMutex); + return atspi_accessible_get_description(node, error); +} + AtspiStateSet *AtspiWrapper::Atspi_accessible_get_state_set(AtspiAccessible *node) { std::unique_lock lock(mMutex); diff --git a/libaurum/src/PartialMatch.cc b/libaurum/src/PartialMatch.cc index a18726b..defed5a 100644 --- a/libaurum/src/PartialMatch.cc +++ b/libaurum/src/PartialMatch.cc @@ -92,6 +92,10 @@ bool PartialMatch::checkCriteria(const std::shared_ptr selector, node->updateExtents(); if (checkCriteria(selector->mGeometry, node->getScreenBoundingBox(), selector->mGeometryIsEqual)) return false; } + if (selector->mMatchDescription) { + node->updateName(); + if (checkCriteria(selector->mDescription, node->getDescription(), 0)) return false; + } if (selector->mMatchChecked && checkCriteria(selector->mIschecked, node->isChecked())) return false; if (selector->mMatchCheckable && checkCriteria(selector->mIscheckable, node->isCheckable())) return false; if (selector->mMatchClickable && checkCriteria(selector->mIsclickable, node->isClickable())) return false; diff --git a/libaurum/src/UiObject.cc b/libaurum/src/UiObject.cc index 8ef6b00..4b200c2 100644 --- a/libaurum/src/UiObject.cc +++ b/libaurum/src/UiObject.cc @@ -261,6 +261,11 @@ std::string UiObject::getInterface() const return mNode->getInterface(); } +std::string UiObject::getDescription() const +{ + return mNode->getDescription(); +} + bool UiObject::setValue(double value) { return mNode->setValue(value); diff --git a/libaurum/src/UiSelector.cc b/libaurum/src/UiSelector.cc index 8002fc2..15e708f 100644 --- a/libaurum/src/UiSelector.cc +++ b/libaurum/src/UiSelector.cc @@ -22,9 +22,9 @@ using namespace Aurum; UiSelector::UiSelector() -: mId{}, mAutomationId{}, mRole{}, mText{}, mPkg{}, mType{}, mStyle{}, mTextPartialMatch{}, mXPath{}, mOcrText{}, +: mId{}, mAutomationId{}, mRole{}, mText{}, mPkg{}, mType{}, mStyle{}, mTextPartialMatch{}, mXPath{}, mOcrText{}, mDescription{}, mMatchId{}, mMatchAutomationId{}, mMatchRole{}, mMatchText{}, mMatchPkg{}, mMatchType{}, mMatchStyle{}, - mMatchTextPartialMatch{}, mMatchXPath{}, mMatchOcrText{}, mMatchGeometry{}, mMatchChecked{}, mMatchCheckable{}, mMatchClickable{}, mMatchEnabled{}, + mMatchTextPartialMatch{}, mMatchXPath{}, mMatchOcrText{}, mMatchGeometry{}, mMatchDescription{}, mMatchChecked{}, mMatchCheckable{}, mMatchClickable{}, mMatchEnabled{}, mMatchFocused{}, mMatchFocusable{}, mMatchScrollable{}, mMatchSelected{}, mMatchShowing{}, mMatchActive{}, mMatchVisible{}, mMatchSelectable{}, mMatchHighlightable{}, mMinDepth{}, mMaxDepth{}, mIschecked{}, mIscheckable{}, mIsclickable{}, mIsenabled{}, mIsfocused{}, mIsfocusable{}, mIsscrollable{}, mIsselected{}, mIsshowing{}, mIsactive{}, mIsvisible{}, @@ -40,6 +40,7 @@ std::string UiSelector::description() if(!this->mAutomationId.empty()) ss << "\"mAutomationId\":\"" << this->mAutomationId << "\", "; if(!this->mRole.empty()) ss << "\"mRole\":\"" << this->mRole << "\", "; if(!this->mText.empty()) ss << "\"mText\":\"" << this->mText << "\", "; + if(!this->mDescription.empty()) ss << "\"mDescription\":\"" << this->mDescription << "\", "; if(!this->mOcrText.empty()) ss << "\"mOcrText\":\"" << this->mOcrText << "\", "; if(!this->mTextPartialMatch.empty()) ss << "\"mTextPartialMatch\":\"" << this->mTextPartialMatch << "\", "; if(!this->mXPath.empty()) ss << "\"mXPath\":\"" << this->mXPath << "\", "; @@ -58,6 +59,7 @@ std::string UiSelector::description() if(this->mMatchType) ss << "\"mMatchType\":\"" << ((this->mMatchType)?"true":"false") << "\", "; if(this->mMatchStyle) ss << "\"mMatchStyle\":\"" << ((this->mMatchStyle)?"true":"false" )<< "\", "; if(this->mMatchGeometry) ss << "\"mMatchGeometry\":\"" << ((this->mMatchGeometry)?"true":"false" )<< "\", "; + if(this->mMatchDescription) ss << "\"mMatchDescription\":\"" << ((this->mMatchDescription)?"true":"false") << "\", "; if(this->mMinDepth) ss << "\"mMinDepth\":\"" << this->mMinDepth << "\", "; if(this->mMaxDepth) ss << "\"mMaxDepth\":\"" << this->mMaxDepth << "\", "; if(this->mMatchChecked) ss << "\"mMatchChecked\":\"" << ((this->mMatchChecked)?"true":"false") << "\", "; @@ -293,3 +295,10 @@ UiSelector *UiSelector::geometry(Rect geometry, bool isEqual) this->mMatchGeometry = true; return this; } + +UiSelector *UiSelector::description(std::string description) +{ + this->mDescription = description; + this->mMatchDescription = true; + return this; +} diff --git a/org.tizen.aurum-bootstrap/src/Commands/DumpObjectTreeCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/DumpObjectTreeCommand.cc index 0f00f0f..7021eca 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/DumpObjectTreeCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/DumpObjectTreeCommand.cc @@ -87,6 +87,7 @@ void DumpObjectTreeCommand::traverse(::aurum::Element *root, std::shared_ptrset_targetangle(obj->getTargetAngle()); root->set_interface(obj->getInterface()); + root->set_description(obj->getDescription()); for( auto && childNode : node->mChildren) { ::aurum::Element *child = root->add_child(); diff --git a/org.tizen.aurum-bootstrap/src/Commands/FindElementCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/FindElementCommand.cc index 02b6c86..a15e073 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/FindElementCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/FindElementCommand.cc @@ -72,6 +72,7 @@ std::shared_ptr FindElementCommand::getSelector(void) if(mRequest->_isvisible_case()) sel->isVisible(mRequest->isvisible()); if(mRequest->_isselectable_case()) sel->isSelectable(mRequest->isselectable()); if(mRequest->_ishighlightable_case()) sel->isHighlightable(mRequest->ishighlightable()); + if(mRequest->_description_case()) sel->description(mRequest->description()); return sel; } @@ -148,6 +149,7 @@ std::shared_ptr FindElementCommand::getSelector(void) elm->set_targetangle(obj->getTargetAngle()); elm->set_interface(obj->getInterface()); + elm->set_description(obj->getDescription()); mResponse->set_status(::aurum::RspStatus::OK); } else { diff --git a/org.tizen.aurum-bootstrap/src/Commands/FindElementsCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/FindElementsCommand.cc index 97c5029..721993c 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/FindElementsCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/FindElementsCommand.cc @@ -72,6 +72,8 @@ std::vector> FindElementsCommand::getSelectors(void) if(mRequest->_isvisible_case()) sel->isVisible(mRequest->isvisible()); if(mRequest->_isselectable_case()) sel->isSelectable(mRequest->isselectable()); if(mRequest->_ishighlightable_case()) sel->isHighlightable(mRequest->ishighlightable()); + if(mRequest->_description_case()) sel->description(mRequest->description()); + return std::vector>{sel}; } @@ -155,6 +157,7 @@ std::vector> FindElementsCommand::getSelectors(void) elm->set_targetangle(obj->getTargetAngle()); elm->set_interface(obj->getInterface()); + elm->set_description(obj->getDescription()); } mResponse->set_status(::aurum::RspStatus::OK); } else { diff --git a/protocol/aurum.proto b/protocol/aurum.proto index dd534a1..39a2635 100644 --- a/protocol/aurum.proto +++ b/protocol/aurum.proto @@ -96,6 +96,7 @@ message Element { int32 targetAngle = 32; string interface = 33; + string description = 34; } message Point { @@ -217,7 +218,11 @@ message ReqFindElement { bool isHighlightable = 25; } - repeated ReqFindElement children = 26; + oneof _description { + string description = 26; + } + + repeated ReqFindElement children = 27; } message RspFindElement { @@ -326,7 +331,11 @@ message ReqFindElements { bool isHighlightable = 25; } - repeated ReqFindElements children = 26; + oneof _description { + string description = 26; + } + + repeated ReqFindElements children = 27; } message RspFindElements {