summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-21 16:49:16 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-22 18:19:33 +0200
commit71f562f8f77f14b76fde4329f7238fe2e7d6a054 (patch)
tree6352af0654eba2af204bb897baf9586c32be7214 /svtools/source
parent33d873b61f2b966c11019fc5e435b04aa0a1476d (diff)
uitest: support tree lists
Change-Id: Iaa1a49d7e38c8d87bb3cfd749af94a0b92feee0d
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/uitest/uiobject.cxx111
1 files changed, 109 insertions, 2 deletions
diff --git a/svtools/source/uitest/uiobject.cxx b/svtools/source/uitest/uiobject.cxx
index 65cd4a7d1cb7..494406a97f04 100644
--- a/svtools/source/uitest/uiobject.cxx
+++ b/svtools/source/uitest/uiobject.cxx
@@ -12,13 +12,58 @@
#include <svtools/treelistbox.hxx>
TreeListUIObject::TreeListUIObject(VclPtr<SvTreeListBox> xTreeList):
- WindowUIObject(xTreeList)
+ WindowUIObject(xTreeList),
+ mxTreeList(xTreeList)
{
}
StringMap TreeListUIObject::get_state()
{
- return WindowUIObject::get_state();
+ StringMap aMap = WindowUIObject::get_state();
+
+ aMap["SelectionCount"] = OUString::number(mxTreeList->GetSelectionCount());
+ aMap["VisibleCount"] = OUString::number(mxTreeList->GetVisibleCount());
+ aMap["Children"] = OUString::number(mxTreeList->GetChildCount(nullptr));
+ aMap["LevelChildren"] = OUString::number(mxTreeList->GetLevelChildCount(nullptr));
+ return aMap;
+}
+
+void TreeListUIObject::execute(const OUString& rAction,
+ const StringMap& rParameters)
+{
+ if (rAction == "")
+ {
+ }
+ else
+ WindowUIObject::execute(rAction, rParameters);
+}
+
+std::unique_ptr<UIObject> TreeListUIObject::get_child(const OUString& rID)
+{
+ sal_Int32 nID = rID.toInt32();
+ if (nID >= 0)
+ {
+ SvTreeListEntry* pEntry = mxTreeList->GetEntry(nullptr, nID);
+ if (!pEntry)
+ return nullptr;
+
+ return std::unique_ptr<UIObject>(new TreeListEntryUIObject(mxTreeList, pEntry));
+ }
+
+ return nullptr;
+}
+
+std::set<OUString> TreeListUIObject::get_children() const
+{
+ std::set<OUString> aChildren;
+
+ size_t nChildren = mxTreeList->GetLevelChildCount(nullptr);
+ for (size_t i = 0; i < nChildren; ++i)
+ {
+ aChildren.insert(OUString::number(i));
+ }
+
+ return aChildren;
}
OUString TreeListUIObject::get_name() const
@@ -33,4 +78,66 @@ std::unique_ptr<UIObject> TreeListUIObject::create(vcl::Window* pWindow)
return std::unique_ptr<UIObject>(new TreeListUIObject(pTreeList));
}
+TreeListEntryUIObject::TreeListEntryUIObject(VclPtr<SvTreeListBox> xTreeList, SvTreeListEntry* pEntry):
+ mxTreeList(xTreeList),
+ mpEntry(pEntry)
+{
+}
+
+StringMap TreeListEntryUIObject::get_state()
+{
+ StringMap aMap;
+
+ aMap["Text"] = mxTreeList->GetEntryText(mpEntry);
+ aMap["Children"] = OUString::number(mxTreeList->GetLevelChildCount(mpEntry));
+ aMap["VisibleChildCount"] = OUString::number(mxTreeList->GetVisibleChildCount(mpEntry));
+
+ return aMap;
+}
+
+void TreeListEntryUIObject::execute(const OUString& rAction, const StringMap& rParameters)
+{
+ if (rAction == "COLLAPSE")
+ {
+ mxTreeList->Collapse(mpEntry);
+ }
+ else if (rAction == "EXPAND")
+ {
+ mxTreeList->Expand(mpEntry);
+ }
+}
+
+std::unique_ptr<UIObject> TreeListEntryUIObject::get_child(const OUString& rID)
+{
+ sal_Int32 nID = rID.toInt32();
+ if (nID >= 0)
+ {
+ SvTreeListEntry* pEntry = mxTreeList->GetEntry(mpEntry, nID);
+ if (!pEntry)
+ return nullptr;
+
+ return std::unique_ptr<UIObject>(new TreeListEntryUIObject(mxTreeList, pEntry));
+ }
+
+ return nullptr;
+}
+
+std::set<OUString> TreeListEntryUIObject::get_children() const
+{
+ std::set<OUString> aChildren;
+
+ size_t nChildren = mxTreeList->GetLevelChildCount(mpEntry);
+ for (size_t i = 0; i < nChildren; ++i)
+ {
+ aChildren.insert(OUString::number(i));
+ }
+
+ return aChildren;
+}
+
+OUString TreeListEntryUIObject::get_type() const
+{
+ return OUString("TreeListEntry");
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */