#include <mutex>
#include "IEventConsumer.h"
-#include "IObject.h"
#include "Rect.h"
#include "UiSelector.h"
#include "config.h"
*
* @since_tizen 6.5
*/
-class AccessibleNode : public std::enable_shared_from_this<AccessibleNode>, public IEventConsumer, public IObject {
+class AccessibleNode : public std::enable_shared_from_this<AccessibleNode>, public IEventConsumer {
public:
/**
* @brief AccessibleNode constructor.
/**
* @copydoc UiObject::getId()
*/
- std::string getId() const override;
+ std::string getId() const;
/**
* @copydoc UiObject::getType()
*/
- std::string getType() const override;
+ std::string getType() const;
/**
* @copydoc UiObject::getScreenBoundingBox()
*/
- const Rect<int> getScreenBoundingBox() const override;
+ const Rect<int> getScreenBoundingBox() const;
/**
* @copydoc UiObject::getOcrText()
*/
- std::string getOcrText() const override;
+ std::string getOcrText() const;
/**
* @copydoc UiObject::getWindowAngle()
*/
- int getWindowAngle() const override;
+ int getWindowAngle() const;
/**
* @copydoc UiObject::getTargetAngle()
*/
- int getTargetAngle() const override;
+ int getTargetAngle() const;
/**
* @copydoc UiObject::isFocusable()
*/
- bool isFocusable() const override;
+ bool isFocusable() const;
/**
* @copydoc UiObject::isFocused()
*/
- bool isFocused() const override;
+ bool isFocused() const;
/**
* @copydoc UiObject::isClickable()
*/
- bool isClickable() const override;
+ bool isClickable() const;
/**
* @copydoc UiObject::isActive()
*/
- bool isActive() const override;
+ bool isActive() const;
/**
* @copydoc UiObject::isShowing()
*/
- bool isShowing() const override;
+ bool isShowing() const;
public:
/**
+++ /dev/null
-/*
- * Copyright (c) 2022 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _IOBJECT_H_
-#define _IOBJECT_H_
-
-#include "config.h"
-#include "Rect.h"
-#include <string>
-
-namespace Aurum {
-
-
-class IObject {
-public:
-
- /**
- * @brief IObject destructor
- */
- virtual ~IObject() {}
-
- /**
- * @copydoc UiObject::getId()
- */
- virtual std::string getId() const = 0;
-
- /**
- * @copydoc UiObject::getType()
- */
- virtual std::string getType() const = 0;
-
- /**
- * @copydoc UiObject::getScreenBoundingBox()
- */
- virtual const Rect<int> getScreenBoundingBox() const = 0;
-
- /**
- * @copydoc UiObject::getOcrText()
- */
- virtual std::string getOcrText() const = 0;
-
- /**
- * @copydoc UiObject::getWindowAngle()
- */
- virtual int getWindowAngle() const = 0;
-
- /**
- * @copydoc UiObject::getTargetAngle()
- */
- virtual int getTargetAngle() const = 0;
-
- /**
- * @copydoc UiObject::isFocusable()
- */
- virtual bool isFocusable() const = 0;
-
- /**
- * @copydoc UiObject::isFocused()
- */
- virtual bool isFocused() const = 0;
-
- /**
- * @copydoc UiObject::isClickable()
- */
- virtual bool isClickable() const = 0;
-
- /**
- * @copydoc UiObject::isActive()
- */
- virtual bool isActive() const = 0;
-
- /**
- * @copydoc UiObject::isShowing()
- */
- virtual bool isShowing() const = 0;
-};
-
-}
-
-#endif
#include "Accessible.h"
#include "ISearchable.h"
-#include "IObject.h"
#include "UiSelector.h"
#include "Waiter.h"
* such as object's properties, states, geometry information.
* also user can send and receive event via this class.
*/
-class UiObject : public ISearchable , public std::enable_shared_from_this<UiObject>, public IObject {
+class UiObject : public ISearchable , public std::enable_shared_from_this<UiObject> {
public:
/**
* @brief UiObject constructor with device, selector, node pointer.
*
* @since_tizen 6.5
*/
- std::string getId() const override;
+ std::string getId() const;
/**
* @brief Gets object's type.
*
* @since_tizen 7.0
*/
- std::string getType() const override;
+ std::string getType() const;
/**
* @brief Gets object's geometry of the screen.
*
* @since_tizen 6.5
*/
- const Rect<int> getScreenBoundingBox() const override;
+ const Rect<int> getScreenBoundingBox() const;
/**
* @brief Gets object's ocr text.
*
* @since_tizen 7.0
*/
- std::string getOcrText() const override;
+ std::string getOcrText() const;
/**
* @brief Gets object's angle of window.
*
* @since_tizen 7.5
*/
- int getWindowAngle() const override;
+ int getWindowAngle() const;
/**
* @brief Gets object's angle of target device.
*
* @since_tizen 7.5
*/
- int getTargetAngle() const override;
+ int getTargetAngle() const;
/**
* @brief Gets object's focusable property.
*
* @since_tizen 6.5
*/
- bool isFocusable() const override;
+ bool isFocusable() const;
/**
* @brief Gets object's focused property.
*
* @since_tizen 6.5
*/
- bool isFocused() const override;
+ bool isFocused() const;
/**
* @brief Gets object's clickable property.
*
* @since_tizen 6.5
*/
- bool isClickable() const override;
+ bool isClickable() const;
/**
* @brief Gets object's active property.
*
* @since_tizen 6.5
*/
- bool isActive() const override;
+ bool isActive() const;
/**
* @brief Gets object's showing property.
*
* @since_tizen 6.5
*/
- bool isShowing() const override;
+ bool isShowing() const;
public:
/**
bool UiObject::hasObject(const std::shared_ptr<UiSelector> selector) const
{
std::shared_ptr<AccessibleNode> node =
- Comparer::findObject(mDevice, selector, getAccessibleNode());
+ Comparer::findObject(mDevice, selector, mNode);
if (node != nullptr) {
// todo : what is this node.recycle()
return true;
std::shared_ptr<UiObject> UiObject::findObject(const std::shared_ptr<UiSelector> selector) const
{
std::shared_ptr<AccessibleNode> node =
- Comparer::findObject(mDevice, selector, getAccessibleNode());
+ Comparer::findObject(mDevice, selector, mNode);
if (node)
return std::make_shared<UiObject>(mDevice, selector, std::move(node));
else
std::vector<std::shared_ptr<UiObject>> result{};
std::vector<std::shared_ptr<AccessibleNode>> nodes{};
- Comparer::findObjects(nodes, mDevice, selector, getAccessibleNode());
+ Comparer::findObjects(nodes, mDevice, selector, mNode);
for ( auto& node : nodes) {
if (!node) {
LOGI("Skipped! (node == nullptr)");
{
std::vector<std::shared_ptr<UiObject>> result{};
- auto nodes = getAccessibleNode()->getMatches(selector, earlyReturn);
+ auto nodes = mNode->getMatches(selector, earlyReturn);
for (auto &node : nodes) {
result.push_back(std::make_shared<UiObject>(mDevice, selector, std::move(node)));
}
{
std::vector<std::shared_ptr<UiObject>> result{};
- auto nodes = getAccessibleNode()->getMatchesInMatches(firstSelector, secondSelector, earlyReturn);
+ auto nodes = mNode->getMatchesInMatches(firstSelector, secondSelector, earlyReturn);
for (auto &node : nodes) {
result.push_back(std::make_shared<UiObject>(mDevice, nullptr, std::move(node)));
}
UiObject *UiObject::getParent() const
{
- std::shared_ptr<AccessibleNode> node = getAccessibleNode()->getParent();
+ std::shared_ptr<AccessibleNode> node = mNode->getParent();
if (!node) return nullptr;
return new UiObject(mDevice, mSelector, std::move(node));
}
int UiObject::getChildCount() const
{
- return getAccessibleNode()->getChildCount();
+ return mNode->getChildCount();
}
std::shared_ptr<UiObject> UiObject::getChildAt(int index) const {
- auto childNode = getAccessibleNode()->getChildAt(index);
+ auto childNode = mNode->getChildAt(index);
if (childNode) {
return std::make_shared<UiObject>(mDevice, mSelector, childNode);
}
{
std::vector<std::shared_ptr<UiObject>> ret{};
- auto children = getAccessibleNode()->getChildren();
+ auto children = mNode->getChildren();
for (auto &child : children) {
ret.push_back(std::make_shared<UiObject>(mDevice, mSelector, child));
}
std::string UiObject::getApplicationPackage() const
{
- return getAccessibleNode()->getPkg();
+ return mNode->getPkg();
}
std::string UiObject::getId() const
{
- return getAccessibleNode()->getId();
+ return mNode->getId();
}
std::string UiObject::getAutomationId() const
{
- return getAccessibleNode()->getAutomationId();
+ return mNode->getAutomationId();
}
std::string UiObject::getType() const
{
- return getAccessibleNode()->getType();
+ return mNode->getType();
}
std::string UiObject::getElementStyle() const
{
- return getAccessibleNode()->getStyle();
+ return mNode->getStyle();
}
std::string UiObject::getText() const
{
- return getAccessibleNode()->getText();
+ return mNode->getText();
}
std::string UiObject::getRole() const
{
- return getAccessibleNode()->getRole();
+ return mNode->getRole();
}
std::string UiObject::getXPath() const
{
- return getAccessibleNode()->getXPath();
+ return mNode->getXPath();
}
const double UiObject::getMinValue() const
{
- return getAccessibleNode()->getMinValue();
+ return mNode->getMinValue();
}
const double UiObject::getMaxValue() const
{
- return getAccessibleNode()->getMaxValue();
+ return mNode->getMaxValue();
}
const double UiObject::getValue() const
{
- return getAccessibleNode()->getValue();
+ return mNode->getValue();
}
const double UiObject::getIncrement() const
{
- return getAccessibleNode()->getIncrement();
+ return mNode->getIncrement();
}
const Rect<int> UiObject::getTextMinBoundingRect() const
{
- return getAccessibleNode()->getTextMinBoundingRect();
+ return mNode->getTextMinBoundingRect();
}
std::string UiObject::getInterface() const
{
- return getAccessibleNode()->getInterface();
+ return mNode->getInterface();
}
bool UiObject::setValue(double value)
{
- return getAccessibleNode()->setValue(value);
+ return mNode->setValue(value);
}
bool UiObject::setText(std::string text)
{
- return getAccessibleNode()->setValue(text);
+ return mNode->setValue(text);
}
std::string UiObject::getOcrText() const
{
- return getAccessibleNode()->getOcrText();
+ return mNode->getOcrText();
}
int UiObject::getWindowAngle() const
{
- return getAccessibleNode()->getWindowAngle();
+ return mNode->getWindowAngle();
}
int UiObject::getTargetAngle() const
{
- return getAccessibleNode()->getTargetAngle();
+ return mNode->getTargetAngle();
}
std::string UiObject::getToolkitName() const
{
- getAccessibleNode()->updateToolkitName();
- return getAccessibleNode()->getToolkitName();
+ mNode->updateToolkitName();
+ return mNode->getToolkitName();
}
void UiObject::setOcrText(std::string text)
{
- getAccessibleNode()->setOcrText(text);
+ mNode->setOcrText(text);
}
bool UiObject::isCheckable() const
{
- return getAccessibleNode()->isCheckable();
+ return mNode->isCheckable();
}
bool UiObject::isChecked() const
{
- return getAccessibleNode()->isChecked();
+ return mNode->isChecked();
}
bool UiObject::isClickable() const
{
- return getAccessibleNode()->isClickable();
+ return mNode->isClickable();
}
bool UiObject::isEnabled() const
{
- return getAccessibleNode()->isEnabled();
+ return mNode->isEnabled();
}
bool UiObject::isFocusable() const
{
- return getAccessibleNode()->isFocusable();
+ return mNode->isFocusable();
}
bool UiObject::isFocused() const
{
- return getAccessibleNode()->isFocused();
+ return mNode->isFocused();
}
bool UiObject::isLongClickable() const
{
- return getAccessibleNode()->isLongClickable();
+ return mNode->isLongClickable();
}
bool UiObject::isScrollable() const
{
- return getAccessibleNode()->isScrollable();
+ return mNode->isScrollable();
}
bool UiObject::isSelectable() const
{
- return getAccessibleNode()->isSelectable();
+ return mNode->isSelectable();
}
bool UiObject::isSelected() const
{
- return getAccessibleNode()->isSelected();
+ return mNode->isSelected();
}
bool UiObject::isVisible() const
{
- return getAccessibleNode()->isVisible();
+ return mNode->isVisible();
}
bool UiObject::isShowing() const
{
- return getAccessibleNode()->isShowing();
+ return mNode->isShowing();
}
bool UiObject::isActive() const
{
- return getAccessibleNode()->isActive();
+ return mNode->isActive();
}
bool UiObject::isHighlightable() const
{
- return getAccessibleNode()->isHighlightable();
+ return mNode->isHighlightable();
}
void UiObject::refresh() const
return mNode->getWindowBoundingBox();
}
+const Point2D<int> getMidPoint(std::shared_ptr<Aurum::AccessibleNode> node)
+{
+ node->updateExtents();
+ const Rect<int> rect = node->getScreenBoundingBox();
+ return rect.midPoint();
+}
+
void UiObject::click() const
{
- mNode->updateExtents();
- const Rect<int> rect = mNode->getScreenBoundingBox();
- const Point2D<int> midPoint = rect.midPoint();
+ const Point2D<int> midPoint = getMidPoint(mNode);
mDevice->click(midPoint.x, midPoint.y);
}
void UiObject::longClick(const unsigned int durationMs) const
{
- mNode->updateExtents();
- const Rect<int> rect = mNode->getScreenBoundingBox();
- const Point2D<int> midPoint = rect.midPoint();
+ const Point2D<int> midPoint = getMidPoint(mNode);
mDevice->click(midPoint.x, midPoint.y, durationMs);
}