The getMatchesInMatches API gets the object that satisfied with both condition in the object tree.
It runs quickly because the search happens in the app.
Change-Id: I377fd73360014d4c99d43d388257d27dc1247c87
virtual std::vector<std::shared_ptr<AccessibleNode>> getMatches(const std::shared_ptr<UiSelector> selector, const bool ealryReturn) const = 0;
/**
+ * @copydoc UiObject::getMatchesInMatches()
+ */
+ virtual std::vector<std::shared_ptr<AccessibleNode>> getMatchesInMatches(const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool ealryReturn) const = 0;
+
+ /**
* @brief Called by @AccessibleWatcher::notifyAll.
* Changes Node property If it's @EventType, @ObjectEventType are matches.
*
std::vector<std::shared_ptr<AccessibleNode>> getMatches(const std::shared_ptr<UiSelector> selector, const bool ealryReturn) const override;
/**
+ * @copydoc UiObject::getMatchesInMatches()
+ */
+ std::vector<std::shared_ptr<AccessibleNode>> getMatchesInMatches(const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool ealryReturn) const override;
+
+ /**
* @copydoc AccessibleNode::isValid()
*/
bool isValid() const override;
static void Atspi_accessible_set_listen_post_render(AtspiAccessible *obj, gboolean enabled, GError **error);
static AtspiCollection *Atspi_accessible_get_collection_iface(AtspiAccessible *node);
static GArray *Atspi_collection_get_matches(AtspiCollection *obj, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, gint count, gboolean traverse, GError **error);
+ static GArray *Atspi_collection_get_matches_in_matches(AtspiCollection *obj, AtspiMatchRule *first_rule, AtspiMatchRule *second_rule, AtspiCollectionSortOrder sortby, gint first_count, gint second_count, gboolean traverse, GError **error);
static AtspiAccessibleNodeInfo *Atspi_accessible_get_node_info(AtspiAccessible *obj, GError **error);
static void Atspi_accessible_free_node_info(AtspiAccessibleNodeInfo *node_info);
*/
std::vector<std::shared_ptr<AccessibleNode>> getMatches(const std::shared_ptr<UiSelector> selector, const bool ealryReturn) const override;
+ /**
+ * @copydoc UiObject::getMatchesInMatches()
+ */
+ std::vector<std::shared_ptr<AccessibleNode>> getMatchesInMatches(const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool ealryReturn) const override;
+
public:
/**
* @brief TBD
const std::shared_ptr<UiSelector> selector, const bool earlyReturn) const;
/**
+ * @brief Get the object that satisfied with both condition in the object tree.
+ *
+ * @param[in] firstSelector @UiSelector
+ * @param[in] secondSelector @UiSelector
+ * @param[in] earlyReturn boolean
+ *
+ * @return the list of found UiObject pointer vector
+ *
+ * @since_tizen 8.0
+ */
+ std::vector<std::shared_ptr<UiObject>> getMatchesInMatches(
+ const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool earlyReturn) const;
+
+ /**
* TODO
*/
bool waitFor(
const std::shared_ptr<UiSelector> selector, const bool earlyReturn) const;
/**
+ * @brief Get the object that satisfied with both condition in the object tree.
+ *
+ * @param[in] firstSelector @UiSelector
+ * @param[in] secondSelector @UiSelector
+ * @param[in] earlyReturn boolean
+ *
+ * @return the list of found UiObject pointer vector
+ *
+ * @since_tizen 8.0
+ */
+ std::vector<std::shared_ptr<UiObject>> getMatchesInMatches(
+ const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool earlyReturn) const;
+
+ /**
* TODO
*/
bool waitFor(
return ret;
}
+
+std::vector<std::shared_ptr<AccessibleNode>> AtspiAccessibleNode::getMatchesInMatches(const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool ealryReturn) const
+{
+ std::vector<std::shared_ptr<AccessibleNode>> ret{};
+
+ AtspiCollection *collection = AtspiWrapper::Atspi_accessible_get_collection_iface(mNode);
+ if (collection) {
+ AtspiMatchRule *firstRule = AtspiMatchRuleConvertor(firstSelector);
+ if (!firstRule) return ret;
+
+ AtspiMatchRule *secondRule = AtspiMatchRuleConvertor(secondSelector);
+ if (!secondRule) return ret;
+
+ int count = ealryReturn ? 1 : 0;
+ GArray *matches = AtspiWrapper::Atspi_collection_get_matches_in_matches(collection, firstRule, secondRule, ATSPI_Collection_SORT_ORDER_CANONICAL, 0, count, false, NULL);
+ if (matches) {
+ ret.reserve(matches->len);
+ AtspiAccessible *match = nullptr;
+ for (unsigned int i = 0; i < matches->len; i++) {
+ match = g_array_index(matches, AtspiAccessible *, i);
+ if (match) {
+ ret.push_back(std::make_shared<AtspiAccessibleNode>(match));
+ }
+ }
+ g_array_free(matches, true);
+ }
+ g_object_unref(secondRule);
+ g_object_unref(firstRule);
+ }
+
+ return ret;
+}
return atspi_collection_get_matches(obj, rule, sortby, count, traverse, error);
}
+GArray *AtspiWrapper::Atspi_collection_get_matches_in_matches(AtspiCollection *obj, AtspiMatchRule *first_rule, AtspiMatchRule *second_rule, AtspiCollectionSortOrder sortby, gint first_count, gint second_count, gboolean traverse, GError **error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_collection_get_matches_in_matches(obj, first_rule, second_rule, sortby, first_count, second_count, traverse, error);
+}
+
AtspiAccessibleNodeInfo *AtspiWrapper::Atspi_accessible_get_node_info(AtspiAccessible *obj, GError **error)
{
std::unique_lock<std::recursive_mutex> lock(mMutex);
return ret;
}
+std::vector<std::shared_ptr<AccessibleNode>> MockAccessibleNode::getMatchesInMatches(const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool ealryReturn) const
+{
+ std::vector<std::shared_ptr<AccessibleNode>> ret{};
+
+ return ret;
+}
+
+
void* MockAccessibleNode::getRawHandler(void) const
{
printf("%s:%d / %s\n",__FILE__, __LINE__, __PRETTY_FUNCTION__);
return ret;
}
+std::vector<std::shared_ptr<UiObject>> UiDevice::getMatchesInMatches(
+ const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool earlyReturn) const
+{
+ std::vector<std::shared_ptr<UiObject>> ret{};
+
+ auto rootNodes = getWindowRoot();
+ for (const auto &window : rootNodes) {
+ auto nodes = window->getMatchesInMatches(firstSelector, secondSelector, earlyReturn);
+ for (auto &node : nodes)
+ ret.push_back(std::make_shared<UiObject>(getInstance(), nullptr, node));
+ }
+ return ret;
+}
+
bool UiDevice::waitFor(
const std::function<bool(const ISearchable *)> condition) const
{
return result;
}
+std::vector<std::shared_ptr<UiObject>> UiObject::getMatchesInMatches(
+ const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool earlyReturn) const
+{
+ std::vector<std::shared_ptr<UiObject>> result{};
+
+ auto nodes = getAccessibleNode()->getMatchesInMatches(firstSelector, secondSelector, earlyReturn);
+ for (auto &node : nodes) {
+ result.push_back(std::make_shared<UiObject>(mDevice, nullptr, std::move(node)));
+ }
+ return result;
+}
+
bool UiObject::waitFor(
const std::function<bool(const ISearchable *)> condition) const
{