aurum: add searching highlightable object 29/283429/2
authorHosang Kim <hosang12.kim@samsung.com>
Wed, 26 Oct 2022 11:11:12 +0000 (20:11 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Wed, 26 Oct 2022 11:28:28 +0000 (20:28 +0900)
Change-Id: I2213133ba5f553298d7d4f1d057cb30a56525c21

13 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
protocol/aurum.proto

index be58257fd1918013ac0e51f8edb7964b94fde1ce..e3e5cb263f896326dbe3c54ec26305c0ed4e680c 100644 (file)
@@ -76,7 +76,8 @@ enum class NodeFeatureProperties {
     VISIBLE         = 0X0400,
     SHOWING         = 0X0800,
     ACTIVE          = 0X1000,
-    INVALID         = 0X2000,
+    HIGHLIGHTABLE   = 0X2000,
+    INVALID         = 0X4000,
 };
 
 /**
@@ -322,6 +323,11 @@ public:
      */
     bool isVisible() const;
 
+    /**
+     * @copydoc UiObject::isHighlightable()
+     */
+    bool isHighlightable() const;
+
 public:
     /**
      * @brief Print Node information.
index bb50d1904473e6c6d9c4778b60031b28639a9a13..35fabea6fd0c55f00f0e64d51f05fdcb71aa7fba 100644 (file)
@@ -514,6 +514,15 @@ public:
      */
     bool isVisible() const;
 
+    /**
+     * @brief Gets object's highlightable property.
+     *
+     * @return true if highlightable else false
+     *
+     * @since_tizen 7.0
+     */
+    bool isHighlightable() const;
+
     /**
      * @brief Performs a click action on object.
      *
index 4db056ef2b4a7526d9d81918586b4790df4f58b0..2eca30d3dd6a7024b00f4068d5c1f12797669972 100644 (file)
@@ -335,6 +335,17 @@ public:
      */
     UiSelector *isSelectable(bool condition);
 
+    /**
+     * @brief Sets the search criteria to match the object that is highlightable.
+     *
+     * @param[in] condition object's highlightable condition
+     *
+     * @return UiSelector class instance
+     *
+     * @since_tizen 7.0
+     */
+    UiSelector *isHighlightable(bool condition);
+
     /**
      * @brief Sets the child selector.
      *
@@ -416,6 +427,7 @@ public:
     bool mMatchActive;
     bool mMatchVisible;
     bool mMatchSelectable;
+    bool mMatchHighlightable;
 
     int mMinDepth;
     int mMaxDepth;
@@ -432,6 +444,7 @@ public:
     bool mIsactive;
     bool mIsvisible;
     bool mIsselectable;
+    bool mIshighlightable;
 
     bool mGeometryIsEqual;
 
index 92e9cb6aefb498244a67fca4570d5d9fa9de7b36..7bd33c72c1b340d1f050b1bade00658a16f66fc4 100644 (file)
@@ -246,6 +246,11 @@ bool AccessibleNode::isActive() const
     return hasFeatureProperty(NodeFeatureProperties::ACTIVE);
 }
 
+bool AccessibleNode::isHighlightable() const
+{
+    return hasFeatureProperty(NodeFeatureProperties::HIGHLIGHTABLE);
+}
+
 double AccessibleNode::getMinValue() const
 {
     return mMinValue;
index 4067afe25255c604dd8a51d4645b63ce78249a3b..9a8c8a8fa037602fcc02593562cc5a373430db3e 100644 (file)
@@ -77,6 +77,7 @@ void AurumXML::traverse(xml_node element, std::shared_ptr<AccessibleNode> node)
     element.append_attribute("active") = node->isActive();
     element.append_attribute("visible") = node->isVisible();
     element.append_attribute("selectable") = node->isSelectable();
+    element.append_attribute("highlightable") = node->isHighlightable();
 
     mXNodeMap[node->getId()] = node;
 
index 1f40f58a45bdface8f4d30826b4a4eea68097fe4..2fc415fd83214680f4bee4cf79c59ef50b67fe0b 100644 (file)
@@ -548,6 +548,9 @@ void AtspiAccessibleNode::setFeatureProperty(AtspiStateType type)
         case ATSPI_STATE_SENSITIVE:
             setFeatureProperty(NodeFeatureProperties::CLICKABLE, true);
             break;
+        case ATSPI_STATE_HIGHLIGHTABLE:
+            setFeatureProperty(NodeFeatureProperties::HIGHLIGHTABLE, true);
+            break;
         case ATSPI_STATE_DEFUNCT:
         case ATSPI_STATE_INVALID:
             setFeatureProperty(NodeFeatureProperties::INVALID, true);
index 1e0d0180b131ea621bf65b6b2dbcc2fd14462f47..f5b8e92f5a082425cee246162ccbe194ca922066 100644 (file)
@@ -132,6 +132,7 @@ bool PartialMatch::checkCriteria(const std::shared_ptr<UiSelector> selector,
     if (selector->mMatchActive && checkCriteria(selector->mIsactive, node->isActive())) return false;
     if (selector->mMatchVisible && checkCriteria(selector->mIsvisible, node->isVisible())) return false;
     if (selector->mMatchSelectable && checkCriteria(selector->mIsselectable, node->isSelectable())) return false;
+    if (selector->mMatchHighlightable && checkCriteria(selector->mIshighlightable, node->isHighlightable())) return false;
 
     return true;
 }
index 577ef65e32d0b28acd61fdaf3bc228843c3a9146..82fa0736b796445202077f4d995d96dd80c3058a 100644 (file)
@@ -315,6 +315,11 @@ bool UiObject::isActive() const
     return getAccessibleNode()->isActive();
 }
 
+bool UiObject::isHighlightable() const
+{
+    return getAccessibleNode()->isHighlightable();
+}
+
 void UiObject::refresh() const
 {
     mNode->refresh();
index f568eb7ba7e9cc697cb9e4a6f9981968327b9130..63fd96565b61da2ad58db622463ed6561e120425 100644 (file)
@@ -26,9 +26,9 @@ UiSelector::UiSelector()
   mMatchId{}, mMatchAutomationId{}, mMatchRole{}, mMatchText{}, mMatchPkg{}, mMatchType{}, mMatchStyle{},
   mMatchTextPartialMatch{}, mMatchXPath{}, mMatchOcrText{}, mMatchGeometry{}, mMatchChecked{}, mMatchCheckable{}, mMatchClickable{}, mMatchEnabled{},
   mMatchFocused{}, mMatchFocusable{}, mMatchScrollable{}, mMatchSelected{}, mMatchShowing{}, mMatchActive{}, mMatchVisible{},
-  mMatchSelectable{}, mMinDepth{}, mMaxDepth{}, mIschecked{}, mIscheckable{}, mIsclickable{}, mIsenabled{},
+  mMatchSelectable{}, mMatchHighlightable{}, mMinDepth{}, mMaxDepth{}, mIschecked{}, mIscheckable{}, mIsclickable{}, mIsenabled{},
   mIsfocused{}, mIsfocusable{}, mIsscrollable{}, mIsselected{}, mIsshowing{}, mIsactive{}, mIsvisible{},
-  mIsselectable{}, mChild{}, mParent{}, mGeometry{}, mGeometryIsEqual{}
+  mIsselectable{}, mIshighlightable{}, mChild{}, mParent{}, mGeometry{}, mGeometryIsEqual{}
 {
 }
 
@@ -72,6 +72,7 @@ std::string UiSelector::description()
     if(this->mMatchActive) ss << "\"mMatchActive\":\"" << ((this->mMatchActive)?"true":"false") << "\", ";
     if(this->mMatchVisible) ss << "\"mMatchVisible\":\"" << ((this->mMatchVisible)?"true":"false") << "\", ";
     if(this->mMatchSelectable) ss << "\"mMatchSelectable\":\"" << ((this->mMatchSelectable)?"true":"false") << "\", ";
+    if(this->mMatchHighlightable) ss << "\"mMatchHighlightable\":\"" << ((this->mMatchHighlightable)?"true":"false") << "\", ";
     if(this->mParent) {
         ss << "\"mParent\":" << this->mParent->description();
     }
@@ -266,6 +267,13 @@ UiSelector *UiSelector::isSelectable(bool condition)
     return this;
 }
 
+UiSelector *UiSelector::isHighlightable(bool condition)
+{
+    this->mIshighlightable = condition;
+    this->mMatchHighlightable = true;
+    return this;
+}
+
 UiSelector *UiSelector::hasChild(std::shared_ptr<UiSelector> child)
 {
     mChild.push_back(child);
index cd5acbde600a354127be393343919502ec60c690..b899715ecb2cd8dc297fc76b8bb579254ab91658 100644 (file)
@@ -76,6 +76,7 @@ void DumpObjectTreeCommand::traverse(::aurum::Element *root, std::shared_ptr<Nod
     root->set_isactive(obj->isActive());
     root->set_isvisible(obj->isVisible());
     root->set_isselectable(obj->isSelectable());
+    root->set_ishighlightable(obj->isHighlightable());
 
     root->set_minvalue(obj->getMinValue());
     root->set_maxvalue(obj->getMaxValue());
index c0d46416143583eaad35c03b495b2f78a3d3819d..349d2a556a6e13c13fc32bd48c5674f6dc6ebb79 100644 (file)
@@ -72,6 +72,9 @@ std::shared_ptr<UiSelector> FindElementCommand::getSelector(void)
     if(mRequest->_xpath_case())            sel->xpath(mRequest->xpath());
     if(mRequest->_ocrtext_case())          sel->ocrText(mRequest->ocrtext());
     if(mRequest->_geometry_case())         sel->geometry(Rect<int>{mRequest->geometry().x(), mRequest->geometry().y(), mRequest->geometry().x() + mRequest->geometry().width(), mRequest->geometry().y() + mRequest->geometry().height()}, true);
+    if(mRequest->_isvisible_case())        sel->isVisible(mRequest->isvisible());
+    if(mRequest->_isselectable_case())     sel->isSelectable(mRequest->isselectable());
+    if(mRequest->_ishighlightable_case())  sel->isHighlightable(mRequest->ishighlightable());
 
     return sel;
 }
@@ -179,6 +182,7 @@ std::shared_ptr<UiSelector> FindElementCommand::getSelector(void)
             elm->set_isactive(obj->isActive());
             elm->set_isvisible(obj->isVisible());
             elm->set_isselectable(obj->isSelectable());
+            elm->set_ishighlightable(obj->isHighlightable());
 
             elm->set_minvalue(obj->getMinValue());
             elm->set_maxvalue(obj->getMaxValue());
index fe09e1457070dd5f94a344e89ed09700e6f4c3db..d3b2de6172a183debbd33faae89e88fc711c52f1 100644 (file)
@@ -72,6 +72,9 @@ std::vector<std::shared_ptr<UiSelector>> FindElementsCommand::getSelectors(void)
     if(mRequest->_xpath_case())            sel->xpath(mRequest->xpath());
     if(mRequest->_ocrtext_case())          sel->ocrText(mRequest->ocrtext());
     if(mRequest->_geometry_case())         sel->geometry(Rect<int>{mRequest->geometry().x(), mRequest->geometry().y(), mRequest->geometry().x() + mRequest->geometry().width(), mRequest->geometry().y() + mRequest->geometry().height()}, false);
+    if(mRequest->_isvisible_case())        sel->isVisible(mRequest->isvisible());
+    if(mRequest->_isselectable_case())     sel->isSelectable(mRequest->isselectable());
+    if(mRequest->_ishighlightable_case())  sel->isHighlightable(mRequest->ishighlightable());
 
     return std::vector<std::shared_ptr<UiSelector>>{sel};
 }
@@ -192,6 +195,7 @@ std::vector<std::shared_ptr<UiSelector>> FindElementsCommand::getSelectors(void)
                 elm->set_isactive(obj->isActive());
                 elm->set_isvisible(obj->isVisible());
                 elm->set_isselectable(obj->isSelectable());
+                elm->set_ishighlightable(obj->isHighlightable());
 
                 elm->set_minvalue(obj->getMinValue());
                 elm->set_maxvalue(obj->getMaxValue());
index 73ed266ac2ff3cee25d9b5e18afc3c8f2097ee63..9e4a42ae0e33572a4b95e3ee7c9537a34666b999 100644 (file)
@@ -84,11 +84,12 @@ message Element {
    bool isActive = 23;
    bool isVisible = 24;
    bool isSelectable = 25;
+   bool isHighlightable = 26;
 
-   double minValue = 26;
-   double maxValue = 27;
-   double value = 28;
-   double increment = 29;
+   double minValue = 27;
+   double maxValue = 28;
+   double value = 29;
+   double increment = 30;
 }
 
 message Point {
@@ -170,6 +171,7 @@ message ReqFindElement {
    oneof _isactive {
       bool isActive = 15;
    }
+
    oneof _mindepth {
       int32 minDepth = 16;
    }
@@ -197,8 +199,19 @@ message ReqFindElement {
    oneof _geometry {
      Rect geometry = 22;
    }
+   oneof _isvisible {
+      bool isVisible = 23;
+   }
+
+   oneof _isselectable {
+      bool isSelectable = 24;
+   }
 
-   repeated ReqFindElement children = 23;
+   oneof _ishighlightable {
+      bool isHighlightable = 25;
+   }
+
+   repeated ReqFindElement children = 26;
 }
 
 message RspFindElement {
@@ -266,6 +279,7 @@ message ReqFindElements {
    oneof _isactive {
       bool isActive = 15;
    }
+
    oneof _mindepth {
       int32 minDepth = 16;
    }
@@ -291,10 +305,22 @@ message ReqFindElements {
    }
 
    oneof _geometry {
-     Rect geometry = 22;
+      Rect geometry = 22;
+   }
+
+   oneof _isvisible {
+      bool isVisible = 23;
+   }
+
+   oneof _isselectable {
+      bool isSelectable = 24;
+   }
+
+   oneof _ishighlightable {
+      bool isHighlightable = 25;
    }
 
-   repeated ReqFindElements children = 23;
+   repeated ReqFindElements children = 26;
 }
 
 message RspFindElements {