uitest: an enum is a bad idea for the type

Change-Id: I1efd59b2f664f0aa9be733466fa7c1057e92ef27
This commit is contained in:
Markus Mohrhard 2016-04-10 07:02:23 +02:00
parent bdcb8d2197
commit 540a655495
6 changed files with 6 additions and 99 deletions

View File

@ -22,21 +22,6 @@
#include <vcl/dllapi.h>
enum class UIObjectType
{
WINDOW,
DIALOG,
BUTTON,
EDIT,
CHECKBOX,
LISTBOX,
COMBOBOX,
SPINBUTTON,
TABPAGE,
SPINFIELD,
UNKNOWN
};
typedef std::map<const OUString, OUString> StringMap;
/**
@ -67,9 +52,8 @@ public:
/**
* Returns the type of the UIObject. Additional information might
* be available through UIObject::get_state().
*
*/
virtual UIObjectType get_type() const;
virtual OUString get_type() const;
/**
* Returns the child of the current UIObject with the corresponding id.
@ -108,7 +92,7 @@ public:
virtual void execute(const OUString& rAction,
const StringMap& rParameters) override;
virtual UIObjectType get_type() const override;
virtual OUString get_type() const override;
virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override;
@ -138,8 +122,6 @@ public:
virtual void execute(const OUString& rAction,
const StringMap& rParameters) override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:
@ -156,8 +138,6 @@ public:
DialogUIObject(VclPtr<Dialog> xDialog);
virtual ~DialogUIObject();
virtual UIObjectType get_type() const override;
virtual StringMap get_state() override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
@ -181,8 +161,6 @@ public:
virtual StringMap get_state() override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:
@ -205,8 +183,6 @@ public:
virtual StringMap get_state() override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:
@ -227,8 +203,6 @@ public:
virtual StringMap get_state() override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:
@ -251,8 +225,6 @@ public:
virtual StringMap get_state() override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:
@ -276,8 +248,6 @@ public:
virtual StringMap get_state() override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:
@ -300,8 +270,6 @@ public:
virtual StringMap get_state() override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:
@ -323,8 +291,6 @@ public:
virtual StringMap get_state() override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:

View File

@ -29,8 +29,6 @@ public:
virtual void execute(const OUString& rAction,
const StringMap& rParameters) override;
virtual UIObjectType get_type() const override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
protected:

View File

@ -75,11 +75,6 @@ void SfxTabDialogUIObject::execute(const OUString& rAction,
}
}
UIObjectType SfxTabDialogUIObject::get_type() const
{
return UIObjectType::DIALOG;
}
std::unique_ptr<UIObject> SfxTabDialogUIObject::create(vcl::Window* pWindow)
{
SfxTabDialog* pDialog = dynamic_cast<SfxTabDialog*>(pWindow);

View File

@ -16,8 +16,6 @@ class TreeListUIObject : public WindowUIObject
public:
TreeListUIObject(VclPtr<SvTreeListBox> xTreeList);
virtual UIObjectType get_type() const override;
virtual StringMap get_state() override;
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);

View File

@ -21,11 +21,6 @@ StringMap TreeListUIObject::get_state()
return WindowUIObject::get_state();
}
UIObjectType TreeListUIObject::get_type() const
{
return UIObjectType::WINDOW;
}
OUString TreeListUIObject::get_name() const
{
return OUString("TreeListUIObject");

View File

@ -44,9 +44,9 @@ void UIObject::execute(const OUString& /*rAction*/,
throw std::exception();
}
UIObjectType UIObject::get_type() const
OUString UIObject::get_type() const
{
return UIObjectType::UNKNOWN;
return OUString("Generic UIObject");
}
std::unique_ptr<UIObject> UIObject::get_child(const OUString&)
@ -212,9 +212,9 @@ void WindowUIObject::execute(const OUString& rAction,
}
}
UIObjectType WindowUIObject::get_type() const
OUString WindowUIObject::get_type() const
{
return UIObjectType::WINDOW;
return get_name();
}
namespace {
@ -308,11 +308,6 @@ StringMap ButtonUIObject::get_state()
return aMap;
}
UIObjectType ButtonUIObject::get_type() const
{
return UIObjectType::BUTTON;
}
void ButtonUIObject::execute(const OUString& rAction,
const StringMap& rParameters)
{
@ -357,11 +352,6 @@ OUString DialogUIObject::get_name() const
return OUString("DialogUIObject");
}
UIObjectType DialogUIObject::get_type() const
{
return UIObjectType::DIALOG;
}
std::unique_ptr<UIObject> DialogUIObject::create(vcl::Window* pWindow)
{
Dialog* pDialog = dynamic_cast<Dialog*>(pWindow);
@ -430,11 +420,6 @@ StringMap EditUIObject::get_state()
return aMap;
}
UIObjectType EditUIObject::get_type() const
{
return UIObjectType::EDIT;
}
OUString EditUIObject::get_name() const
{
return OUString("EditUIObject");
@ -475,11 +460,6 @@ StringMap CheckBoxUIObject::get_state()
return aMap;
}
UIObjectType CheckBoxUIObject::get_type() const
{
return UIObjectType::CHECKBOX;
}
OUString CheckBoxUIObject::get_name() const
{
return OUString("CheckBoxUIObject");
@ -518,11 +498,6 @@ StringMap TabPageUIObject::get_state()
return aMap;
}
UIObjectType TabPageUIObject::get_type() const
{
return UIObjectType::TABPAGE;
}
OUString TabPageUIObject::get_name() const
{
return OUString("TabPageUIObject");
@ -575,11 +550,6 @@ StringMap ListBoxUIObject::get_state()
return aMap;
}
UIObjectType ListBoxUIObject::get_type() const
{
return UIObjectType::LISTBOX;
}
OUString ListBoxUIObject::get_name() const
{
return OUString("ListBoxUIObject");
@ -625,11 +595,6 @@ StringMap ComboBoxUIObject::get_state()
return aMap;
}
UIObjectType ComboBoxUIObject::get_type() const
{
return UIObjectType::COMBOBOX;
}
OUString ComboBoxUIObject::get_name() const
{
return OUString("ComboBoxUIObject");
@ -675,11 +640,6 @@ StringMap SpinUIObject::get_state()
return aMap;
}
UIObjectType SpinUIObject::get_type() const
{
return UIObjectType::SPINBUTTON;
}
OUString SpinUIObject::get_name() const
{
return OUString("SpinUIObject");
@ -715,11 +675,6 @@ StringMap SpinFieldUIObject::get_state()
return aMap;
}
UIObjectType SpinFieldUIObject::get_type() const
{
return UIObjectType::SPINFIELD;
}
OUString SpinFieldUIObject::get_name() const
{
return OUString("SpinFieldUIObject");