libaurum: add updateInterface and getInterface API 19/302819/2
authorHosang Kim <hosang12.kim@samsung.com>
Thu, 14 Dec 2023 06:47:21 +0000 (15:47 +0900)
committerkim hosang <hosang12.kim@samsung.com>
Tue, 2 Jan 2024 08:48:03 +0000 (08:48 +0000)
Atspi interface is a set of pointers to all interfaces supported by an AtspiAccessible.
We able to check possible feature with interface information. e.g. EditableText, Value and so on.

Change-Id: I6122e135035b15950c1a55f40b47cfb785675eda

12 files changed:
libaurum/inc/Accessibility/AccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h
libaurum/inc/Impl/Accessibility/MockAccessibleNode.h
libaurum/inc/UiObject.h
libaurum/src/Accessibility/AccessibleNode.cc
libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc
libaurum/src/Impl/Accessibility/MockAccessibleNode.cc
libaurum/src/UiObject.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 b65f316..bcdc1fc 100644 (file)
@@ -318,6 +318,11 @@ public:
     Rect<int> getTextMinBoundingRect() const;
 
     /**
+     * @copydoc UiObject::getInterface()
+     */
+    std::string getInterface() const;
+
+    /**
      * @copydoc UiObject::isCheckable()
      */
     bool isCheckable() const;
@@ -457,6 +462,11 @@ public:
     virtual void updateTextMinBoundingRect() = 0;
 
     /**
+     * @copydoc UiObject::updateInterface()
+     */
+    virtual void updateInterface() = 0;
+
+    /**
      * @brief Updates Node information from atspi server.
      *
      * @since_tizen 6.5
@@ -565,6 +575,7 @@ protected:
     std::string mStyle;
     std::string mXPath;
     std::string mToolkitName;
+    std::string mInterface;
     Rect<int> mScreenBoundingBox;
     Rect<int> mWindowBoundingBox;
     Rect<int> mTextMinBoundingRect;
index 54d091a..29c0aeb 100644 (file)
@@ -147,6 +147,11 @@ public:
     void updateTextMinBoundingRect() override;
 
     /**
+     * @copydoc UiObject::updateInterface()
+     */
+    void updateInterface() override;
+
+    /**
      * @copydoc UiObject::setFocus()
      */
     bool setFocus() override;
index 77f9ce3..c2df6a7 100644 (file)
@@ -148,6 +148,11 @@ public:
     void updatePid() override;
 
     /**
+     * @copydoc UiObject::updateInterface()
+     */
+    void updateInterface() override;
+
+    /**
      * @brief TBD
      * @since_tizen 7.0
      */
index 3f7911b..6689962 100644 (file)
@@ -464,6 +464,15 @@ public:
     const Rect<int> getTextMinBoundingRect() const;
 
     /**
+     * @brief Gets object's interface information.
+     *
+     * @return string
+     *
+     * @since_tizen 8.0
+     */
+    std::string getInterface() const;
+
+    /**
      * @brief Sets object's value.
      *
      * @param[in] double value
@@ -661,6 +670,13 @@ public:
      */
     void updateTextMinBoundingRect() const;
 
+    /*
+     * @brief Updates object's interface information from atspi server.
+     *
+     * @since_tizen 8.0
+     */
+    void updateInterface() const;
+
     /**
      * @brief Sets focus to object.
      *
index 8f6212b..abfed4a 100644 (file)
@@ -201,6 +201,11 @@ const Rect<int> AccessibleNode::getWindowBoundingBox() const
     return mWindowBoundingBox;
 }
 
+std::string AccessibleNode::getInterface() const
+{
+    return mInterface;
+}
+
 bool AccessibleNode::isCheckable() const
 {
     return hasFeatureProperty(NodeFeatureProperties::CHECKABLE);
index e4572d4..a3a1dd6 100644 (file)
@@ -308,6 +308,23 @@ void AtspiAccessibleNode::updateTextMinBoundingRect()
     }
 }
 
+void AtspiAccessibleNode::updateInterface()
+{
+    GArray *interfaces = AtspiWrapper::Atspi_accessible_get_interfaces(mNode);
+    if (interfaces)
+    {
+        for (unsigned int i = 0; i < interfaces->len; i++)
+        {
+            gchar *interface = g_array_index(interfaces, gchar *, i);
+            if (g_strcmp0(interface, "EditableText") == 0 || g_strcmp0(interface, "Value") == 0)
+            {
+                mInterface = interface;
+            }
+        }
+        g_array_free(interfaces, true);
+    }
+}
+
 bool AtspiAccessibleNode::setFocus()
 {
     AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode);
@@ -431,6 +448,20 @@ void AtspiAccessibleNode::refresh(bool updateAll)
             g_object_unref(value);
         }
 
+        GArray *interfaces = AtspiWrapper::Atspi_accessible_get_interfaces(mNode);
+        if (interfaces)
+        {
+            for (unsigned int i = 0; i < interfaces->len; i++)
+            {
+                gchar *interface = g_array_index(interfaces, gchar *, i);
+                if (g_strcmp0(interface, "EditableText") == 0 || g_strcmp0(interface, "Value") == 0)
+                {
+                    mInterface = interface;
+                }
+            }
+            g_array_free(interfaces, true);
+        }
+
         if (updateAll) updateXPath();
 
     } else {
index 860a089..8a51e90 100644 (file)
@@ -132,6 +132,10 @@ void MockAccessibleNode::updateToolkitName()
 {
 }
 
+void MockAccessibleNode::updateInterface()
+{
+}
+
 bool MockAccessibleNode::setFocus()
 {
     return false;
index ca0946b..82d9563 100644 (file)
@@ -244,6 +244,11 @@ const Rect<int> UiObject::getTextMinBoundingRect() const
     return getAccessibleNode()->getTextMinBoundingRect();
 }
 
+std::string UiObject::getInterface() const
+{
+    return getAccessibleNode()->getInterface();
+}
+
 bool UiObject::setValue(double value)
 {
     return getAccessibleNode()->setValue(value);
index 6d9b4ab..0f00f0f 100644 (file)
@@ -86,6 +86,8 @@ void DumpObjectTreeCommand::traverse(::aurum::Element *root, std::shared_ptr<Nod
     root->set_windowangle(obj->getWindowAngle());
     root->set_targetangle(obj->getTargetAngle());
 
+    root->set_interface(obj->getInterface());
+
     for( auto && childNode : node->mChildren) {
         ::aurum::Element *child = root->add_child();
         traverse(child, childNode, depth+1);
index d147096..02b6c86 100644 (file)
@@ -147,6 +147,8 @@ std::shared_ptr<UiSelector> FindElementCommand::getSelector(void)
         elm->set_windowangle(obj->getWindowAngle());
         elm->set_targetangle(obj->getTargetAngle());
 
+        elm->set_interface(obj->getInterface());
+
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
         mResponse->set_status(::aurum::RspStatus::ERROR);
index cd113f1..97c5029 100644 (file)
@@ -153,6 +153,8 @@ std::vector<std::shared_ptr<UiSelector>> FindElementsCommand::getSelectors(void)
 
             elm->set_windowangle(obj->getWindowAngle());
             elm->set_targetangle(obj->getTargetAngle());
+
+            elm->set_interface(obj->getInterface());
         }
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
index b83bea5..dd534a1 100644 (file)
@@ -94,6 +94,8 @@ message Element {
 
    int32 windowAngle = 31;
    int32 targetAngle = 32;
+
+   string interface = 33;
 }
 
 message Point {