There was a constraint that the entire text must match.
It is a function that improves usability through interface expansion.
Change-Id: I8b4b996aa4d3a3badbe118c2fee44892a74a830a
*
* @param[in] textA string
* @param[in] textB string
+ * @param[in] textPartialMatch bool
*
* @return ture if matched, else false
*
* @since_tizen 6.5
*/
- static bool checkCriteria(const std::string textA, const std::string textB);
+ static bool checkCriteria(const std::string textA, const std::string textB, const bool textPartialMatch);
/**
* @brief Checks boolean value matched or not.
UiSelector *text(std::string text);
/**
+ * @brief Sets the search criteria to match the object's text has given text.
+ *
+ * @param[in] text object text
+ *
+ * @return UiSelector class instance
+ *
+ * @since_tizen 6.5
+ */
+ UiSelector *textPartialMatch(std::string text);
+
+ /**
* @brief Sets the search criteria to match the object's package name.
*
* @param[in] text object package name
std::string mPkg;
std::string mType;
std::string mStyle;
+ std::string mTextPartialMatch;
bool mMatchId;
bool mMatchAutomationId;
bool mMatchPkg;
bool mMatchType;
bool mMatchStyle;
+ bool mMatchTextPartialMatch;
bool mMatchChecked;
bool mMatchCheckable;
using namespace Aurum;
-bool PartialMatch::checkCriteria(const std::string textA, const std::string textB)
+bool PartialMatch::checkCriteria(const std::string textA, const std::string textB, const bool textPartialMatch)
{
std::regex re(textA);
- bool rst = !(!!std::regex_match(textB, re) == true);
+ bool rst;
+ if (textPartialMatch) rst = !(!!std::regex_search(textB, re) == true);
+ else rst = !(!!std::regex_match(textB, re) == true);
return rst;
}
bool PartialMatch::checkCriteria(const std::shared_ptr<UiSelector> selector,
const std::shared_ptr<AccessibleNode> node)
{
- if (selector->mMatchText) {
+ if (selector->mMatchText || selector->mMatchTextPartialMatch) {
node->updateName();
- if (checkCriteria(selector->mText, node->getText())) return false;
+ if (selector->mMatchText && checkCriteria(selector->mText, node->getText(), 0)) return false;
+ if (selector->mMatchTextPartialMatch && checkCriteria(selector->mTextPartialMatch, node->getText(), 1)) return false;
}
if (selector->mMatchId) {
node->updateUniqueId();
- if (checkCriteria(selector->mId, node->getId())) return false;
+ if (checkCriteria(selector->mId, node->getId(), 0)) return false;
}
if (selector->mMatchType || selector->mMatchAutomationId || selector->mMatchStyle) {
node->updateAttributes();
- if (selector->mMatchAutomationId && checkCriteria(selector->mAutomationId, node->getAutomationId())) return false;
- if (selector->mMatchType && checkCriteria(selector->mType, node->getType())) return false;
- if (selector->mMatchStyle && checkCriteria(selector->mStyle, node->getStyle())) return false;
+ if (selector->mMatchAutomationId && checkCriteria(selector->mAutomationId, node->getAutomationId(), 0)) return false;
+ if (selector->mMatchType && checkCriteria(selector->mType, node->getType(), 0)) return false;
+ if (selector->mMatchStyle && checkCriteria(selector->mStyle, node->getStyle(), 0)) return false;
}
if (selector->mMatchPkg) {
node->updateApplication();
- if (checkCriteria(selector->mPkg, node->getPkg())) return false;
+ if (checkCriteria(selector->mPkg, node->getPkg(), 0)) return false;
}
if (selector->mMatchRole) {
node->updateRoleName();
- if (checkCriteria(selector->mRole, node->getRole())) return false;
+ if (checkCriteria(selector->mRole, node->getRole(), 0)) return false;
}
if (selector->mMatchChecked && checkCriteria(selector->mIschecked, node->isChecked())) return false;
if (selector->mMatchCheckable && checkCriteria(selector->mIscheckable, node->isCheckable())) return false;
using namespace Aurum;
UiSelector::UiSelector()
-: mId{}, mAutomationId{}, mRole{}, mText{}, mPkg{}, mType{}, mStyle{},
- mMatchId{}, mMatchAutomationId{}, mMatchRole{}, mMatchText{}, mMatchPkg{}, mMatchType{}, mMatchStyle{},
- mMatchChecked{}, mMatchCheckable{}, mMatchClickable{}, mMatchEnabled{}, mMatchFocused{}, mMatchFocusable{},
- mMatchScrollable{}, mMatchSelected{}, mMatchShowing{}, mMatchActive{}, mMatchVisible{}, mMatchSelectable{},
- mMinDepth{}, mMaxDepth{}, mIschecked{}, mIscheckable{}, mIsclickable{},
- mIsenabled{}, mIsfocused{}, mIsfocusable{}, mIsscrollable{}, mIsselected{},
- mIsshowing{}, mIsactive{}, mIsvisible{}, mIsselectable{},
- mChild{}, mParent{}
+: mId{}, mAutomationId{}, mRole{}, mText{}, mTextPartialMatch{}, mPkg{}, mType{}, mStyle{},
+ mMatchId{}, mMatchAutomationId{}, mMatchRole{}, mMatchText{}, mMatchTextPartialMatch{}, mMatchPkg{}, mMatchType{},
+ mMatchStyle{}, mMatchChecked{}, mMatchCheckable{}, mMatchClickable{}, mMatchEnabled{}, mMatchFocused{},
+ mMatchFocusable{}, mMatchScrollable{}, mMatchSelected{}, mMatchShowing{}, mMatchActive{}, mMatchVisible{},
+ mMatchSelectable{}, mMinDepth{}, mMaxDepth{}, mIschecked{}, mIscheckable{}, mIsclickable{}, mIsenabled{},
+ mIsfocused{}, mIsfocusable{}, mIsscrollable{}, mIsselected{}, mIsshowing{}, mIsactive{}, mIsvisible{},
+ mIsselectable{}, mChild{}, mParent{}
{
}
if(!this->mAutomationId.empty()) ss << "\"mAutomationId\":\"" << this->mAutomationId << "\", ";
if(!this->mRole.empty()) ss << "\"mRole\":\"" << this->mRole << "\", ";
if(!this->mText.empty()) ss << "\"mText\":\"" << this->mText << "\", ";
+ if(!this->mTextPartialMatch.empty()) ss << "\"mTextPartialMatch\":\"" << this->mTextPartialMatch << "\", ";
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->mMatchAutomationId) ss << "\"mMatchAutomationId\":\"" << ((this->mMatchAutomationId)?"true":"false") << "\", ";
if(this->mMatchRole) ss << "\"mMatchRole\":\"" << ((this->mMatchRole)?"true":"false") << "\", ";
if(this->mMatchText) ss << "\"mMatchText\":\"" << ((this->mMatchText)?"true":"false") << "\", ";
+ if(this->mMatchTextPartialMatch) ss << "\"mMatchTextPartialMatch\":\"" << ((this->mMatchTextPartialMatch)?"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" )<< "\", ";
return this;
}
+UiSelector *UiSelector::textPartialMatch(std::string text)
+{
+ this->mTextPartialMatch = text;
+ this->mMatchTextPartialMatch = true;
+ return this;
+}
+
UiSelector *UiSelector::pkg(std::string text)
{
this->mPkg = text;
{
auto sel = std::make_shared<UiSelector>();
- if(mRequest->_elementid_case()) sel->id(mRequest->elementid());
- if(mRequest->_automationid_case()) sel->automationid(mRequest->automationid());
- if(mRequest->_textfield_case()) sel->text(mRequest->textfield());
- if(mRequest->_widgettype_case()) sel->type(mRequest->widgettype());
- if(mRequest->_widgetstyle_case()) sel->style(mRequest->widgetstyle());
- if(mRequest->_ischecked_case()) sel->isChecked(mRequest->ischecked());
- if(mRequest->_ischeckable_case()) sel->isCheckable(mRequest->ischeckable());
- if(mRequest->_isclickable_case()) sel->isClickable(mRequest->isclickable());
- if(mRequest->_isenabled_case()) sel->isEnabled(mRequest->isenabled());
- if(mRequest->_isfocused_case()) sel->isFocused(mRequest->isfocused());
- if(mRequest->_isfocusable_case()) sel->isFocusable(mRequest->isfocusable());
- if(mRequest->_isscrollable_case()) sel->isScrollable(mRequest->isscrollable());
- if(mRequest->_isselected_case()) sel->isSelected(mRequest->isselected());
- if(mRequest->_isshowing_case()) sel->isShowing(mRequest->isshowing());
- if(mRequest->_isactive_case()) sel->isActive(mRequest->isactive());
- if(mRequest->_mindepth_case()) sel->minDepth(mRequest->mindepth());
- if(mRequest->_maxdepth_case()) sel->maxDepth(mRequest->maxdepth());
- if(mRequest->_packagename_case()) sel->pkg(mRequest->packagename());
+ if(mRequest->_elementid_case()) sel->id(mRequest->elementid());
+ if(mRequest->_automationid_case()) sel->automationid(mRequest->automationid());
+ if(mRequest->_textfield_case()) sel->text(mRequest->textfield());
+ if(mRequest->_widgettype_case()) sel->type(mRequest->widgettype());
+ if(mRequest->_widgetstyle_case()) sel->style(mRequest->widgetstyle());
+ if(mRequest->_ischecked_case()) sel->isChecked(mRequest->ischecked());
+ if(mRequest->_ischeckable_case()) sel->isCheckable(mRequest->ischeckable());
+ if(mRequest->_isclickable_case()) sel->isClickable(mRequest->isclickable());
+ if(mRequest->_isenabled_case()) sel->isEnabled(mRequest->isenabled());
+ if(mRequest->_isfocused_case()) sel->isFocused(mRequest->isfocused());
+ if(mRequest->_isfocusable_case()) sel->isFocusable(mRequest->isfocusable());
+ if(mRequest->_isscrollable_case()) sel->isScrollable(mRequest->isscrollable());
+ if(mRequest->_isselected_case()) sel->isSelected(mRequest->isselected());
+ if(mRequest->_isshowing_case()) sel->isShowing(mRequest->isshowing());
+ if(mRequest->_isactive_case()) sel->isActive(mRequest->isactive());
+ if(mRequest->_mindepth_case()) sel->minDepth(mRequest->mindepth());
+ if(mRequest->_maxdepth_case()) sel->maxDepth(mRequest->maxdepth());
+ if(mRequest->_packagename_case()) sel->pkg(mRequest->packagename());
+ if(mRequest->_textpartialmatch_case()) sel->textPartialMatch(mRequest->textpartialmatch());
return std::vector<std::shared_ptr<UiSelector>>{sel};
}
string packageName = 18;
}
- repeated ReqFindElement children = 19;
+ oneof _textpartialmatch {
+ string textPartialMatch = 19;
+ }
+
+ repeated ReqFindElement children = 20;
}
message RspFindElement {
RspStatus status = 1;