aurum: add image source information 81/316181/1
authorHosang Kim <hosang12.kim@samsung.com>
Fri, 29 Nov 2024 04:44:10 +0000 (13:44 +0900)
committerkim hosang <hosang12.kim@samsung.com>
Wed, 11 Dec 2024 09:02:53 +0000 (09:02 +0000)
Change-Id: I92c9ec52a12a1a31dd55e6b810f58f1d0db76ae0

17 files changed:
libaurum/inc/Accessibility/AccessibleNode.h
libaurum/inc/UiObject.h
libaurum/inc/UiSelector.h
libaurum/src/Accessibility/AccessibleNode.cc
libaurum/src/AurumXML.cc
libaurum/src/Impl/Accessibility/AtspiAccessibleNode.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
org.tizen.aurum-bootstrap/src/Commands/FirstCommand.cc
org.tizen.aurum-bootstrap/src/Commands/LastCommand.cc
org.tizen.aurum-bootstrap/src/Commands/NextCommand.cc
org.tizen.aurum-bootstrap/src/Commands/PrevCommand.cc
protocol/aurum.proto

index c9524f97ff5937aa2658c21565d3401e5d0d0c3f..6874b092ad80de12220cdb27d5bc1388198abf17 100644 (file)
@@ -351,6 +351,11 @@ public:
      */
     std::string getDescription() const;
 
+    /**
+     * @copydoc UiObject::getImgSrc()
+     */
+    std::string getImgSrc() const;
+
     /**
      * @copydoc UiObject::isCheckable()
      */
@@ -621,6 +626,7 @@ protected:
     std::string mToolkitName;
     std::string mInterface;
     std::string mDescription;
+    std::string mImgSrc;
     Rect<int> mScreenBoundingBox;
     Rect<int> mWindowBoundingBox;
     Rect<int> mTextMinBoundingRect;
index 79681554b8f9ade291b566567ca583c3018b3ef8..0d9ea6847ce253237da1e43d71bec1e285a6bd9b 100644 (file)
@@ -490,6 +490,15 @@ public:
      */
     std::string getDescription() const;
 
+    /**
+     * @brief Gets object's image source.
+     *
+     * @return string
+     *
+     * @since_tizen 10.0
+     */
+    std::string getImgSrc() const;
+
     /**
      * @brief Gets object's checkable property.
      *
index 24519dc811be9ee83055e90966f2ecd18ee41236..93d0ce9285083752819b8bd80928071b8d7cf957 100644 (file)
@@ -404,6 +404,17 @@ public:
      */
     UiSelector *description(std::string description);
 
+    /**
+     * @brief Sets the search criteria to match the object's image source.
+     *
+     * @param[in] imgSrc object image source
+     *
+     * @return UiSelector class instance
+     *
+     * @since_tizen 10.0
+     */
+    UiSelector *imgSrc(std::string imgSrc);
+
 public:
     std::string mId;
     std::string mAutomationId;
@@ -416,6 +427,7 @@ public:
     std::string mXPath;
     std::string mOcrText;
     std::string mDescription;
+    std::string mImgSrc;
 
     bool mMatchId;
     bool mMatchAutomationId;
@@ -429,6 +441,7 @@ public:
     bool mMatchOcrText;
     bool mMatchGeometry;
     bool mMatchDescription;
+    bool mMatchImgSrc;
 
     bool mMatchChecked;
     bool mMatchCheckable;
index d84643e36d0abe10e698ce53b109bb6c53e4863a..b373c27d304a169d94241cec92371d934c025a7f 100644 (file)
@@ -56,7 +56,7 @@ AccessibleNode::~AccessibleNode()
 }
 
 AccessibleNode::AccessibleNode()
-: mText{""}, mOcrText{""}, mPkg{""}, mRole{""}, mId{""}, mAutomationId{""}, mType{""}, mStyle{""}, mXPath{""}, mToolkitName{""}, mInterface{""}, mDescription{""},
+: mText{""}, mOcrText{""}, mPkg{""}, mRole{""}, mId{""}, mAutomationId{""}, mType{""}, mStyle{""}, mXPath{""}, mToolkitName{""}, mInterface{""}, mDescription{""}, mImgSrc{""},
   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{}
 {
 }
