summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-01-06 21:39:52 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-18 16:59:48 +0200
commitdde9b4d86f75159f0d591f22aa10a7d4571aa441 (patch)
tree5999af41ee652c85c7b6cc99fbcf43c61f6af771 /test
parentd5c3f1bf261d98f6d1c0eddcddc4226ad073afb2 (diff)
uitest: some more work for the UI testing
Change-Id: I79193190f8f614b2d6a71032f05a0518eb9d1a1d
Diffstat (limited to 'test')
-rw-r--r--test/Library_uitest.mk2
-rw-r--r--test/source/uitest/uiobject.cxx79
2 files changed, 76 insertions, 5 deletions
diff --git a/test/Library_uitest.mk b/test/Library_uitest.mk
index 851b543e2378..83c15520470d 100644
--- a/test/Library_uitest.mk
+++ b/test/Library_uitest.mk
@@ -10,7 +10,7 @@
$(eval $(call gb_Library_Library,uitest))
$(eval $(call gb_Library_add_defs,uitest,\
- -DOOO_DLLIMPLEMENTATION_UITEST \
+ -DDLLIMPLEMENTATION_UITEST \
))
$(eval $(call gb_Library_use_sdk_api,uitest))
diff --git a/test/source/uitest/uiobject.cxx b/test/source/uitest/uiobject.cxx
index ea8a71594799..f1b0244d9725 100644
--- a/test/source/uitest/uiobject.cxx
+++ b/test/source/uitest/uiobject.cxx
@@ -9,27 +9,98 @@
#include <test/uiobject.hxx>
+#include <iostream>
+
UIObject::~UIObject()
{
}
-std::map<const OUString, OUString> UIObject::get_state()
+StringMap UIObject::get_state()
{
- std::map<const OUString, OUString> aMap;
+ StringMap aMap;
aMap["NotImplemented"] = "NotImplemented";
return aMap;
}
void UIObject::execute(const OUString& /*rAction*/,
- const std::map<const OUString, OUString>& /*rParameters*/)
+ const StringMap& /*rParameters*/)
{
// should never be called
throw std::exception();
}
-UIObjectType UIObject::getType()
+UIObjectType UIObject::getType() const
{
return UIObjectType::UNKNOWN;
}
+std::unique_ptr<UIObject> UIObject::get_child(const OUString&)
+{
+ return std::unique_ptr<UIObject>();
+}
+
+
+WindowUIObject::WindowUIObject(VclPtr<vcl::Window> xWindow):
+ mxWindow(xWindow)
+{
+}
+
+StringMap WindowUIObject::get_state()
+{
+ StringMap aMap;
+ aMap["Visible"] = OUString::boolean(mxWindow->IsVisible());
+ aMap["Enabled"] = OUString::boolean(mxWindow->IsEnabled());
+ if (mxWindow->GetParent())
+ aMap["Parent"] = mxWindow->GetParent()->get_id();
+
+ return aMap;
+}
+
+void WindowUIObject::execute(const OUString& rAction,
+ const StringMap& rParameters)
+{
+ if (rAction == "SET")
+ {
+ for (auto itr = rParameters.begin(); itr != rParameters.end(); ++itr)
+ {
+ std::cout << itr->first;
+ }
+ }
+}
+
+UIObjectType WindowUIObject::getType() const
+{
+ return UIObjectType::WINDOW;
+}
+
+namespace {
+
+vcl::Window* findChild(vcl::Window* pParent, const OUString& rID)
+{
+ if (!pParent)
+ return nullptr;
+
+ size_t nCount = pParent->GetChildCount();
+ for (size_t i = 0; i < nCount; ++i)
+ {
+ vcl::Window* pChild = pParent->GetChild(i);
+ if (pChild && pChild->get_id() == rID)
+ return pChild;
+
+ vcl::Window* pResult = findChild(pChild, rID);
+ if (pResult)
+ return pResult;
+ }
+}
+
+}
+
+std::unique_ptr<UIObject> WindowUIObject::get_child(const OUString& rID)
+{
+ vcl::Window* pWindow = findChild(mxWindow.get(), rID);
+
+ if (pWindow)
+ return std::unique_ptr<UIObject>(new WindowUIObject(pWindow));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */