summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-28 18:33:30 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-18 17:01:40 +0200
commit5ccbdd25ca9cb6cebf7c6956532cd2022e824641 (patch)
tree77c385c153902d257385a9829f0f2a9c0fbeffb3 /vcl
parentd85d19d05dc9f16b576da28c9665515cdcfcb9ce (diff)
uitest: add initial support for combo boxes to uitesting
Change-Id: I82aa2d877216bc1bb984bd16e2d1d54a15fcc4fa
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/uitest/uiobject_impl.hxx23
-rw-r--r--vcl/source/uitest/factory.cxx8
-rw-r--r--vcl/source/uitest/uiobject.cxx40
3 files changed, 71 insertions, 0 deletions
diff --git a/vcl/inc/uitest/uiobject_impl.hxx b/vcl/inc/uitest/uiobject_impl.hxx
index 7a5bd04dbc81..f8391b4a234b 100644
--- a/vcl/inc/uitest/uiobject_impl.hxx
+++ b/vcl/inc/uitest/uiobject_impl.hxx
@@ -14,6 +14,7 @@
#include <vcl/edit.hxx>
class TabPage;
+class ComboBox;
class WindowUIObject : public UIObject
{
@@ -160,4 +161,26 @@ protected:
virtual OUString get_name() const override;
};
+// TODO: moggi: should it inherit from EditUIObject?
+class ComboBoxUIObject : public WindowUIObject
+{
+private:
+ VclPtr<ComboBox> mxComboBox;
+
+public:
+
+ ComboBoxUIObject(VclPtr<ComboBox> xListBox);
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual StringMap get_state() override;
+
+ virtual UIObjectType get_type() const override;
+
+protected:
+
+ virtual OUString get_name() const override;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/uitest/factory.cxx b/vcl/source/uitest/factory.cxx
index 9827c029b476..77c3eb9d51b6 100644
--- a/vcl/source/uitest/factory.cxx
+++ b/vcl/source/uitest/factory.cxx
@@ -12,6 +12,7 @@
#include <vcl/tabpage.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
std::unique_ptr<UIObject> UITestWrapperFactory::createObject(vcl::Window* pWindow)
{
@@ -68,6 +69,13 @@ std::unique_ptr<UIObject> UITestWrapperFactory::createObject(vcl::Window* pWindo
return std::unique_ptr<UIObject>(new CheckBoxUIObject(pCheckBox));
}
break;
+ case WINDOW_COMBOBOX:
+ {
+ ComboBox* pComboBox = dynamic_cast<ComboBox*>(pWindow);
+ assert(pComboBox);
+ return std::unique_ptr<UIObject>(new ComboBoxUIObject(pComboBox));
+ }
+ break;
case WINDOW_LISTBOX:
{
ListBox* pListBox = dynamic_cast<ListBox*>(pWindow);
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index d401ccbad5e5..57ef1ec8deac 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -13,6 +13,7 @@
#include <vcl/event.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
#include <rtl/ustrbuf.hxx>
@@ -508,4 +509,43 @@ OUString ListBoxUIObject::get_name() const
return OUString("ListBoxUIObject");
}
+ComboBoxUIObject::ComboBoxUIObject(VclPtr<ComboBox> xComboBox):
+ WindowUIObject(xComboBox),
+ mxComboBox(xComboBox)
+{
+}
+
+void ComboBoxUIObject::execute(const OUString& rAction,
+ const StringMap& rParameters)
+{
+ if (rAction == "SELECT")
+ {
+ if (rParameters.find("POS") != rParameters.end())
+ {
+ auto itr = rParameters.find("POS");
+ OUString aVal = itr->second;
+ sal_Int32 nPos = aVal.toInt32();
+ mxComboBox->SelectEntryPos(nPos);
+ }
+ mxComboBox->Select();
+ }
+}
+
+StringMap ComboBoxUIObject::get_state()
+{
+ StringMap aMap = WindowUIObject::get_state();
+
+ return aMap;
+}
+
+UIObjectType ComboBoxUIObject::get_type() const
+{
+ return UIObjectType::COMBOBOX;
+}
+
+OUString ComboBoxUIObject::get_name() const
+{
+ return OUString("ComboBoxUIObject");
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */