Kaydet (Commit) 5ccbdd25 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

uitest: add initial support for combo boxes to uitesting

Change-Id: I82aa2d877216bc1bb984bd16e2d1d54a15fcc4fa
üst d85d19d0
......@@ -22,6 +22,7 @@ enum class UIObjectType
EDIT,
CHECKBOX,
LISTBOX,
COMBOBOX,
TABPAGE,
UNKNOWN
};
......
......@@ -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: */
......@@ -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);
......
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment