diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-28 18:33:30 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-18 17:01:40 +0200 |
commit | 5ccbdd25ca9cb6cebf7c6956532cd2022e824641 (patch) | |
tree | 77c385c153902d257385a9829f0f2a9c0fbeffb3 /vcl/source/uitest | |
parent | d85d19d05dc9f16b576da28c9665515cdcfcb9ce (diff) |
uitest: add initial support for combo boxes to uitesting
Change-Id: I82aa2d877216bc1bb984bd16e2d1d54a15fcc4fa
Diffstat (limited to 'vcl/source/uitest')
-rw-r--r-- | vcl/source/uitest/factory.cxx | 8 | ||||
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 40 |
2 files changed, 48 insertions, 0 deletions
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: */ |