diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-01-13 20:12:50 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-01-14 10:20:45 +0100 |
commit | c87b1a887462cd3842eb90c9d6c50193c2d350f1 (patch) | |
tree | 0f2e39fd54b4cf7ecb757f44e65d29c9544e738b /vcl | |
parent | 25f33c3393895edced99cb69c7a450b9e2bb5343 (diff) |
UITest: add IconView
Change-Id: I6971d73e65f0a1f60203ea1010ed8ad3ba176755
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109243
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/iconview.hxx | 2 | ||||
-rw-r--r-- | vcl/source/treelist/iconview.cxx | 3 | ||||
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 37 |
3 files changed, 42 insertions, 0 deletions
diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx index 9c74d29f9834..f10b0ed8a53e 100644 --- a/vcl/inc/iconview.hxx +++ b/vcl/inc/iconview.hxx @@ -33,6 +33,8 @@ public: void PaintEntry(SvTreeListEntry&, tools::Long nX, tools::Long nY, vcl::RenderContext& rRenderContext); + + virtual FactoryFunction GetUITestFactory() const override; }; #endif diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index 12bdd75165fe..b6dd3da1c40a 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -21,6 +21,7 @@ #include <vcl/toolkit/viewdataentry.hxx> #include <iconview.hxx> #include "iconviewimpl.hxx" +#include <vcl/uitest/uiobject.hxx> IconView::IconView(vcl::Window* pParent, WinBits nBits) : SvTreeListBox(pParent, nBits) @@ -215,4 +216,6 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n } } +FactoryFunction IconView::GetUITestFactory() const { return IconViewUIObject::create; } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 90322d500611..92122b54caab 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -26,6 +26,9 @@ #include <vcl/toolkit/dialog.hxx> #include <vcl/toolkit/edit.hxx> #include <vcl/toolkit/field.hxx> +#include <vcl/toolkit/treelistbox.hxx> +#include <vcl/toolkit/treelistentry.hxx> +#include <vcl/toolkit/svlbitm.hxx> #include <vcl/menubtn.hxx> #include <vcl/toolkit/vclmedit.hxx> #include <vcl/uitest/logger.hxx> @@ -1729,4 +1732,38 @@ DrawingAreaUIObject::~DrawingAreaUIObject() { } +IconViewUIObject::IconViewUIObject(const VclPtr<SvTreeListBox>& xIconView): + TreeListUIObject(xIconView) +{ +} + +StringMap IconViewUIObject::get_state() +{ + StringMap aMap = TreeListUIObject::get_state(); + + SvTreeListEntry* pEntry = mxTreeList->FirstSelected(); + + OUString* pId = static_cast<OUString*>(pEntry->GetUserData()); + if (pId) + aMap["SelectedItemId"] = *pId; + + SvTreeList* pModel = mxTreeList->GetModel(); + if (pModel) + aMap["SelectedItemPos"] = OUString::number(pModel->GetAbsPos(pEntry)); + + return aMap; +} + +OUString IconViewUIObject::get_name() const +{ + return "IconViewUIObject"; +} + +std::unique_ptr<UIObject> IconViewUIObject::create(vcl::Window* pWindow) +{ + SvTreeListBox* pTreeList = dynamic_cast<SvTreeListBox*>(pWindow); + assert(pTreeList); + return std::unique_ptr<UIObject>(new IconViewUIObject(pTreeList)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |