From: Woochanlee Date: Thu, 21 Oct 2021 08:26:04 +0000 (+0900) Subject: libaurum: Add doc for Public classes X-Git-Tag: submit/tizen_6.5/20211108.100005~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d254d94ba8d3f511e641d51627a2c0d110c6e53f;p=platform%2Fcore%2Fuifw%2Faurum.git libaurum: Add doc for Public classes It includes performance improve feature. - Using the unique_ptr variable, the phenomenon of continuous memory reference occured is that it has improved performance through a variable static declaration. Change-Id: I1f3a42c73136e9c0e9843b1a13e31eb7f19994f7 --- diff --git a/libaurum/inc/A11yEvent.h b/libaurum/inc/A11yEvent.h index 3ed5d07..f7b23bd 100644 --- a/libaurum/inc/A11yEvent.h +++ b/libaurum/inc/A11yEvent.h @@ -21,6 +21,13 @@ #include "bitmask.h" #include +/** + * @class A11yEvent + * + * @ingroup aurum + * + * @brief Enum class for A11y Event. + */ enum class A11yEvent { EVENT_NONE = 0x00000, EVENT_WINDOW_CREATE = 0x00001, @@ -47,16 +54,88 @@ enum class A11yEvent { enableEnumClassBitfield(A11yEvent); +/** + * @class A11yEventInfo + * + * @ingroup aurum + * + * @brief Class that defines the methods for matching the actual A11y Event with an enum value. + */ class A11yEventInfo { public: + /** + * @brief A11yEventInfo constructor. + * + * @since_tizen 5.5 + */ A11yEventInfo(); - A11yEventInfo(A11yEvent event, std::string name = "", std::string pkg = ""); - A11yEventInfo(std::string event, std::string name = "", std::string pkg = ""); + + /** + * @brief A11yEventInfo constructor with event as enum value, name, package. + * + * @param[in] event @A11yEvent + * @param[in] name name of the ATSPI event + * @param[in] package event occured package name + * + * @since_tizen 5.5 + */ + A11yEventInfo(A11yEvent event, std::string name = "", std::string package = ""); + + /** + * @brief A11yEventInfo constructor with event as string value, name, package. + * + * @param[in] event name of the event + * @param[in] name name of the ATSPI event + * @param[in] package event occured package name + * + * @since_tizen 5.5 + */ + A11yEventInfo(std::string event, std::string name = "", std::string package = ""); + + /** + * @brief A11yEventInfo destructor. + * + * @since_tizen 5.5 + */ ~A11yEventInfo(); + public: + /** + * @brief Gets A11yEvent. + * + * @return @A11yEvent + * + * @since_tizen 5.5 + */ A11yEvent getEvent(); + + /** + * @brief Gets matched A11yEvent. + * + * @param[in] event name of event + * + * @return @A11yEvent + * + * @since_tizen 5.5 + */ A11yEvent getEvent(std::string event); + + /** + * @brief Gets event name of event. + * + * @return name string + * + * @since_tizen 5.5 + */ std::string getName(); + + /** + * @brief Gets package name of event. + * + * @return package name string + * + * @since_tizen 5.5 + */ std::string getPkg(); protected: diff --git a/libaurum/inc/Comparer.h b/libaurum/inc/Comparer.h index fe93d4d..ae1ccab 100644 --- a/libaurum/inc/Comparer.h +++ b/libaurum/inc/Comparer.h @@ -31,35 +31,62 @@ #include /** - * @brief Comparer class - * @since_tizen 5.5 + * @class Comparer + * + * @ingroup aurum + * + * @brief Class that traverses the object tree and finds an object that match the givin condition. */ class Comparer { private: /** - * @brief TBD + * @brief Comparer constructor with device, selector, early return flag. + * + * @param[in] device @UiDevice + * @param[in] selector @UiSelctor + * @param[in] earlyReturn flag for early return + * * @since_tizen 5.5 */ Comparer(const std::shared_ptr device, const std::shared_ptr selector, const bool &earlyReturn); /** - * @brief TBD + * @brief Comparer destructor. + * * @since_tizen 5.5 */ ~Comparer(); public: /** - * @brief TBD + * @brief find object from device. + * it finds focused window then start to find object as it root. + * + * @param[in] device @UiDevice + * @param[in] selector @UiSelector + * @param[in] root @AccessibleNode root object(focused window on current state) + * + * @return AccessibleNode if found, else nulltpr + * * @since_tizen 5.5 */ - static std::shared_ptr findObject(const std::shared_ptr device, - const std::shared_ptr selector, - const std::shared_ptr root); + static std::shared_ptr findObject(const std::shared_ptr device, + const std::shared_ptr selector, + const std::shared_ptr root); /** - * @brief TBD + * @brief find object from device. + * it finds focused window then start to find object as it root. + * Finds all objects to the end of tree. + * + * @param[in] device @UiDevice + * @param[in] selector @UiSelector + * @param[in] root @AccessibleNode root object(focused window on current state) + * @param[in] earlyReturn find all object or not (default = false) + * + * @return AccessibleNode if found, else nulltpr + * * @since_tizen 5.5 */ static std::vector> findObjects( @@ -68,13 +95,26 @@ public: private: /** - * @brief TBD + * @internal + * + * @brief Starts find object from root. + * + * @param[in] root @AccessibleNode + * * @since_tizen 5.5 */ std::vector> findObjects(const std::shared_ptr root); /** - * @brief TBD + * @internal + * + * @brief It updates all partialMatches and traverse tree till given depth to find objects + * + * @param[in] root @AccessibleNode + * @param[in] index node index + * @param[in] depth tree depth + * @param[in] partialMatches @PartialMatch list + * * @since_tizen 5.5 */ std::vector> findObjects( @@ -82,20 +122,9 @@ private: std::list> &partialMatches); private: - /** - * @brief TBD - */ const std::shared_ptr mDevice; - - /** - * @brief TBD - */ const std::shared_ptr mSelector; - - /** - * @brief TBD - */ - bool mEarlyReturn; + bool mEarlyReturn; }; #endif diff --git a/libaurum/inc/Interface/ISearchable.h b/libaurum/inc/Interface/ISearchable.h index 04df60f..fe25b09 100644 --- a/libaurum/inc/Interface/ISearchable.h +++ b/libaurum/inc/Interface/ISearchable.h @@ -26,34 +26,53 @@ #include class UiObject; + /** - * @brief ISearchable interface - * @since_tizen 5.5 + * @class ISearchable + * + * @ingroup aurum + * + * @brief ISearchable interface that defines a methods for the behavior search object in ui layout hierarchy. */ class ISearchable { public: - /** - * @brief TBD + * @brief ISearchable Destructor. + * * @since_tizen 5.5 */ virtual ~ISearchable() {} /** - * @brief TBD + * @brief Checks that there is an object that are satisfied with selector condition. + * + * @param[in] selector @UiSelctor + * + * @return true if object has, else false + * * @since_tizen 5.5 */ virtual bool hasObject(const std::shared_ptr selector) const = 0; /** - * @brief TBD + * @brief Finds object that is satisfied with selector condition. + * + * @param[in] selector @UiSelctor + * + * @return UiObject if succeed, else nulltpr + * * @since_tizen 5.5 */ virtual std::shared_ptr findObject( const std::shared_ptr selector) const = 0; /** - * @brief TBD + * @brief Finds objects that are satisfied with selector condition. + * + * @param[in] selector @UiSelctor + * + * @return UiObject vector if succeed, else nulltpr + * * @since_tizen 5.5 */ virtual std::vector> findObjects( diff --git a/libaurum/inc/Misc/Point2D.h b/libaurum/inc/Misc/Point2D.h index ee4f18a..1baddb9 100644 --- a/libaurum/inc/Misc/Point2D.h +++ b/libaurum/inc/Misc/Point2D.h @@ -19,20 +19,27 @@ #define _POINT2D_H_ /** - * @brief Point2d Class - * @since_tizen 5.5 + * @class Point2D + * + * @ingroup aurum + * + * @brief Class for X, Y coordinate expression and operation. */ template class Point2D { public: /** - * @brief TBD + * @brief Point2D constructor. + * * @since_tizen 5.5 */ Point2D() : x{0}, y{0} {} /** - * @brief TBD + * @brief Point2D constructor with Point2D source. + * + * @param[in] src Point2D source + * * @since_tizen 5.5 */ Point2D(const Point2D &src) @@ -42,7 +49,11 @@ public: } /** - * @brief TBD + * @brief Point2D constructor with template. + * + * @param[in] x x coordinate + * @param[in] y y coordinate + * * @since_tizen 5.5 */ Point2D(const T &x, const T &y) @@ -52,7 +63,12 @@ public: } /** - * @brief TBD + * @brief Checks given coordinate is same as this or not. + * + * @param[in] rhs @Point2D + * + * @return true if same, else false + * * @since_tizen 5.5 */ inline bool operator==(const Point2D& rhs) @@ -61,7 +77,12 @@ public: } /** - * @brief TBD + * @brief Checks given coordinate is not same as this or not. + * + * @param[in] rhs @Point2D + * + * @return true if same, else false + * * @since_tizen 5.5 */ inline bool operator!=(const Point2D& rhs) @@ -69,14 +90,7 @@ public: return !(*this == rhs); } - /** - * @brief TBD - */ T x; - - /** - * @brief TBD - */ T y; }; diff --git a/libaurum/inc/Misc/Rect.h b/libaurum/inc/Misc/Rect.h index 590206b..5984670 100644 --- a/libaurum/inc/Misc/Rect.h +++ b/libaurum/inc/Misc/Rect.h @@ -21,20 +21,28 @@ #include "Point2D.h" /** - * @brief Rect Class - * @since_tizen 5.5 + * @class Rect + * + * @ingroup aurum + * + * @brief Class for Rect expression and operation. */ template class Rect { public: /** - * @brief TBD + * @brief Rect constructor. + * * @since_tizen 5.5 */ Rect() : mTopLeft{0, 0}, mBottomRight{0, 0} {} /** - * @brief TBD + * @brief Rect constructor with top topleft point, bottom right point + * + * @param[in] tl top left @Point2D + * @param[in] br bottom right @Point2D + * * @since_tizen 5.5 */ Rect(const Point2D &tl, const Point2D &br) @@ -43,7 +51,13 @@ public: } /** - * @brief TBD + * @brief Rect constructor with top left, top right, bottom left, bottom right coordinates. + * + * @param[in] x1 top left x coordinate + * @param[in] y1 top left y coordinate + * @param[in] x2 bottom right x coordinate + * @param[in] y2 bottom right y coordinate + * * @since_tizen 5.5 */ Rect(const T &x1, const T &y1, const T &x2, const T &y2) @@ -52,7 +66,10 @@ public: } /** - * @brief TBD + * @brief Rect constructor with Rect source. + * + * @param[in] src Rect source + * * @since_tizen 5.5 */ Rect(const Rect &src) @@ -63,7 +80,10 @@ public: } /** - * @brief TBD + * @brief Gets middle point of Rect. + * + * @return Point2D + * * @since_tizen 5.5 */ Point2D midPoint() const @@ -73,19 +93,30 @@ public: } /** - * @brief TBD + * @brief Gets width value of Rect. + * + * @return width value + * * @since_tizen 5.5 */ T width() const { return mBottomRight.x - mTopLeft.x; } /** - * @brief TBD + * @brief Gets height value of Rect. + * + * @return height value + * * @since_tizen 5.5 */ T height() const { return mBottomRight.y - mTopLeft.y; } /** - * @brief TBD + * @brief Checks given Rect is same as this or not. + * + * @param[in] rhs @Rect + * + * @return true if same, else false + * * @since_tizen 5.5 */ inline bool operator==(const Rect& rhs) @@ -94,21 +125,19 @@ public: } /** - * @brief TBD + * @brief Checks given Rect is not same as this or not. + * + * @param[in] rhs @Rect + * + * @return true if same, else false + * * @since_tizen 5.5 */ inline bool operator!=(const Rect& rhs){ return !(*this == rhs); } - /** - * @brief TBD - */ Point2D mTopLeft; - - /** - * @brief TBD - */ Point2D mBottomRight; }; diff --git a/libaurum/inc/PartialMatch.h b/libaurum/inc/PartialMatch.h index 28f430e..bb8fb44 100644 --- a/libaurum/inc/PartialMatch.h +++ b/libaurum/inc/PartialMatch.h @@ -24,52 +24,95 @@ #include "AccessibleNode.h" #include "UiSelector.h" + /** - * @brief PartialMatch class - * @since_tizen 5.5 + * @class PartialMatch + * + * @ingroup aurum + * + * @brief Class that defines a methods to perform multiple condition of search object. + * It works like helper class for @Comparer. */ class PartialMatch { private: /** - * @brief TBD + * @brief PartialMatch constructor. + * * @since_tizen 5.5 */ PartialMatch(); public: /** - * @brief TBD + * @brief PartialMatch constructor with selector, absolute depth. + * + * @param[in][in] absolute depth(start from root) value + * * @since_tizen 5.5 */ PartialMatch(const std::shared_ptr selector, const int absDepth); public: /** - * @brief TBD + * @brief Updates all PartialMatches class. + * + * @param[in] node target @AssessibleNode + * @param[in] index node index + * @param[in] depth next depth + * @param[in] partialMatches @PartialMatch list + * * @since_tizen 5.5 */ void update(const std::shared_ptr node, int index, int depth, std::list> &partialMatches); /** - * @brief TBD + * @brief Checks the matching finished or not. If so, saves match result if found. + * + * @return true if matched child exist, else false + * * @since_tizen 5.5 */ bool finalizeMatch(); /** - * @brief TBD + * @brief Prints selector information. + * * @since_tizen 5.5 */ std::string debugPrint(); public: + + /** + * @brief It determine current given depth accatable and check criteria, + * It checks selector's min, max depth in relative depth, and check criteria. + * + * @param[in] node target @AccessibleNode + * @param[in] selector @UiSelector + * @param[in] index node index + * @param[in] depth searching depth from ui layout hierarchy + * + * @return @PartialMatch + * + * @since_tizen 5.5 + */ static std::shared_ptr accept(const std::shared_ptr node, const std::shared_ptr selector, int index, int depth); /** - * @brief TBD + * @brief It determine current given depth accatable and check criteria, + * It checks selector's min, max depth in relative depth, and check criteria. + * + * @param[in] node target @AccessibleNode + * @param[in] selector @UiSelector + * @param[in] index node index + * @param[in] absoluteDepth absolute depth + * @param[in] relativeDepth relative depth + * + * @return @PartialMatch + * * @since_tizen 5.5 */ static std::shared_ptr accept(const std::shared_ptr node, @@ -77,47 +120,48 @@ public: int index, int absoluteDepth, int relativeDepth); - /** - * @brief TBD - * @since_tizen 5.5 - */ private: - static bool checkCriteria(const std::shared_ptr selector, - const std::shared_ptr node); /** - * @brief TBD + * @brief Checks given node's search criteria are satisfied or not. + * + * @param[in] selector @UiSelector + * @param[in] node @AccessibleNode target node + * + * @return ture if satisfied, else false + * * @since_tizen 5.5 */ - - static bool checkCriteria(const std::string *textA, const std::string textB); + static bool checkCriteria(const std::shared_ptr selector, + const std::shared_ptr node); /** - * @brief TBD + * @brief Checks text matched or not. + * + * @param[in] textA string + * @param[in] textB string + * + * @return ture if matched, else false + * * @since_tizen 5.5 */ - static bool checkCriteria(const std::string *textA, const std::string textB, const bool *match); + static bool checkCriteria(const std::string textA, const std::string textB); /** - * @brief TBD + * @brief Checks boolean value matched or not. + * + * @param[in] boolA bool + * @param[in] boolA bool + * + * @return ture if matched, else false + * * @since_tizen 5.5 */ - static bool checkCriteria(const bool *boolA, const bool boolB); + static bool checkCriteria(const bool boolA, const bool boolB); private: - /** - * @brief TBD - */ const std::shared_ptr mSelector; - - /** - * @brief TBD - */ const int mDepth; - - /** - * @brief TBD - */ std::list> mPartialMatches; }; diff --git a/libaurum/inc/Runnable/Runnable.h b/libaurum/inc/Runnable/Runnable.h index 5ecd0de..22b7723 100644 --- a/libaurum/inc/Runnable/Runnable.h +++ b/libaurum/inc/Runnable/Runnable.h @@ -18,10 +18,28 @@ #ifndef _RUNNABLE_H_ #define _RUNNABLE_H_ +/** + * @class Runnable + * + * @ingroup aurum + * + * @brief Class to run UI automation function and get results. + */ class Runnable { public: + /** + * @brief Runnable destructor. + * + * @since_tizen 5.5 + */ virtual ~Runnable() { } + + /** + * @brief Do given action. + * + * @since_tizen 5.5 + */ virtual void run() const = 0; }; diff --git a/libaurum/inc/Runnable/SendKeyRunnable.h b/libaurum/inc/Runnable/SendKeyRunnable.h index 4fcd77c..91f80dc 100644 --- a/libaurum/inc/Runnable/SendKeyRunnable.h +++ b/libaurum/inc/Runnable/SendKeyRunnable.h @@ -22,12 +22,30 @@ #include "Runnable.h" +/** + * @class SendKeyRunnable + * + * @ingroup aurum + * + * @brief Class to send key event and wait a result. + */ class SendKeyRunnable : public Runnable { protected: std::string mKeycode; public: + /** + * @brief SendKeyRunnable constructor with keycode. + * + * @param[in] keycode keycode string + * + * @since_tizen 5.5 + */ SendKeyRunnable(std::string keycode); + + /** + * @copydoc Runnable::run() + */ void run() const override; }; diff --git a/libaurum/inc/Sel.h b/libaurum/inc/Sel.h index 0338b38..9d75ab0 100644 --- a/libaurum/inc/Sel.h +++ b/libaurum/inc/Sel.h @@ -26,31 +26,55 @@ #include "UiSelector.h" /** - * @brief Sel class - * @since_tizen 5.5 + * @class Sel + * + * @ingroup aurum + * + * @brief Helper class for use @UiSelctor easily. + * This class using in Aurum feature UTC in cpp test code. */ class Sel { public: /** - * @brief TBD + * @brief Sets the search criteria to match the object's text. + * + * @param[in] text object text + * + * @return @UiSelector + * * @since_tizen 5.5 */ static std::shared_ptr text(std::string text); /** - * @brief TBD + * @brief Sets the search criteria to match the object's type. + * + * @param[in] type object type + * + * @return @UiSelector + * * @since_tizen 5.5 */ - static std::shared_ptr type(std::string text); + static std::shared_ptr type(std::string type); /** - * @brief TBD + * @brief Sets the search criteria to match the object's style. + * + * @param[in] style object style + * + * @return @UiSelector + * * @since_tizen 5.5 */ - static std::shared_ptr style(std::string text); + static std::shared_ptr style(std::string style); /** - * @brief TBD + * @brief Sets the depth of the selector. + * + * @param[in] depth tree depth from root + * + * @return @UiSelector + * * @since_tizen 5.5 */ static std::shared_ptr depth(int depth); diff --git a/libaurum/inc/UiSelector.h b/libaurum/inc/UiSelector.h index 227feb8..37ade0c 100644 --- a/libaurum/inc/UiSelector.h +++ b/libaurum/inc/UiSelector.h @@ -23,363 +23,363 @@ #include #include #include + /** - * @brief UiSelector class - * @since_tizen 5.5 + * @class UiSelector + * + * @ingroup aurum + * + * @brief Specifies the elements in the layout hierarchy for tests to target, + * filtered by properties such as text value, + * content-description, class name, and state information. + * User can also target an element by its location in a layout hierarchy. */ class UiSelector { public: /** - * @brief TBD + * @brief UiSelector constructor. + * * @since_tizen 5.5 */ UiSelector(); /** - * @brief TBD + * @brief UiSelector constructor with selector. * @since_tizen 5.5 */ UiSelector(UiSelector &selector); - // UiSelector(const UiSelector &src); - // UiSelector &operator= (const UiSelector& src); - /** - * @brief TBD + * @brief Gets Selector information as string. + * * @since_tizen 5.5 */ std::string description(); public: /** - * @brief TBD + * @brief Sets the search criteria to match the object's Id. + * + * @param[in] text object Id + * + * @return UiSelector pointer + * * @since_tizen 5.5 */ - UiSelector *id(std::string text, bool match = true); + UiSelector *id(std::string text); /** - * @brief TBD + * @brief Sets the search criteria to match the object's automationid. + * + * @param[in] text object automationid + * + * @return UiSelector pointer + * * @since_tizen 5.5 */ - UiSelector *automationid(std::string text, bool match = true); + UiSelector *automationid(std::string text); /** - * @brief TBD + * @brief Sets the search criteria to match the object's text. + * + * @param[in] text object text + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *text(std::string text, bool match = true); + UiSelector *text(std::string text); /** - * @brief TBD + * @brief Sets the search criteria to match the object's package name. + * + * @param[in] text object package name + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *pkg(std::string text, bool match = true); + UiSelector *pkg(std::string text); /** - * @brief TBD + * @brief Sets the search criteria to match the object's role. + * + * @param[in] text object role name + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *role(std::string text, bool match = true); + UiSelector *role(std::string text); /** - * @brief TBD + * @brief Sets the search criteria to match the object's type. + * + * @param[in] text object type name + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *type(std::string text, bool match = true); + UiSelector *type(std::string text); /** - * @brief TBD + * @brief Sets the search criteria to match the object's style. + * + * @param[in] text object style name + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *style(std::string text, bool match = true); + UiSelector *style(std::string text); /** - * @brief TBD + * @brief Sets the depth of the selector. + * + * @param[in] depth depth + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ UiSelector *depth(int depth); /** - * @brief TBD + * @brief Sets the min and max depth of the selector. + * + * @param[in] minDepth min depth + * @param[in] maxDepth max depth + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ UiSelector *depth(int minDepth, int maxDepth); /** - * @brief TBD + * @brief Sets the min depth of the selector. + * + * @param[in] depth min depth + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ UiSelector *minDepth(int depth); /** - * @brief TBD + * @brief Sets the max depth of the selector. + * + * @param[in] depth max depth + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ UiSelector *maxDepth(int depth); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is currently checked. + * + * @param[in] condition object's checked condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isChecked(bool cond); + UiSelector *isChecked(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is checkable. + * + * @param[in] condition object's checkable condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isCheckable(bool cond); + UiSelector *isCheckable(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is clickable. + * + * @param[in] condition object's clickable condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isClickable(bool cond); + UiSelector *isClickable(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is currently checked. + * + * @param[in] condition object's checked condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isEnabled(bool cond); + UiSelector *isEnabled(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is currently focused. + * + * @param[in] condition object's focused condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isFocused(bool cond); + UiSelector *isFocused(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is focusable. + * + * @param[in] condition object's focusable condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isFocusable(bool cond); + UiSelector *isFocusable(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is scrollable. + * + * @param[in] condition object's scrollable condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isScrollable(bool cond); + UiSelector *isScrollable(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is currently selected. + * + * @param[in] condition object's selected condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isSelected(bool cond); + UiSelector *isSelected(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is showing. + * + * @param[in] condition object's showing condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isShowing(bool cond); + UiSelector *isShowing(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is currently active. + * + * @param[in] condition object's active condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isActive(bool cond); + UiSelector *isActive(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is currently visible. + * + * @param[in] condition object's visible condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isVisible(bool cond); + UiSelector *isVisible(bool condition); /** - * @brief TBD + * @brief Sets the search criteria to match the object that is selectable. + * + * @param[in] condition object's selectable condition + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ - UiSelector *isSelectable(bool cond); + UiSelector *isSelectable(bool condition); /** - * @brief TBD + * @brief Sets the child selector. + * + * @param[in] child @UiSelector + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ UiSelector *hasChild(std::shared_ptr child); /** - * @brief TBD + * @brief Sets the parent selector. + * + * @param[in] parent @UiSelector + * + * @return UiSelector class instance + * * @since_tizen 5.5 */ UiSelector *fromParent(std::shared_ptr parent); public: - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mId; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mAutomationId; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mRole; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mText; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mPkg; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mType; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mStyle; + std::string mId; + std::string mAutomationId; + std::string mRole; + std::string mText; + std::string mPkg; + std::string mType; + std::string mStyle; + + bool mMatchId; + bool mMatchAutomationId; + bool mMatchRole; + bool mMatchText; + bool mMatchPkg; + bool mMatchType; + bool mMatchStyle; + + bool mMatchChecked; + bool mMatchCheckable; + bool mMatchClickable; + bool mMatchEnabled; + bool mMatchFocused; + bool mMatchFocusable; + bool mMatchScrollable; + bool mMatchSelected; + bool mMatchShowing; + bool mMatchActive; + bool mMatchVisible; + bool mMatchSelectable; + + int mMinDepth; + int mMaxDepth; + + bool mIschecked; + bool mIscheckable; + bool mIsclickable; + bool mIsenabled; + bool mIsfocused; + bool mIsfocusable; + bool mIsscrollable; + bool mIsselected; + bool mIsshowing; + bool mIsactive; + bool mIsvisible; + bool mIsselectable; - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMatchId; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMatchAutomationId; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMatchRole; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMatchText; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMatchPkg; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMatchType; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMatchStyle; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMinDepth; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mMaxDepth; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIschecked; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIscheckable; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsclickable; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsenabled; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsfocused; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsfocusable; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsscrollable; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsselected; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsshowing; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsactive; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsvisible; - - /** - * @brief TBD - * @since_tizen 5.5 - */ - std::unique_ptr mIsselectable; - - /** - * @brief TBD - * @since_tizen 5.5 - */ std::vector> mChild; - - /** - * @brief TBD - * @since_tizen 5.5 - */ std::shared_ptr mParent; }; diff --git a/libaurum/inc/Until.h b/libaurum/inc/Until.h index eddef7b..a67e45f 100644 --- a/libaurum/inc/Until.h +++ b/libaurum/inc/Until.h @@ -15,66 +15,100 @@ * */ -#ifndef _UTIL_H_ -#define _UTIL_H_ +#ifndef _UNTIL_H_ +#define _UNTIL_H_ #include #include "ISearchable.h" #include "UiSelector.h" + /** - * @brief Until class - * @since_tizen 5.5 + * @class Until + * + * @ingroup Aurum + * + * @brief Class for use in a @Waiter class waiting for a particular object to find + * or waiting for a state change. */ class Until { private: /** - * @brief TBD + * @brief Until constructor. + * * @since_tizen 5.5 */ Until(); /** - * @brief TBD + * @brief Until constructor with selector. + * + * @param[in] selector @UiSelector + * * @since_tizen 5.5 */ Until(const std::shared_ptr selector); /** - * @brief TBD + * @brief UiSelector constructor with source. + * + * @param[in] src reference of Until source + * * @since_tizen 5.5 */ Until(const Until &src); /** - * @brief TBD + * @brief UiSelector constructor with source. + * + * @param[in] src Rvalue reference of Util source + * * @since_tizen 5.5 */ Until(const Until &&src); public: /** - * @brief TBD + * @brief UiSelector destructor. + * * @since_tizen 5.5 */ ~Until(); public: /** - * @brief TBD + * @brief Checks that there is an object that are satisfied with selector condition. + * + * @param[in] selector @UiSelctor + * + * @return function that performs hasObject + * returned function will return true if object has, else false + * * @since_tizen 5.5 */ static std::function hasObject( const std::shared_ptr selector); /** - * @brief TBD + * @brief Checks that there is an object that are satisfied with selector condition. + * + * @param[in] selector @UiSelctor + * + * @return function that performs findObject + * returned function will return obj if succeed, else nulltpr + * * @since_tizen 5.5 */ static std::function(const ISearchable *)> findObject(const std::shared_ptr selector); /** - * @brief TBD + * @brief Checks the given object on checkable state. + * + * @param[in] isCheckable checkable or not + * + * @return function that check checkable + * returned function will return true if checkable, else false + * * @since_tizen 5.5 */ static std::function checkable( diff --git a/libaurum/inc/Waiter.h b/libaurum/inc/Waiter.h index 82a9e4a..5c0c935 100644 --- a/libaurum/inc/Waiter.h +++ b/libaurum/inc/Waiter.h @@ -21,70 +21,72 @@ #include "ISearchable.h" #include + /** - * @brief Waiter class - * @since_tizen 5.5 + * @class Waiter + * + * @ingroup Aurum + * + * @brief Class waiting for a particular object to find or waiting for a state change. + * check interval = 500ms, wait timeout = 5000ms. */ class Waiter { private: /** - * @brief TBD + * @brief Waiter constructor. + * * @since_tizen 5.5 */ Waiter(); public: /** - * @brief TBD + * @brief Waiter constructor with searchable, object. + * + * @param[in] searchableObject ISearchable pointer + * @param[in] uiObject UiObject pointer + * * @since_tizen 5.5 */ Waiter(const ISearchable *searchableObject, const UiObject *uiObject = nullptr); /** - * @brief TBD + * @brief Waiter destructor. + * * @since_tizen 5.5 */ ~Waiter(); public: /** - * @brief TBD + * @brief wait for condition satisfied. + * + * @param[in] condisiton @ISearchable + * + * @return template + * * @since_tizen 5.5 */ template R waitFor(const std::function condition) const; /** - * @brief TBD + * @brief wait for object's condition satisfied. + * + * @param[in] object @UiObject + * + * @return template + * * @since_tizen 5.5 */ template R waitFor(const std::function object) const; private: - /** - * @brief TBD - * @since_tizen 5.5 - */ const ISearchable *mSearchableObject; - - /** - * @brief TBD - * @since_tizen 5.5 - */ const UiObject *mUiObject; - - /** - * @brief TBD - * @since_tizen 5.5 - */ const int WAIT_INTERVAL_MS; - - /** - * @brief TBD - * @since_tizen 5.5 - */ const int WAIT_TIMEOUT_MS; }; diff --git a/libaurum/src/Comparer.cc b/libaurum/src/Comparer.cc index dd96f10..f5ebdf2 100644 --- a/libaurum/src/Comparer.cc +++ b/libaurum/src/Comparer.cc @@ -79,7 +79,7 @@ std::vector> Comparer::findObjects( PartialMatch::accept(root, mSelector, index, depth); if (currentMatch) partialMatches.push_front(currentMatch); - if (!(mSelector->mMaxDepth && (depth+1 > *(mSelector->mMaxDepth)))) { + if (!(mSelector->mMaxDepth && (depth+1 > mSelector->mMaxDepth))) { int childCnt = root->getChildCount(); for (int i = 0; i < childCnt; i++) { std::shared_ptr childNode = root->getChildAt(i); @@ -95,7 +95,7 @@ std::vector> Comparer::findObjects( } } } else { - LOGI("Abort searching! No need to search children(maxDepth limit overflow, %d < %d < %d)", mSelector->mMinDepth? * (mSelector->mMinDepth): -1, depth, mSelector->mMaxDepth?*(mSelector->mMaxDepth):9999999); + LOGI("Abort searching! No need to search children(maxDepth limit overflow, %d < %d < %d)", mSelector->mMinDepth? mSelector->mMinDepth: -1, depth, mSelector->mMaxDepth?(mSelector->mMaxDepth):9999999); } if (currentMatch && currentMatch->finalizeMatch()){ diff --git a/libaurum/src/PartialMatch.cc b/libaurum/src/PartialMatch.cc index c8be7da..3b3e4eb 100644 --- a/libaurum/src/PartialMatch.cc +++ b/libaurum/src/PartialMatch.cc @@ -22,18 +22,16 @@ #include #include -bool PartialMatch::checkCriteria(const std::string *textA, const std::string textB) +bool PartialMatch::checkCriteria(const std::string textA, const std::string textB) { - if (!textA) return false; - std::regex re(*textA); + std::regex re(textA); bool rst = !(!!std::regex_match(textB, re) == true); return rst; } -bool PartialMatch::checkCriteria(const bool *boolA, const bool boolB) +bool PartialMatch::checkCriteria(const bool boolA, const bool boolB) { - if (!boolA) return false; - return *boolA != boolB; + return boolA != boolB; } std::string PartialMatch::debugPrint() @@ -44,40 +42,40 @@ std::string PartialMatch::debugPrint() bool PartialMatch::checkCriteria(const std::shared_ptr selector, const std::shared_ptr node) { - if (selector->mMatchText.get()) { + if (selector->mMatchText) { node->updateName(); - if (checkCriteria(selector->mText.get(), node->getText())) return false; + if (checkCriteria(selector->mText, node->getText())) return false; } - if (selector->mMatchId.get()) { + if (selector->mMatchId) { node->updateUniqueId(); - if (checkCriteria(selector->mId.get(), node->getId())) return false; + if (checkCriteria(selector->mId, node->getId())) return false; } - if (selector->mMatchType.get() || selector->mMatchAutomationId.get() || selector->mMatchStyle.get()) { + if (selector->mMatchType || selector->mMatchAutomationId || selector->mMatchStyle) { node->updateAttributes(); - if (checkCriteria(selector->mAutomationId.get(), node->getAutomationId())) return false; - if (checkCriteria(selector->mType.get(), node->getType())) return false; - if (checkCriteria(selector->mStyle.get(), node->getStyle())) return false; + if (checkCriteria(selector->mAutomationId, node->getAutomationId())) return false; + if (checkCriteria(selector->mType, node->getType())) return false; + if (checkCriteria(selector->mStyle, node->getStyle())) return false; } - if (selector->mMatchPkg.get()) { + if (selector->mMatchPkg) { node->updateApplication(); - if (checkCriteria(selector->mPkg.get(), node->getPkg())) return false; + if (checkCriteria(selector->mPkg, node->getPkg())) return false; } - if (selector->mMatchRole.get()) { + if (selector->mMatchRole) { node->updateRoleName(); - if (checkCriteria(selector->mRole.get(), node->getRole())) return false; + if (checkCriteria(selector->mRole, node->getRole())) return false; } - if (checkCriteria(selector->mIschecked.get(), node->isChecked())) return false; - if (checkCriteria(selector->mIscheckable.get(), node->isCheckable())) return false; - if (checkCriteria(selector->mIsclickable.get(), node->isClickable())) return false; - if (checkCriteria(selector->mIsenabled.get(), node->isEnabled())) return false; - if (checkCriteria(selector->mIsfocused.get(), node->isFocused())) return false; - if (checkCriteria(selector->mIsfocusable.get(), node->isFocusable())) return false; - if (checkCriteria(selector->mIsscrollable.get(), node->isScrollable())) return false; - if (checkCriteria(selector->mIsselected.get(), node->isSelected())) return false; - if (checkCriteria(selector->mIsshowing.get(), node->isShowing())) return false; - if (checkCriteria(selector->mIsactive.get(), node->isActive())) return false; - if (checkCriteria(selector->mIsvisible.get(), node->isVisible())) return false; - if (checkCriteria(selector->mIsselectable.get(), node->isSelectable())) 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; + if (selector->mMatchEnabled && checkCriteria(selector->mIsenabled, node->isEnabled())) return false; + if (selector->mMatchFocused && checkCriteria(selector->mIsfocused, node->isFocused())) return false; + if (selector->mMatchFocusable && checkCriteria(selector->mIsfocusable, node->isFocusable())) return false; + if (selector->mMatchScrollable && checkCriteria(selector->mIsscrollable, node->isScrollable())) return false; + if (selector->mMatchSelected && checkCriteria(selector->mIsselected, node->isSelected())) return false; + if (selector->mMatchShowing && checkCriteria(selector->mIsshowing, node->isShowing())) return false; + if (selector->mMatchActive && checkCriteria(selector->mIsactive, node->isActive())) return false; + if (selector->mMatchVisible && checkCriteria(selector->mIsvisible, node->isVisible())) return false; + if (selector->mMatchSelectable && checkCriteria(selector->mIsselectable, node->isSelectable())) return false; return true; } @@ -105,8 +103,8 @@ std::shared_ptr PartialMatch::accept(const std::shared_ptrmMinDepth && (relativeDepth < *(selector->mMinDepth))) || - (selector->mMaxDepth && (relativeDepth > *(selector->mMaxDepth)))) { + if ((selector->mMinDepth && relativeDepth < selector->mMinDepth) || + (selector->mMaxDepth && relativeDepth > selector->mMaxDepth)) { return std::shared_ptr(nullptr); } if (PartialMatch::checkCriteria(selector, node)) diff --git a/libaurum/src/Sel.cc b/libaurum/src/Sel.cc index 34ada90..484ffca 100644 --- a/libaurum/src/Sel.cc +++ b/libaurum/src/Sel.cc @@ -25,17 +25,17 @@ std::shared_ptr Sel::text(std::string text) return sel; } -std::shared_ptr Sel::type(std::string text) +std::shared_ptr Sel::type(std::string type) { std::shared_ptr sel = std::make_shared(); - sel->type(text); + sel->type(type); return sel; } -std::shared_ptr Sel::style(std::string text) +std::shared_ptr Sel::style(std::string style) { std::shared_ptr sel = std::make_shared(); - sel->style(text); + sel->style(style); return sel; } diff --git a/libaurum/src/UiSelector.cc b/libaurum/src/UiSelector.cc index 70770b2..9f7b9bd 100644 --- a/libaurum/src/UiSelector.cc +++ b/libaurum/src/UiSelector.cc @@ -22,6 +22,8 @@ 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{}, @@ -33,34 +35,34 @@ std::string UiSelector::description() { std::stringstream ss{}; ss << "{"; - if(this->mId) ss << "\"mId\":\"" << *this->mId << "\", "; - if(this->mAutomationId) ss << "\"mAutomationId\":\"" << *this->mAutomationId << "\", "; - if(this->mRole) ss << "\"mRole\":\"" << *this->mRole << "\", "; - if(this->mText) ss << "\"mText\":\"" << *this->mText << "\", "; - if(this->mPkg) ss << "\"mPkg\":\"" << *this->mPkg << "\", "; - if(this->mType) ss << "\"mType\":\"" << *this->mType << "\", "; - if(this->mStyle) ss << "\"mStyle\":\"" << *this->mStyle << "\", "; - 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->mMatchText) ss << "\"mMatchText\":\"" << ((*this->mMatchText)?"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->mMinDepth) ss << "\"mMinDepth\":\"" << *this->mMinDepth << "\", "; - if(this->mMaxDepth) ss << "\"mMaxDepth\":\"" << *this->mMaxDepth << "\", "; - if(this->mIschecked) ss << "\"mIschecked\":\"" << ((*this->mIschecked)?"true":"false") << "\", "; - if(this->mIscheckable) ss << "\"mIscheckable\":\"" << ((*this->mIscheckable)?"true":"false") << "\", "; - if(this->mIsclickable) ss << "\"mIsclickable\":\"" << ((*this->mIsclickable)?"true":"false") << "\", "; - if(this->mIsenabled) ss << "\"mIsenabled\":\"" << ((*this->mIsenabled)?"true":"false") << "\", "; - if(this->mIsfocused) ss << "\"mIsfocused\":\"" << ((*this->mIsfocused)?"true":"false") << "\", "; - if(this->mIsfocusable) ss << "\"mIsfocusable\":\"" << ((*this->mIsfocusable)?"true":"false") << "\", "; - if(this->mIsscrollable) ss << "\"mIsscrollable\":\"" << ((*this->mIsscrollable)?"true":"false") << "\", "; - if(this->mIsselected) ss << "\"mIsselected\":\"" << ((*this->mIsselected)?"true":"false") << "\", "; - if(this->mIsshowing) ss << "\"mIsshowing\":\"" << ((*this->mIsshowing)?"true":"false") << "\", "; - if(this->mIsactive) ss << "\"mIsactive\":\"" << ((*this->mIsactive)?"true":"false") << "\", "; - if(this->mIsvisible) ss << "\"mIsvisible\":\"" << ((*this->mIsvisible)?"true":"false") << "\", "; - if(this->mIsselectable) ss << "\"mIsselectable\":\"" << ((*this->mIsselectable)?"true":"false") << "\", "; + if(!this->mId.empty()) ss << "\"mId\":\"" << this->mId << "\", "; + 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->mPkg.empty()) ss << "\"mPkg\":\"" << this->mPkg << "\", "; + if(!this->mType.empty()) ss << "\"mType\":\"" << this->mType << "\", "; + if(!this->mStyle.empty()) ss << "\"mStyle\":\"" << this->mStyle << "\", "; + 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->mMatchText) ss << "\"mMatchText\":\"" << ((this->mMatchText)?"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->mMinDepth) ss << "\"mMinDepth\":\"" << this->mMinDepth << "\", "; + if(this->mMaxDepth) ss << "\"mMaxDepth\":\"" << this->mMaxDepth << "\", "; + if(this->mMatchChecked) ss << "\"mMatchChecked\":\"" << ((this->mMatchChecked)?"true":"false") << "\", "; + if(this->mMatchCheckable) ss << "\"mMatchCheckable\":\"" << ((this->mMatchCheckable)?"true":"false") << "\", "; + if(this->mMatchClickable) ss << "\"mMatchClickable\":\"" << ((this->mMatchClickable)?"true":"false") << "\", "; + if(this->mMatchEnabled) ss << "\"mMatchEnabled\":\"" << ((this->mMatchEnabled)?"true":"false") << "\", "; + if(this->mMatchFocused) ss << "\"mMatchFocused\":\"" << ((this->mMatchFocused)?"true":"false") << "\", "; + if(this->mMatchFocusable) ss << "\"mMatchFocusable\":\"" << ((this->mMatchFocusable)?"true":"false") << "\", "; + if(this->mMatchScrollable) ss << "\"mMatchScrollable\":\"" << ((this->mMatchScrollable)?"true":"false") << "\", "; + if(this->mMatchSelected) ss << "\"mMatchSelected\":\"" << ((this->mMatchSelected)?"true":"false") << "\", "; + if(this->mMatchShowing) ss << "\"mMatchShowing\":\"" << ((this->mMatchShowing)?"true":"false") << "\", "; + if(this->mMatchActive) ss << "\"mMatchActive\":\"" << ((this->mMatchActive)?"true":"false") << "\", "; + if(this->mMatchVisible) ss << "\"mMatchVisible\":\"" << ((this->mMatchVisible)?"true":"false") << "\", "; + if(this->mMatchSelectable) ss << "\"mMatchSelectable\":\"" << ((this->mMatchSelectable)?"true":"false") << "\", "; if(this->mParent) { ss << "\"mParent\":" << this->mParent->description(); } @@ -75,150 +77,162 @@ std::string UiSelector::description() return ss.str(); } -UiSelector *UiSelector::text(std::string text, bool match) +UiSelector *UiSelector::text(std::string text) { - this->mText = std::make_unique(text); - this->mMatchText = std::make_unique(match); + this->mText = text; + this->mMatchText = true; return this; } -UiSelector *UiSelector::pkg(std::string text, bool match) +UiSelector *UiSelector::pkg(std::string text) { - this->mPkg = std::make_unique(text); - this->mMatchPkg = std::make_unique(match); + this->mPkg = text; + this->mMatchPkg = true; return this; } -UiSelector *UiSelector::id(std::string text, bool match) +UiSelector *UiSelector::id(std::string text) { - this->mId = std::make_unique(text); - this->mMatchId = std::make_unique(match); + this->mId = text; + this->mMatchId = true; return this; } -UiSelector *UiSelector::automationid(std::string text, bool match) +UiSelector *UiSelector::automationid(std::string text) { - this->mAutomationId = std::make_unique(text); - this->mMatchAutomationId = std::make_unique(match); + this->mAutomationId = text; + this->mMatchAutomationId = true; return this; } -UiSelector *UiSelector::role(std::string text, bool match) +UiSelector *UiSelector::role(std::string text) { - this->mRole = std::make_unique(text); - this->mMatchRole = std::make_unique(match); + this->mRole = text; + this->mMatchRole = true; return this; } -UiSelector *UiSelector::type(std::string text, bool match) +UiSelector *UiSelector::type(std::string text) { - this->mType = std::make_unique(text); - this->mMatchType = std::make_unique(match); + this->mType = text; + this->mMatchType = true; return this; } -UiSelector *UiSelector::style(std::string text, bool match) +UiSelector *UiSelector::style(std::string text) { - this->mStyle = std::make_unique(text); - this->mMatchStyle = std::make_unique(match); + this->mStyle = text; + this->mMatchStyle = true; return this; } UiSelector *UiSelector::depth(int depth) { - this->mMinDepth = std::make_unique(depth); - this->mMaxDepth = std::make_unique(depth); + this->mMinDepth = depth; + this->mMaxDepth = depth; return this; } UiSelector *UiSelector::depth(int minDepth, int maxDepth) { - this->mMinDepth = std::make_unique(minDepth); - this->mMaxDepth = std::make_unique(maxDepth); + this->mMinDepth = minDepth; + this->mMaxDepth = maxDepth; return this; } UiSelector *UiSelector::minDepth(int depth) { - this->mMinDepth = std::make_unique(depth); + this->mMinDepth = depth; return this; } UiSelector *UiSelector::maxDepth(int depth) { - this->mMaxDepth = std::make_unique(depth); + this->mMaxDepth = depth; return this; } -UiSelector *UiSelector::isChecked(bool cond) +UiSelector *UiSelector::isChecked(bool condition) { - this->mIschecked = std::make_unique(cond); + this->mIschecked = condition; + this->mMatchChecked = true; return this; } -UiSelector *UiSelector::isCheckable(bool cond) +UiSelector *UiSelector::isCheckable(bool condition) { - this->mIscheckable = std::make_unique(cond); + this->mIscheckable = condition; + this->mMatchCheckable = true; return this; } -UiSelector *UiSelector::isClickable(bool cond) +UiSelector *UiSelector::isClickable(bool condition) { - this->mIsclickable = std::make_unique(cond); + this->mIsclickable = condition; + this->mMatchClickable = true; return this; } -UiSelector *UiSelector::isEnabled(bool cond) +UiSelector *UiSelector::isEnabled(bool condition) { - this->mIsenabled = std::make_unique(cond); + this->mIsenabled = condition; + this->mMatchEnabled = true; return this; } -UiSelector *UiSelector::isFocused(bool cond) +UiSelector *UiSelector::isFocused(bool condition) { - this->mIsfocused = std::make_unique(cond); + this->mIsfocused = condition; + this->mMatchFocused = true; return this; } -UiSelector *UiSelector::isFocusable(bool cond) +UiSelector *UiSelector::isFocusable(bool condition) { - this->mIsfocusable = std::make_unique(cond); + this->mIsfocusable = condition; + this->mMatchFocusable = true; return this; } -UiSelector *UiSelector::isScrollable(bool cond) +UiSelector *UiSelector::isScrollable(bool condition) { - this->mIsscrollable = std::make_unique(cond); + this->mIsscrollable = condition; + this->mMatchScrollable = true; return this; } -UiSelector *UiSelector::isSelected(bool cond) +UiSelector *UiSelector::isSelected(bool condition) { - this->mIsselected = std::make_unique(cond); + this->mIsselected = condition; + this->mMatchSelected = true; return this; } -UiSelector *UiSelector::isShowing(bool cond) +UiSelector *UiSelector::isShowing(bool condition) { - this->mIsshowing = std::make_unique(cond); + this->mIsshowing = condition; + this->mMatchShowing = true; return this; } -UiSelector *UiSelector::isActive(bool cond) +UiSelector *UiSelector::isActive(bool condition) { - this->mIsactive = std::make_unique(cond); + this->mIsactive = condition; + this->mMatchActive = true; return this; } -UiSelector *UiSelector::isVisible(bool cond) +UiSelector *UiSelector::isVisible(bool condition) { - this->mIsvisible = std::make_unique(cond); + this->mIsvisible = condition; + this->mMatchVisible = true; return this; } -UiSelector *UiSelector::isSelectable(bool cond) +UiSelector *UiSelector::isSelectable(bool condition) { - this->mIsselectable = std::make_unique(cond); + this->mIsselectable = condition; + this->mMatchSelectable = true; return this; } diff --git a/tests/Test_UiSelector.cc b/tests/Test_UiSelector.cc index 9f76683..3e2c79c 100644 --- a/tests/Test_UiSelector.cc +++ b/tests/Test_UiSelector.cc @@ -231,7 +231,7 @@ TEST_F(AurumTestUiSelector, Selector_Parent_P1) selpp->text("win1"); auto selp = std::make_shared(); - selp->text("node4", true)->fromParent(selpp); + selp->text("node4")->fromParent(selpp); auto sel = std::make_shared(); sel->text("node5")->fromParent(selp); @@ -244,7 +244,7 @@ TEST_F(AurumTestUiSelector, Selector_Parent_P1) TEST_F(AurumTestUiSelector, Selector_Parent_N2) { auto selpp = std::make_shared(); - selpp->text("win1", false)->role("window"); + selpp->text("win1")->role("window"); auto selp = std::make_shared(); selp->text("node4")->fromParent(selpp);