Aurum: Introduce description property 10/305410/3
authorHosang Kim <hosang12.kim@samsung.com>
Thu, 1 Feb 2024 08:03:00 +0000 (17:03 +0900)
committerkim hosang <hosang12.kim@samsung.com>
Tue, 6 Feb 2024 04:52:02 +0000 (04:52 +0000)
Some widget use description property for subtext.

Change-Id: Ie7504bba3afdd5d0571ee304eb23d23ba81433c0

15 files changed:
libaurum/inc/Accessibility/AccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiWrapper.h
libaurum/inc/UiObject.h
libaurum/inc/UiSelector.h
libaurum/src/Accessibility/AccessibleNode.cc
libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc
libaurum/src/Impl/Accessibility/AtspiWrapper.cc
libaurum/src/PartialMatch.cc
libaurum/src/UiObject.cc
libaurum/src/UiSelector.cc
org.tizen.aurum-bootstrap/src/Commands/DumpObjectTreeCommand.cc
org.tizen.aurum-bootstrap/src/Commands/FindElementCommand.cc
org.tizen.aurum-bootstrap/src/Commands/FindElementsCommand.cc
protocol/aurum.proto

index 88a04a0..3dcc22f 100644 (file)
@@ -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<int> mScreenBoundingBox;
     Rect<int> mWindowBoundingBox;
     Rect<int> mTextMinBoundingRect;
index eb78152..43d20f6 100644 (file)
@@ -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.
index e7901c4..6e84b2a 100644 (file)
@@ -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);
index 187d48e..f9904bd 100644 (file)
@@ -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
index 4d2a129..24519dc 100644 (file)
@@ -393,6 +393,17 @@ public:
      */
     UiSelector *geometry(Rect<int> 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;
index e2d0539..d84643e 100644 (file)
@@ -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<int> AccessibleNode::getTextMinBoundingRect() const
 {
     return mTextMinBoundingRect;
-}
\ No newline at end of file
+}
index 2c2180b..7f45da2 100644 (file)
@@ -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()
index 33c1832..f18867d 100644 (file)
@@ -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<std::recursive_mutex> lock(mMutex);
+    return atspi_accessible_get_description(node, error);
+}
+
 AtspiStateSet *AtspiWrapper::Atspi_accessible_get_state_set(AtspiAccessible *node)
 {
     std::unique_lock<std::recursive_mutex> lock(mMutex);
index a18726b..defed5a 100644 (file)
@@ -92,6 +92,10 @@ bool PartialMatch::checkCriteria(const std::shared_ptr<UiSelector> 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;
index 8ef6b00..4b200c2 100644 (file)
@@ -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);
index 8002fc2..15e708f 100644 (file)
@@ -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<int> geometry, bool isEqual)
     this->mMatchGeometry = true;
     return this;
 }
+
+UiSelector *UiSelector::description(std::string description)
+{
+    this->mDescription = description;
+    this->mMatchDescription = true;
+    return this;
+}
index 0f00f0f..7021eca 100644 (file)
@@ -87,6 +87,7 @@ void DumpObjectTreeCommand::traverse(::aurum::Element *root, std::shared_ptr<Nod
     root->set_targetangle(obj->getTargetAngle());
 
     root->set_interface(obj->getInterface());
+    root->set_description(obj->getDescription());
 
     for( auto && childNode : node->mChildren) {
         ::aurum::Element *child = root->add_child();
index 02b6c86..a15e073 100644 (file)
@@ -72,6 +72,7 @@ std::shared_ptr<UiSelector> 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<UiSelector> 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 {
index 97c5029..721993c 100644 (file)
@@ -72,6 +72,8 @@ std::vector<std::shared_ptr<UiSelector>> 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<std::shared_ptr<UiSelector>>{sel};
 }
@@ -155,6 +157,7 @@ std::vector<std::shared_ptr<UiSelector>> 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 {
index dd534a1..39a2635 100644 (file)
@@ -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 {