There are two diffrent type of coord.
one is screen relative, other one is window relative.
This patch to support window relative coord.
https://github.sec.samsung.net/tizen/aurum/issues/5
Change-Id: I4fbec6d27f2e6a011a55282869a42e8cbaadb8ba
* @brief TBD
* @since_tizen 5.5
*/
- Rect<int> getBoundingBox() const;
+ Rect<int> getScreenBoundingBox() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 5.5
+ */
+ Rect<int> getWindowBoundingBox() const;
/**
* @brief TBD
/**
* @brief TBD
*/
- Rect<int> mBoundingBox;
+ Rect<int> mScreenBoundingBox;
+
+ /**
+ * @brief TBD
+ */
+ Rect<int> mWindowBoundingBox;
/**
* @brief TBD
* @brief TBD
* @since tizen_6.0
*/
- MockAccessibleApplication(std::shared_ptr<AccessibleNode> parent, std::string text,std::string pkg,std::string role, std::string res,std::string type,std::string style,Rect<int> boundingBox,int supportingIfaces,int featureProperty);
+ MockAccessibleApplication(std::shared_ptr<AccessibleNode> parent, std::string text,std::string pkg,std::string role, std::string res,std::string type,std::string style,Rect<int> screenBoundingBox,int supportingIfaces,int featureProperty);
/**
* @brief TBD
* @brief TBD
* @since_tizen 5.5
*/
- MockAccessibleNode(std::shared_ptr<AccessibleNode> parent, std::string text,std::string pkg,std::string role, std::string id, std::string type,std::string style, std::string automationId, Rect<int> boundingBox,int supportingIfaces,int featureProperty);
+ MockAccessibleNode(std::shared_ptr<AccessibleNode> parent, std::string text,std::string pkg,std::string role, std::string id, std::string type,std::string style, std::string automationId, Rect<int> screenBoundingBox,int supportingIfaces,int featureProperty);
/**
* @brief TBD
* @brief TBD
* @since_tizen 5.5
*/
- void setProperties(std::string text,std::string pkg, std::string role, std::string res, std::string type, std::string style,std::string automationId, Rect<int> boundingBox, int supportingIfaces, int featureProperty);
+ void setProperties(std::string text,std::string pkg, std::string role, std::string res, std::string type, std::string style,std::string automationId, Rect<int> screenBoundingBox, int supportingIfaces, int featureProperty);
private:
/**
* @brief TBD
* @since_tizen 5.5
*/
- const Rect<int> getBoundingBox() const;
+ const Rect<int> getScreenBoundingBox() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ const Rect<int> getWindowBoundingBox() const;
/**
* @brief TBD
* @brief TBD
*/
static const unsigned int LOGNCLICK_INTERVAL = 50;
-};
\ No newline at end of file
+};
AccessibleNode::AccessibleNode()
: mText{""}, mPkg{""}, mRole{""}, mId{""}, mType{""}, mStyle{""},
- mBoundingBox{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0), mValid{true}, mLock{}
+ mScreenBoundingBox{0,0,0,0}, mWindowBoundingBox{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0), mValid{true}, mLock{}
{
}
return mStyle;
}
-Rect<int> AccessibleNode::getBoundingBox() const
+Rect<int> AccessibleNode::getScreenBoundingBox() const
{
- return mBoundingBox;
+ return mScreenBoundingBox;
+}
+
+Rect<int> AccessibleNode::getWindowBoundingBox() const
+{
+ return mWindowBoundingBox;
}
bool AccessibleNode::isCheckable() const
}
AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode);
if (component) {
- AtspiRect *extent = AtspiWrapper::Atspi_component_get_extents(
+ AtspiRect *screenExtent = AtspiWrapper::Atspi_component_get_extents(
component, ATSPI_COORD_TYPE_SCREEN, NULL);
- if (extent) {
- mBoundingBox =
- Rect<int>{extent->x, extent->y, extent->x + extent->width,
- extent->y + extent->height};
- g_free(extent);
+ if (screenExtent) {
+ mScreenBoundingBox =
+ Rect<int>{screenExtent->x, screenExtent->y, screenExtent->x + screenExtent->width,
+ screenExtent->y + screenExtent->height};\
+ g_free(screenExtent);
+ }
+
+ AtspiRect *windowExtent = AtspiWrapper::Atspi_component_get_extents(
+ component, ATSPI_COORD_TYPE_WINDOW, NULL);
+ if (windowExtent) {
+ mWindowBoundingBox =
+ Rect<int>{windowExtent->x, windowExtent->y, windowExtent->x + windowExtent->width,
+ windowExtent->y + windowExtent->height};\
+ g_free(windowExtent);
}
g_object_unref(component);
}
#include <algorithm>
#include <iostream>
-MockAccessibleNode::MockAccessibleNode(std::shared_ptr<AccessibleNode> parent, std::string text, std::string pkg, std::string role, std::string res, std::string type, std::string style,std::string automationId, Rect<int> boundingBox, int supportingIfaces,int featureProperty)
+MockAccessibleNode::MockAccessibleNode(std::shared_ptr<AccessibleNode> parent, std::string text, std::string pkg, std::string role, std::string res, std::string type, std::string style,std::string automationId, Rect<int> screenBoundingBox, int supportingIfaces,int featureProperty)
: mParentNode(parent), mChildrenList{}, mActionSet{}
{
printf("%s:%d / %s\n",__FILE__, __LINE__, __PRETTY_FUNCTION__);
const auto trickDontRemove = std::shared_ptr<MockAccessibleNode>( this, [](MockAccessibleNode *){} );
- setProperties(text,pkg,role,res,type,style,automationId, boundingBox, supportingIfaces, featureProperty);
+ setProperties(text,pkg,role,res,type,style,automationId, screenBoundingBox, supportingIfaces, featureProperty);
auto watcher = AccessibleWatcher::getInstance();
watcher->attach(shared_from_this());
}
return (void*)1;
}
-void MockAccessibleNode::setProperties(std::string text,std::string pkg,std::string role,std::string id,std::string type,std::string style,std::string automationId, Rect<int> boundingBox,int supportingIfaces,int featureProperty)
+void MockAccessibleNode::setProperties(std::string text,std::string pkg,std::string role,std::string id,std::string type,std::string style,std::string automationId, Rect<int> screenBoundingBox,int supportingIfaces,int featureProperty)
{
mText = text;
mPkg = pkg;
mAutomationId = automationId;
mType = type;
mStyle = style;
- mBoundingBox = boundingBox;
+ mScreenBoundingBox = screenBoundingBox;
mSupportingIfaces = supportingIfaces;
mFeatureProperty = featureProperty;
}
return mNode->isValid();
}
-const Rect<int> UiObject::getBoundingBox() const
+const Rect<int> UiObject::getScreenBoundingBox() const
{
mNode->refresh();
- return mNode->getBoundingBox();
+ return mNode->getScreenBoundingBox();
+}
+
+const Rect<int> UiObject::getWindowBoundingBox() const
+{
+ mNode->refresh();
+ return mNode->getWindowBoundingBox();
}
void UiObject::click() const
{
mNode->refresh();
- const Rect<int> rect = mNode->getBoundingBox();
+ const Rect<int> rect = mNode->getScreenBoundingBox();
const Point2D<int> midPoint = rect.midPoint();
mDevice->click(midPoint.x, midPoint.y);
}
void UiObject::longClick(const unsigned int intv) const
{
mNode->refresh();
- const Rect<int> rect = mNode->getBoundingBox();
+ const Rect<int> rect = mNode->getScreenBoundingBox();
const Point2D<int> midPoint = rect.midPoint();
mDevice->click(midPoint.x, midPoint.y, intv);
}
root->set_elementid(key);
::aurum::Rect *rect = root->mutable_geometry();
- const Rect<int> &size = obj->getBoundingBox();
+ const Rect<int> &size = obj->getScreenBoundingBox();
rect->set_x(size.mTopLeft.x);
rect->set_y(size.mTopLeft.y);
rect->set_width(size.width());
rect->set_height(size.height());
+ ::aurum::Rect *windowRect = root->mutable_window_relative_geometry();
+ const Rect<int> &windowSize = obj->getWindowBoundingBox();
+ windowRect->set_x(windowSize.mTopLeft.x);
+ windowRect->set_y(windowSize.mTopLeft.y);
+ windowRect->set_width(windowSize.width());
+ windowRect->set_height(windowSize.height());
+
root->set_widget_type(obj->getElementType());
root->set_widget_style(obj->getElementStyle());
elm->set_package(obj->getApplicationPackage());
::aurum::Rect *rect = elm->mutable_geometry();
- const Rect<int> &size = obj->getBoundingBox();
+ const Rect<int> &size = obj->getScreenBoundingBox();
rect->set_x(size.mTopLeft.x);
rect->set_y(size.mTopLeft.y);
rect->set_width(size.width());
rect->set_height(size.height());
+
+ ::aurum::Rect *windowRect = elm->mutable_window_relative_geometry();
+ const Rect<int> &windowRelativeSize = obj->getWindowBoundingBox();
+ windowRect->set_x(windowRelativeSize.mTopLeft.x);
+ windowRect->set_y(windowRelativeSize.mTopLeft.y);
+ windowRect->set_width(windowRelativeSize.width());
+ windowRect->set_height(windowRelativeSize.height());
+
elm->set_widget_type(obj->getElementType());
elm->set_widget_style(obj->getElementStyle());
::grpc::Status GetSizeCommand::execute()
{
LOGI("GetSize --------------- ");
+
+ ::aurum::ReqGetSize_CoordType type = mRequest->type();
ObjectMapper *mObjMap = ObjectMapper::getInstance();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
if (obj) {
- const Rect<int> &size = obj->getBoundingBox();
::aurum::Rect *rect = mResponse->mutable_size();
- rect->set_x(size.mTopLeft.x);
- rect->set_y(size.mTopLeft.y);
- rect->set_width(size.width());
- rect->set_height(size.height());
+ if (type == ::aurum::ReqGetSize_CoordType::ReqGetSize_CoordType_SCREEN) {
+ const Rect<int> &size = obj->getScreenBoundingBox();
+ rect->set_x(size.mTopLeft.x);
+ rect->set_y(size.mTopLeft.y);
+ rect->set_width(size.width());
+ rect->set_height(size.height());
+ }
+ else {
+ const Rect<int> &windowRelativeSize = obj->getWindowBoundingBox();
+ rect->set_x(windowRelativeSize.mTopLeft.x);
+ rect->set_y(windowRelativeSize.mTopLeft.y);
+ rect->set_width(windowRelativeSize.width());
+ rect->set_height(windowRelativeSize.height());
+ }
}
return grpc::Status::OK;
repeated Element child = 2;
Rect geometry = 3;
-
- string widget_type = 4;
- string widget_style = 5;
-
- string text = 6;
- string id = 7;
- string automationId = 8;
- string package = 9;
- string role = 10;
-
- bool isChecked = 11;
- bool isCheckable = 12;
- bool isClickable = 13;
- bool isEnabled = 14;
- bool isFocused = 15;
- bool isFocusable = 16;
- bool isScrollable = 17;
- bool isSelected = 18;
- bool isShowing = 19;
- bool isActive = 20;
- bool isVisible = 21;
- bool isSelectable = 22;
+ Rect window_relative_geometry = 4;
+
+ string widget_type = 5;
+ string widget_style = 6;
+
+ string text = 7;
+ string id = 8;
+ string automationId = 9;
+ string package = 10;
+ string role = 11;
+
+ bool isChecked = 12;
+ bool isCheckable = 13;
+ bool isClickable = 14;
+ bool isEnabled = 15;
+ bool isFocused = 16;
+ bool isFocusable = 17;
+ bool isScrollable = 18;
+ bool isSelected = 19;
+ bool isShowing = 20;
+ bool isActive = 21;
+ bool isVisible = 22;
+ bool isSelectable = 23;
}
message Point {
}
message ReqGetSize{
- string elementId = 1;
+ enum CoordType {
+ SCREEN = 0;
+ WINDOW = 1;
+ }
+ CoordType type = 1;
+ string elementId = 2;
}
+
message RspGetSize{
RspStatus status = 1;
Rect size = 2;
ASSERT_EQ(parent->getText(), "new_test2");
}
-TEST_F(AurumTestUiObject, getBoundingBox_P1)
+TEST_F(AurumTestUiObject, getScreenBoundingBox_P1)
{
auto obj = UiDevice::getInstance();
auto parent = obj->findObject(Sel::text("test2"));
- auto box = parent->getBoundingBox();
+ auto box = parent->getScreenBoundingBox();
ASSERT_EQ(box.mBottomRight.x, 200 );
ASSERT_EQ(box.mBottomRight.y, 200 );
ASSERT_NE(obj, nullptr);
obj->click();
- auto rect = obj->getBoundingBox();
+ auto rect = obj->getScreenBoundingBox();
const Point2D<int> midPoint = rect.midPoint();
ASSERT_EQ(mDevice->mTouchRelease[1].x, midPoint.x);
ASSERT_NE(obj, nullptr);
obj->longClick(interval);
- auto rect = obj->getBoundingBox();
+ auto rect = obj->getScreenBoundingBox();
const Point2D<int> midPoint = rect.midPoint();
ASSERT_NEAR(mDevice->mTouchRelease[1].stamp1, mDevice->mTouchRelease[1].stamp2, interval*1000*1.1);