*
* @since_tizen 6.5
*/
- inline bool operator==(const Point2D<T>& rhs)
+ inline bool operator==(const Point2D<T>& rhs) const
{
return this->x == rhs.x && this->y == rhs.y;
}
*
* @since_tizen 6.5
*/
- inline bool operator!=(const Point2D<T>& rhs)
+ inline bool operator!=(const Point2D<T>& rhs) const
{
return !(*this == rhs);
}
return false;
}
+ bool isInRect(const Rect<int> &rect) const
+ {
+ if (rect.mTopLeft.x >= mTopLeft.x && rect.mBottomRight.x <= mBottomRight.x
+ && rect.mTopLeft.y >= mTopLeft.y && rect.mBottomRight.y <= mBottomRight.y)
+ return true;
+
+ return false;
+ }
+
/**
* @brief Checks given Rect is same as this or not.
*
*
* @since_tizen 6.5
*/
- inline bool operator==(const Rect<T>& rhs)
+ inline bool operator==(const Rect<T>& rhs) const
{
return this->mTopLeft == rhs.mTopLeft && this->mBottomRight == rhs.mBottomRight;
}
*
* @since_tizen 6.5
*/
- inline bool operator!=(const Rect<T>& rhs){
+ inline bool operator!=(const Rect<T>& rhs) const
+ {
return !(*this == rhs);
}
*/
static bool checkCriteria(const bool boolA, const bool boolB);
+ /**
+ * @brief Checks Rectangle matched or not.
+ *
+ * @param[in] rectA Rect<int>
+ * @param[in] rectB Rect<int>
+ *
+ * @return ture if matched, else false
+ *
+ * @since_tizen 7.0
+ */
+ static bool checkCriteria(const Rect<int> rectA, const Rect<int> rectB, const bool isEqual);
+
private:
const std::shared_ptr<UiSelector> mSelector;
const int mDepth;
*/
UiSelector *xpath(std::string xpath);
+ /**
+ * @brief Sets the search criteria to match the object's geometry.
+ *
+ * @param[in] geometry Rect<int>
+ * @param[in] isEqual bool
+ *
+ * @return UiSelector class instance
+ *
+ * @since_tizen 7.0
+ */
+ UiSelector *geometry(Rect<int> geometry, bool isEqual);
+
public:
std::string mId;
std::string mAutomationId;
bool mMatchTextPartialMatch;
bool mMatchXPath;
bool mMatchOcrText;
+ bool mMatchGeometry;
bool mMatchChecked;
bool mMatchCheckable;
bool mIsvisible;
bool mIsselectable;
+ bool mGeometryIsEqual;
+
std::vector<std::shared_ptr<UiSelector>> mChild;
std::shared_ptr<UiSelector> mParent;
+
+ Rect<int> mGeometry;
};
}
return boolA != boolB;
}
+bool PartialMatch::checkCriteria(const Rect<int> rectA, const Rect<int> rectB, bool isEqual)
+{
+ if (isEqual) {
+ return rectA != rectB;
+ }
+ else {
+ return !rectA.isInRect(rectB);
+ }
+}
+
std::string PartialMatch::debugPrint()
{
return mSelector->description();
node->updateRoleName();
if (checkCriteria(selector->mRole, node->getRole(), 0)) return false;
}
+ if (selector->mMatchGeometry) {
+ node->updateExtents();
+ if (checkCriteria(selector->mGeometry, node->getScreenBoundingBox(), selector->mGeometryIsEqual)) return false;
+ }
if (selector->mMatchChecked && checkCriteria(selector->mIschecked, node->isChecked())) return false;
if (selector->mMatchCheckable && checkCriteria(selector->mIscheckable, node->isCheckable())) return false;
if (selector->mMatchClickable && checkCriteria(selector->mIsclickable, node->isClickable())) return false;
mMatchFocused{}, mMatchFocusable{}, mMatchScrollable{}, mMatchSelected{}, mMatchShowing{}, mMatchActive{}, mMatchVisible{},
mMatchSelectable{}, mMinDepth{}, mMaxDepth{}, mIschecked{}, mIscheckable{}, mIsclickable{}, mIsenabled{},
mIsfocused{}, mIsfocusable{}, mIsscrollable{}, mIsselected{}, mIsshowing{}, mIsactive{}, mIsvisible{},
- mIsselectable{}, mChild{}, mParent{}
+ mIsselectable{}, mChild{}, mParent{}, mGeometry{}
{
}
if(!this->mPkg.empty()) ss << "\"mPkg\":\"" << this->mPkg << "\", ";
if(!this->mType.empty()) ss << "\"mType\":\"" << this->mType << "\", ";
if(!this->mStyle.empty()) ss << "\"mStyle\":\"" << this->mStyle << "\", ";
+ if(this->mMatchGeometry) ss << "\"mGeometry\":\"" << this->mGeometry.mTopLeft.x << "//" << this->mGeometry.mTopLeft.y << "//" << this->mGeometry.width() << "//" << this->mGeometry.height() << "\", ";
if(this->mMatchId) ss << "\"mMatchId\":\"" << ((this->mMatchId)?"true":"false") << "\", ";
if(this->mMatchAutomationId) ss << "\"mMatchAutomationId\":\"" << ((this->mMatchAutomationId)?"true":"false") << "\", ";
if(this->mMatchRole) ss << "\"mMatchRole\":\"" << ((this->mMatchRole)?"true":"false") << "\", ";
if(this->mMatchPkg) ss << "\"mMatchPkg\":\"" << ((this->mMatchPkg)?"true":"false") << "\", ";
if(this->mMatchType) ss << "\"mMatchType\":\"" << ((this->mMatchType)?"true":"false") << "\", ";
if(this->mMatchStyle) ss << "\"mMatchStyle\":\"" << ((this->mMatchStyle)?"true":"false" )<< "\", ";
+ if(this->mMatchGeometry) ss << "\"mMatchGeometry\":\"" << ((this->mMatchGeometry)?"true":"false" )<< "\", ";
if(this->mMinDepth) ss << "\"mMinDepth\":\"" << this->mMinDepth << "\", ";
if(this->mMaxDepth) ss << "\"mMaxDepth\":\"" << this->mMaxDepth << "\", ";
if(this->mMatchChecked) ss << "\"mMatchChecked\":\"" << ((this->mMatchChecked)?"true":"false") << "\", ";
mParent = parent;
return this;
}
+
+UiSelector *UiSelector::geometry(Rect<int> geometry, bool isEqual)
+{
+ this->mGeometry = geometry;
+ this->mGeometryIsEqual = isEqual;
+ this->mMatchGeometry = true;
+ return this;
+}
\ No newline at end of file
if(mRequest->_textpartialmatch_case()) sel->textPartialMatch(mRequest->textpartialmatch());
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);
return sel;
}
if(mRequest->_textpartialmatch_case()) sel->textPartialMatch(mRequest->textpartialmatch());
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);
return std::vector<std::shared_ptr<UiSelector>>{sel};
}
string ocrText = 21;
}
- repeated ReqFindElement children = 22;
+ oneof _geometry {
+ Rect geometry = 22;
+ }
+
+ repeated ReqFindElement children = 23;
}
message RspFindElement {
oneof _ocrtext {
string ocrText = 21;
}
- repeated ReqFindElements children = 22;
+
+ oneof _geometry {
+ Rect geometry = 22;
+ }
+
+ repeated ReqFindElements children = 23;
}
message RspFindElements {