diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 37 | ||||
-rw-r--r-- | vcl/source/uitest/uno/uiobject_uno.cxx | 20 | ||||
-rw-r--r-- | vcl/source/uitest/uno/uiobject_uno.hxx | 3 |
3 files changed, 60 insertions, 0 deletions
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index e7378c61805e..bc6c26b87a52 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -56,6 +56,11 @@ std::unique_ptr<UIObject> UIObject::get_child(const OUString&) return std::unique_ptr<UIObject>(); } +std::set<OUString> UIObject::get_children() const +{ + return std::set<OUString>(); +} + void UIObject::dumpState() const { } @@ -311,6 +316,29 @@ vcl::Window* findChild(vcl::Window* pParent, const OUString& rID) return nullptr; } +void addChildren(vcl::Window* pParent, std::set<OUString>& rChildren) +{ + if (!pParent) + return; + + size_t nCount = pParent->GetChildCount(); + for (size_t i = 0; i < nCount; ++i) + { + vcl::Window* pChild = pParent->GetChild(i); + if (pChild) + { + OUString aId = pChild->get_id(); + if (!aId.isEmpty()) + { + auto ret = rChildren.insert(aId); + SAL_WARN_IF(!ret.second, "vcl.uitest", "duplicate ids for ui elements. violates locally unique requirement"); + } + + addChildren(pChild, rChildren); + } + } +} + } std::unique_ptr<UIObject> WindowUIObject::get_child(const OUString& rID) @@ -322,6 +350,15 @@ std::unique_ptr<UIObject> WindowUIObject::get_child(const OUString& rID) return aFunction(pWindow); } +std::set<OUString> WindowUIObject::get_children() const +{ + vcl::Window* pDialogParent = get_dialog_parent(mxWindow.get()); + std::set<OUString> aChildren; + aChildren.insert(pDialogParent->get_id()); + addChildren(pDialogParent, aChildren); + return aChildren; +} + OUString WindowUIObject::get_name() const { return OUString("WindowUIObject"); diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx index 998a0d9a78b8..7c6ca8398b90 100644 --- a/vcl/source/uitest/uno/uiobject_uno.cxx +++ b/vcl/source/uitest/uno/uiobject_uno.cxx @@ -10,6 +10,8 @@ #include "uiobject_uno.hxx" #include <vcl/svapp.hxx> +#include <set> + UIObjectUnoObj::UIObjectUnoObj(std::unique_ptr<UIObject> pObj): UIObjectBase(m_aMutex), mpObj(std::move(pObj)) @@ -69,6 +71,24 @@ css::uno::Sequence<css::beans::PropertyValue> UIObjectUnoObj::getState() return aProps; } +css::uno::Sequence<OUString> UIObjectUnoObj::getChildren() + throw (css::uno::RuntimeException, std::exception) +{ + if (!mpObj) + throw css::uno::RuntimeException(); + + std::set<OUString> aChildren = mpObj->get_children(); + + css::uno::Sequence<OUString> aRet(aChildren.size()); + sal_Int32 i = 0; + for (auto itr = aChildren.begin(), itrEnd = aChildren.end(); itr != itrEnd; ++itr, ++i) + { + aRet[i] = *itr; + } + + return aRet; +} + OUString SAL_CALL UIObjectUnoObj::getType() throw (css::uno::RuntimeException, std::exception) { diff --git a/vcl/source/uitest/uno/uiobject_uno.hxx b/vcl/source/uitest/uno/uiobject_uno.hxx index d3519bfbaadc..fe0669a0c977 100644 --- a/vcl/source/uitest/uno/uiobject_uno.hxx +++ b/vcl/source/uitest/uno/uiobject_uno.hxx @@ -46,6 +46,9 @@ public: css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getState() throw (css::uno::RuntimeException, std::exception) override; + css::uno::Sequence<OUString> SAL_CALL getChildren() + throw (css::uno::RuntimeException, std::exception) override; + OUString SAL_CALL getType() throw (css::uno::RuntimeException, std::exception) override; |