@@ -74,6 +74,7 @@ std::string AccessibleNode::description() {
     ss << "\"mPkg\":\"" << this->mPkg << "\", ";
     ss << "\"mType\":\"" << this->mType << "\", ";
     ss << "\"mStyle\":\"" << this->mStyle << "\", ";
+    ss << "\"mImgSrc\":\"" << this->mImgSrc << "\", ";
     ss << "}";
 
     return ss.str();
@@ -239,6 +240,11 @@ std::string AccessibleNode::getDescription() const
     return mDescription;
 }
 
+std::string AccessibleNode::getImgSrc() const
+{
+    return mImgSrc;
+}
+
 bool AccessibleNode::isCheckable() const
 {
     return hasFeatureProperty(NodeFeatureProperties::CHECKABLE);
index 25f267dd980f4617e6df5d06593d685e0f6bc824..7cb8ff41407635c1cbeb51a4438d65a68896300e 100644 (file)
@@ -64,6 +64,7 @@ void AurumXML::traverse(xml_node& element, const std::shared_ptr<AccessibleNode>
     element.append_attribute("name") = node->getText().c_str();
     element.append_attribute("id") = node->getId().c_str();
     element.append_attribute("automationid") = node->getAutomationId().c_str();
+    element.append_attribute("imgSrc") = node->getImgSrc().c_str();
 
     mXNodeMap[node->getId()] = node;
 
index b82f0a6689a525017b653c51b8c71303d113002c..ceea20cfe4c569080f46ccdeca0617675c5862e3 100644 (file)
@@ -202,6 +202,7 @@ void AtspiAccessibleNode::updateAttributes()
         if (!t) t = (char*)g_hash_table_lookup(attributes, "class");
         char *s = (char*)g_hash_table_lookup(attributes, "style");
         char *a = (char*)g_hash_table_lookup(attributes, "automationId");
+        char *i = (char*)g_hash_table_lookup(attributes, "imgSrc");
 
         if (t) mType =  std::string(t);
         else {
@@ -210,6 +211,7 @@ void AtspiAccessibleNode::updateAttributes()
         }
         if (s) mStyle = std::string(s);
         if (a) mAutomationId = std::string(a);
+        if (i) mImgSrc = std::string(i);
 
         g_hash_table_unref(attributes);
     }
@@ -370,11 +372,13 @@ void AtspiAccessibleNode::refresh(bool updateAll)
                     if (!t) t = (char *)g_hash_table_lookup(attributes, "class");
                     char *s = (char *)g_hash_table_lookup(attributes, "style");
                     char *a = (char *)g_hash_table_lookup(attributes, "automationId");
+                    char *i = (char*)g_hash_table_lookup(attributes, "imgSrc");
 
                     if (t) mType = std::string(t);
                     else mType = mRole;
                     if (s) mStyle = std::string(s);
                     if (a) mAutomationId = std::string(a);
+                    if (i) mImgSrc = std::string(i);
                 }
             }
             if (ni->states) {
index defed5ab598b39ea34b2ba74b24ded2e7cf7d155..a18b3cd67c325670272266efa1c68b053ee73e73 100644 (file)
@@ -74,11 +74,12 @@ bool PartialMatch::checkCriteria(const std::shared_ptr<UiSelector> selector,
         node->updateUniqueId();
         if (checkCriteria(selector->mId, node->getId(), 0)) return false;
     }
-    if (selector->mMatchType || selector->mMatchAutomationId || selector->mMatchStyle) {
+    if (selector->mMatchType || selector->mMatchAutomationId || selector->mMatchStyle || selector->mMatchImgSrc) {
         node->updateAttributes();
         if (selector->mMatchAutomationId && checkCriteria(selector->mAutomationId, node->getAutomationId(), 0)) return false;
         if (selector->mMatchType && checkCriteria(selector->mType, node->getType(), 0)) return false;
         if (selector->mMatchStyle && checkCriteria(selector->mStyle, node->getStyle(), 0)) return false;
+        if (selector->mMatchImgSrc && checkCriteria(selector->mImgSrc, node->getImgSrc(), 0)) return false;
     }
     if (selector->mMatchPkg) {
         node->updateApplication();
index b15f2d9ff60fa9f6d946ec9a698023c8f7350813..75c1bbf664cd33ecd899bdd532e64e1c626f95a1 100644 (file)
@@ -266,6 +266,11 @@ std::string UiObject::getDescription() const
     return mNode->getDescription();
 }
 
+std::string UiObject::getImgSrc() const
+{
+    return mNode->getImgSrc();
+}
+
 bool UiObject::setValue(double value)
 {
     return mNode->setValue(value);
index 15e708feca8732c0cefe9acdd1af0b6a10f7d51c..423e07c68af4e3d18331bf9d0ad4cc7057f36481 100644 (file)
@@ -22,9 +22,9 @@
 using namespace Aurum;
 
 UiSelector::UiSelector()
-: mId{}, mAutomationId{}, mRole{}, mText{}, mPkg{}, mType{}, mStyle{}, mTextPartialMatch{}, mXPath{}, mOcrText{}, mDescription{},
+: mId{}, mAutomationId{}, mRole{}, mText{}, mPkg{}, mType{}, mStyle{}, mTextPartialMatch{}, mXPath{}, mOcrText{}, mDescription{}, mImgSrc{},
   mMatchId{}, mMatchAutomationId{}, mMatchRole{}, mMatchText{}, mMatchPkg{}, mMatchType{}, mMatchStyle{},
-  mMatchTextPartialMatch{}, mMatchXPath{}, mMatchOcrText{}, mMatchGeometry{}, mMatchDescription{}, mMatchChecked{}, mMatchCheckable{}, mMatchClickable{}, mMatchEnabled{},
+  mMatchTextPartialMatch{}, mMatchXPath{}, mMatchOcrText{}, mMatchGeometry{}, mMatchDescription{}, mMatchImgSrc{}, 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{},
@@ -47,6 +47,7 @@ std::string UiSelector::description()
     if(!this->mPkg.empty()) ss << "\"mPkg\":\"" << this->mPkg << "\", ";
     if(!this->mType.empty()) ss << "\"mType\":\"" << this->mType << "\", ";
     if(!this->mStyle.empty()) ss << "\"mStyle\":\"" << this->mStyle << "\", ";
+    if(!this->mImgSrc.empty()) ss << "\"mImgSrc\":\"" << this->mImgSrc << "\", ";
     if(this->mMatchGeometry) ss << "\"mGeometry\":\"" << this->mGeometry.mTopLeft.x << "//" << this->mGeometry.mTopLeft.y << "//" << this->mGeometry.width() << "//" << this->mGeometry.height() << "\", ";
     if(this->mMatchId) ss << "\"mMatchId\":\"" << ((this->mMatchId)?"true":"false") << "\", ";
     if(this->mMatchAutomationId) ss << "\"mMatchAutomationId\":\"" << ((this->mMatchAutomationId)?"true":"false") << "\", ";
@@ -60,6 +61,7 @@ std::string UiSelector::description()
     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->mMatchImgSrc) ss << "\"mMatchImgSrc\":\"" << ((this->mMatchImgSrc)?"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") << "\", ";
@@ -302,3 +304,10 @@ UiSelector *UiSelector::description(std::string description)
     this->mMatchDescription = true;
     return this;
 }
+
+UiSelector *UiSelector::imgSrc(std::string imgSrc)
+{
+    this->mImgSrc = imgSrc;
+    this->mMatchImgSrc = true;
+    return this;
+}
index 7021eca028a26809ac325eb365e5b6921ff23fad..eb39d546aab51b1962cb5d2708d91df1cdf3fdb5 100644 (file)
@@ -88,6 +88,7 @@ void DumpObjectTreeCommand::traverse(::aurum::Element *root, std::shared_ptr<Nod
 
     root->set_interface(obj->getInterface());
     root->set_description(obj->getDescription());
+    root->set_imgsrc(obj->getImgSrc());
 
     for( auto && childNode : node->mChildren) {
         ::aurum::Element *child = root->add_child();
index e9b27f24fbeb2ba794a084901a7b8e1b448a3e82..12e202f5ce8a7da6aa794b8d250461f90a6a26ba 100644 (file)
@@ -73,6 +73,7 @@ std::shared_ptr<UiSelector> FindElementCommand::getSelector(void)
     if(mRequest->reqIsselectable_case())     sel->isSelectable(mRequest->isselectable());
     if(mRequest->reqIshighlightable_case())  sel->isHighlightable(mRequest->ishighlightable());
     if(mRequest->reqDescription_case())      sel->description(mRequest->description());
+    if(mRequest->reqImgSrc_case())           sel->imgSrc(mRequest->imgsrc());
 
     return sel;
 }
@@ -150,6 +151,7 @@ std::shared_ptr<UiSelector> FindElementCommand::getSelector(void)
 
         elm->set_interface(obj->getInterface());
         elm->set_description(obj->getDescription());
+        elm->set_imgsrc(obj->getImgSrc());
 
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
index ce95b5e01291a4e0514949740e719e8edd1c03a7..8a5d68f7d3904bae7f45230249a9a7c7c394c029 100644 (file)
@@ -73,7 +73,7 @@ std::vector<std::shared_ptr<UiSelector>> FindElementsCommand::getSelectors(void)
     if(mRequest->reqIsselectable_case())     sel->isSelectable(mRequest->isselectable());
     if(mRequest->reqIshighlightable_case())  sel->isHighlightable(mRequest->ishighlightable());
     if(mRequest->reqDescription_case())      sel->description(mRequest->description());
-
+    if(mRequest->reqImgSrc_case())           sel->imgSrc(mRequest->imgsrc());
 
     return std::vector<std::shared_ptr<UiSelector>>{sel};
 }
@@ -158,6 +158,7 @@ std::vector<std::shared_ptr<UiSelector>> FindElementsCommand::getSelectors(void)
 
             elm->set_interface(obj->getInterface());
             elm->set_description(obj->getDescription());
+            elm->set_imgsrc(obj->getImgSrc());
         }
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
index 43e21fb640ff7ad326459250d83d76f09dcdbfc1..a7c5f4ac27184f6dbcfa17ce8e532e398cf60e8f 100644 (file)
@@ -98,6 +98,7 @@ FirstCommand::FirstCommand(const ::aurum::ReqFirst *request,
 
         elm->set_interface(obj->getInterface());
         elm->set_description(obj->getDescription());
+        elm->set_imgsrc(obj->getImgSrc());
 
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
index ada839a8747a6c504c0b5dea3cea700330577a9f..85b7de6cf4fce374fcf0c12d8cf6618eb3a48282 100644 (file)
@@ -98,6 +98,7 @@ LastCommand::LastCommand(const ::aurum::ReqLast *request,
 
         elm->set_interface(obj->getInterface());
         elm->set_description(obj->getDescription());
+        elm->set_imgsrc(obj->getImgSrc());
 
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
index 038acd566850457314cc00b61c6a172900cc97c6..08b0fc648c6eb079f01e8bf89b2a0a367ccd06f8 100644 (file)
@@ -98,6 +98,7 @@ NextCommand::NextCommand(const ::aurum::ReqNext *request,
 
         elm->set_interface(obj->getInterface());
         elm->set_description(obj->getDescription());
+        elm->set_imgsrc(obj->getImgSrc());
 
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
index 3447b2cea294f43c36555ca894ef1e28a866141f..54475df05cfa149c1750bd7cb1d9346778bc0924 100644 (file)
@@ -98,6 +98,7 @@ PrevCommand::PrevCommand(const ::aurum::ReqPrev *request,
 
         elm->set_interface(obj->getInterface());
         elm->set_description(obj->getDescription());
+        elm->set_imgsrc(obj->getImgSrc());
 
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
index 1ecdafae6b027a2a1c3f436eccce8cd5d3f1e613..1492f091a31c8a7f2baf30565cdfd961c86cd6d2 100644 (file)
@@ -108,6 +108,7 @@ message Element {
 
    string interface = 33;
    string description = 34;
+   string imgSrc = 35;
 }
 
 message Point {
@@ -233,6 +234,10 @@ message ReqFindElement {
       string description = 26;
    }
 
+   oneof reqImgSrc {
+      string imgSrc = 28;
+   }
+
    repeated ReqFindElement children = 27;
 }
 
@@ -345,6 +350,10 @@ message ReqFindElements {
       string description = 26;
    }
 
+   oneof reqImgSrc {
+      string imgSrc = 28;
+   }
+
    repeated ReqFindElements children = 27;
 }