diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-30 05:27:54 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-18 17:01:51 +0200 |
commit | 073c47e3719acdc5094144a1cba813317aec88a5 (patch) | |
tree | 55bf94993175a085e87402f6496e1e27963c9227 | |
parent | 77dd7f82911b2e8cd076dd71f3b3901b84fb98d6 (diff) |
uitest: move declaration for the uitesting wrapper objects to include/ dir
This allows non-vcl wrapper objects to inherit from the vcl base
classes. This is especially important for the WindowUIObject base class
object.
Change-Id: I91ef69839ff4c031d3bcd21d70b4b9e7d62ad572
-rw-r--r-- | include/vcl/uitest/uiobject.hxx | 245 | ||||
-rw-r--r-- | sfx2/inc/uitest/sfx_uiobject.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/uitest/sfx_uiobject.cxx | 8 | ||||
-rw-r--r-- | vcl/inc/uitest/uiobject_impl.hxx | 250 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/listbox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/spinfld.cxx | 2 | ||||
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 38 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 3 |
12 files changed, 299 insertions, 259 deletions
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx index 855cac3e53b5..963003e1ed3e 100644 --- a/include/vcl/uitest/uiobject.hxx +++ b/include/vcl/uitest/uiobject.hxx @@ -12,6 +12,14 @@ #include <memory> #include <vcl/window.hxx> +#include <vcl/spin.hxx> +#include <vcl/button.hxx> +#include <vcl/edit.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> +#include <vcl/spinfld.hxx> + #include <vcl/dllapi.h> enum class UIObjectType @@ -87,4 +95,241 @@ public: virtual void dumpHierarchy() const; }; +class UITEST_DLLPUBLIC WindowUIObject : public UIObject +{ + VclPtr<vcl::Window> mxWindow; + +public: + + WindowUIObject(VclPtr<vcl::Window> xWindow); + + virtual StringMap get_state() override; + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual UIObjectType get_type() const override; + + virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override; + + virtual void dumpState() const override; + + virtual void dumpHierarchy() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const; + +}; + +// TODO: moggi: what about push buttons? +class UITEST_DLLPUBLIC ButtonUIObject : public WindowUIObject +{ + VclPtr<Button> mxButton; +public: + + ButtonUIObject(VclPtr<Button> xButton); + virtual ~ButtonUIObject(); + + virtual StringMap get_state() override; + + 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: + + virtual OUString get_name() const override; +}; + +class UITEST_DLLPUBLIC DialogUIObject : public WindowUIObject +{ + VclPtr<Dialog> mxDialog; + +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); + +protected: + + virtual OUString get_name() const override; +}; + +class UITEST_DLLPUBLIC EditUIObject : public WindowUIObject +{ + VclPtr<Edit> mxEdit; + +public: + + EditUIObject(VclPtr<Edit> xEdit); + virtual ~EditUIObject(); + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual StringMap get_state() override; + + virtual UIObjectType get_type() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; +}; + +// TODO: moggi: maybe let it inherit from the button case +class UITEST_DLLPUBLIC CheckBoxUIObject : public WindowUIObject +{ +private: + VclPtr<CheckBox> mxCheckBox; + +public: + CheckBoxUIObject(VclPtr<CheckBox> xCheckbox); + virtual ~CheckBoxUIObject(); + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual StringMap get_state() override; + + virtual UIObjectType get_type() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; +}; + +class UITEST_DLLPUBLIC TabPageUIObject : public WindowUIObject +{ +private: + VclPtr<TabPage> mxTabPage; +public: + TabPageUIObject(VclPtr<TabPage> xTabPage); + virtual ~TabPageUIObject(); + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual StringMap get_state() override; + + virtual UIObjectType get_type() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; +}; + +class UITEST_DLLPUBLIC ListBoxUIObject : public WindowUIObject +{ +private: + VclPtr<ListBox> mxListBox; + +public: + + ListBoxUIObject(VclPtr<ListBox> xListBox); + virtual ~ListBoxUIObject(); + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual StringMap get_state() override; + + virtual UIObjectType get_type() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; +}; + +// TODO: moggi: should it inherit from EditUIObject? +class UITEST_DLLPUBLIC ComboBoxUIObject : public WindowUIObject +{ +private: + VclPtr<ComboBox> mxComboBox; + +public: + + ComboBoxUIObject(VclPtr<ComboBox> xListBox); + virtual ~ComboBoxUIObject(); + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual StringMap get_state() override; + + virtual UIObjectType get_type() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; +}; + +class UITEST_DLLPUBLIC SpinUIObject : public WindowUIObject +{ +private: + VclPtr<SpinButton> mxSpinButton; + +public: + + SpinUIObject(VclPtr<SpinButton> xSpinButton); + virtual ~SpinUIObject(); + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual StringMap get_state() override; + + virtual UIObjectType get_type() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; +}; + +class UITEST_DLLPUBLIC SpinFieldUIObject : public EditUIObject +{ + VclPtr<SpinField> mxSpinField; + +public: + + SpinFieldUIObject(VclPtr<SpinField> xEdit); + virtual ~SpinFieldUIObject(); + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual StringMap get_state() override; + + virtual UIObjectType get_type() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/uitest/sfx_uiobject.hxx b/sfx2/inc/uitest/sfx_uiobject.hxx index 6d77a5dcc3dd..bee5a20b4e35 100644 --- a/sfx2/inc/uitest/sfx_uiobject.hxx +++ b/sfx2/inc/uitest/sfx_uiobject.hxx @@ -12,7 +12,7 @@ class SfxTabDialog; -class SfxTabDialogUIObject : public UIObject +class SfxTabDialogUIObject : public WindowUIObject { private: diff --git a/sfx2/source/uitest/sfx_uiobject.cxx b/sfx2/source/uitest/sfx_uiobject.cxx index d42798781e1a..6cb6a2348a8e 100644 --- a/sfx2/source/uitest/sfx_uiobject.cxx +++ b/sfx2/source/uitest/sfx_uiobject.cxx @@ -12,6 +12,7 @@ #include <sfx2/tabdlg.hxx> SfxTabDialogUIObject::SfxTabDialogUIObject(VclPtr<SfxTabDialog> xTabDialog): + WindowUIObject(xTabDialog), mxTabDialog(xTabDialog) { } @@ -22,16 +23,21 @@ SfxTabDialogUIObject::~SfxTabDialogUIObject() StringMap SfxTabDialogUIObject::get_state() { + return WindowUIObject::get_state(); } -void SfxTabDialogUIObject::execute(const OUString& /*rAction*/, +void SfxTabDialogUIObject::execute(const OUString& rAction, const StringMap& /*rParameters*/) { + if (rAction == "SELECT") + { + } } UIObjectType SfxTabDialogUIObject::get_type() const { + return UIObjectType::DIALOG; } std::unique_ptr<UIObject> SfxTabDialogUIObject::create(vcl::Window* pWindow) diff --git a/vcl/inc/uitest/uiobject_impl.hxx b/vcl/inc/uitest/uiobject_impl.hxx deleted file mode 100644 index f0843a7d0b0d..000000000000 --- a/vcl/inc/uitest/uiobject_impl.hxx +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <vcl/uitest/uiobject.hxx> - -class TabPage; -class ComboBox; -class SpinButton; -class SpinField; -class Edit; -class Dialog; -class Button; -class CheckBox; -class ListBox; - -class WindowUIObject : public UIObject -{ - VclPtr<vcl::Window> mxWindow; - -public: - - WindowUIObject(VclPtr<vcl::Window> xWindow); - - virtual StringMap get_state() override; - - virtual void execute(const OUString& rAction, - const StringMap& rParameters) override; - - virtual UIObjectType get_type() const override; - - virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override; - - virtual void dumpState() const override; - - virtual void dumpHierarchy() const override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - virtual OUString get_name() const; - -}; - -// TODO: moggi: what about push buttons? -class ButtonUIObject : public WindowUIObject -{ - VclPtr<Button> mxButton; -public: - - ButtonUIObject(VclPtr<Button> xButton); - - virtual StringMap get_state() override; - - 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: - - virtual OUString get_name() const override; -}; - -class DialogUIObject : public WindowUIObject -{ - VclPtr<Dialog> mxDialog; - -public: - - DialogUIObject(VclPtr<Dialog> xDialog); - - virtual UIObjectType get_type() const override; - - virtual StringMap get_state() override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - virtual OUString get_name() const override; -}; - -class EditUIObject : public WindowUIObject -{ - VclPtr<Edit> mxEdit; - -public: - - EditUIObject(VclPtr<Edit> xEdit); - - virtual void execute(const OUString& rAction, - const StringMap& rParameters) override; - - virtual StringMap get_state() override; - - virtual UIObjectType get_type() const override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - virtual OUString get_name() const override; -}; - -// TODO: moggi: maybe let it inherit from the button case -class CheckBoxUIObject : public WindowUIObject -{ -private: - VclPtr<CheckBox> mxCheckBox; - -public: - CheckBoxUIObject(VclPtr<CheckBox> xCheckbox); - - virtual void execute(const OUString& rAction, - const StringMap& rParameters) override; - - virtual StringMap get_state() override; - - virtual UIObjectType get_type() const override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - virtual OUString get_name() const override; -}; - -class TabPageUIObject : public WindowUIObject -{ -private: - VclPtr<TabPage> mxTabPage; -public: - TabPageUIObject(VclPtr<TabPage> xTabPage); - - virtual void execute(const OUString& rAction, - const StringMap& rParameters) override; - - virtual StringMap get_state() override; - - virtual UIObjectType get_type() const override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - virtual OUString get_name() const override; -}; - -class ListBoxUIObject : public WindowUIObject -{ -private: - VclPtr<ListBox> mxListBox; - -public: - - ListBoxUIObject(VclPtr<ListBox> xListBox); - - virtual void execute(const OUString& rAction, - const StringMap& rParameters) override; - - virtual StringMap get_state() override; - - virtual UIObjectType get_type() const override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -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; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - virtual OUString get_name() const override; -}; - -class SpinUIObject : public WindowUIObject -{ -private: - VclPtr<SpinButton> mxSpinButton; - -public: - - SpinUIObject(VclPtr<SpinButton> xSpinButton); - - virtual void execute(const OUString& rAction, - const StringMap& rParameters) override; - - virtual StringMap get_state() override; - - virtual UIObjectType get_type() const override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - virtual OUString get_name() const override; -}; - -class SpinFieldUIObject : public EditUIObject -{ - VclPtr<SpinField> mxSpinField; - -public: - - SpinFieldUIObject(VclPtr<SpinField> xEdit); - - virtual void execute(const OUString& rAction, - const StringMap& rParameters) override; - - virtual StringMap get_state() override; - - virtual UIObjectType get_type() const override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - virtual OUString get_name() const override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index a5a444fbb021..6c12fa9c48fa 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -36,7 +36,7 @@ #include <vcl/edit.hxx> #include <vcl/layout.hxx> #include <vcl/vclstatuslistener.hxx> -#include <uitest/uiobject_impl.hxx> +#include <vcl/uitest/uiobject.hxx> #include <svids.hrc> #include <svdata.hxx> diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 6a29c8e445f1..a2792cf064e7 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -29,7 +29,7 @@ #include <vcl/button.hxx> #include <vcl/event.hxx> #include <vcl/settings.hxx> -#include <uitest/uiobject_impl.hxx> +#include <vcl/uitest/uiobject.hxx> #include <svdata.hxx> #include "listbox.hxx" diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 0aed1f2acd5d..e8f44560440f 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -27,7 +27,7 @@ #include <vcl/layout.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <uitest/uiobject_impl.hxx> +#include <vcl/uitest/uiobject.hxx> #include <window.h> #include <svdata.hxx> diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 4c62a80ba4c4..59dca0f3c886 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -29,7 +29,7 @@ #include <vcl/lstbox.hxx> #include <vcl/combobox.hxx> #include <vcl/settings.hxx> -#include <uitest/uiobject_impl.hxx> +#include <vcl/uitest/uiobject.hxx> #include "svdata.hxx" #include "controldata.hxx" diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 4268a9715d2a..e1d935b0e356 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -23,7 +23,7 @@ #include <vcl/decoview.hxx> #include <vcl/spinfld.hxx> #include <vcl/settings.hxx> -#include <uitest/uiobject_impl.hxx> +#include <vcl/uitest/uiobject.hxx> #include "controldata.hxx" #include "spin.hxx" diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index f994833499bb..e61a1d0739aa 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "uitest/uiobject_impl.hxx" +#include <vcl/uitest/uiobject.hxx> #include <vcl/event.hxx> #include <vcl/tabpage.hxx> @@ -295,6 +295,10 @@ ButtonUIObject::ButtonUIObject(VclPtr<Button> xButton): { } +ButtonUIObject::~ButtonUIObject() +{ +} + StringMap ButtonUIObject::get_state() { StringMap aMap = WindowUIObject::get_state(); @@ -336,6 +340,10 @@ DialogUIObject::DialogUIObject(VclPtr<Dialog> xDialog): { } +DialogUIObject::~DialogUIObject() +{ +} + StringMap DialogUIObject::get_state() { StringMap aMap = WindowUIObject::get_state(); @@ -367,6 +375,10 @@ EditUIObject::EditUIObject(VclPtr<Edit> xEdit): { } +EditUIObject::~EditUIObject() +{ +} + void EditUIObject::execute(const OUString& rAction, const StringMap& rParameters) { @@ -441,6 +453,10 @@ CheckBoxUIObject::CheckBoxUIObject(VclPtr<CheckBox> xCheckbox): { } +CheckBoxUIObject::~CheckBoxUIObject() +{ +} + void CheckBoxUIObject::execute(const OUString& rAction, const StringMap& /*rParameters*/) { @@ -482,6 +498,10 @@ TabPageUIObject::TabPageUIObject(VclPtr<TabPage> xTabPage): { } +TabPageUIObject::~TabPageUIObject() +{ +} + void TabPageUIObject::execute(const OUString& rAction, const StringMap& /*rParameters*/) { @@ -514,6 +534,10 @@ ListBoxUIObject::ListBoxUIObject(VclPtr<ListBox> xListBox): { } +ListBoxUIObject::~ListBoxUIObject() +{ +} + void ListBoxUIObject::execute(const OUString& rAction, const StringMap& rParameters) { @@ -574,6 +598,10 @@ ComboBoxUIObject::ComboBoxUIObject(VclPtr<ComboBox> xComboBox): { } +ComboBoxUIObject::~ComboBoxUIObject() +{ +} + void ComboBoxUIObject::execute(const OUString& rAction, const StringMap& rParameters) { @@ -620,6 +648,10 @@ SpinUIObject::SpinUIObject(VclPtr<SpinButton> xSpinButton): { } +SpinUIObject::~SpinUIObject() +{ +} + void SpinUIObject::execute(const OUString& rAction, const StringMap& /*rParameters*/) { @@ -659,6 +691,10 @@ SpinFieldUIObject::SpinFieldUIObject(VclPtr<SpinField> xSpinField): { } +SpinFieldUIObject::~SpinFieldUIObject() +{ +} + void SpinFieldUIObject::execute(const OUString& rAction, const StringMap& /*rParameters*/) { diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index b7ce704e4b4b..af13d502ac47 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -49,7 +49,7 @@ #include <vcl/msgbox.hxx> #include <vcl/unowrap.hxx> #include <vcl/settings.hxx> -#include <uitest/uiobject_impl.hxx> +#include <vcl/uitest/uiobject.hxx> #include <salframe.hxx> #include <iostream> diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 92a86e486263..26931df358db 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -44,6 +44,9 @@ #include <vcl/settings.hxx> #include <vcl/sysdata.hxx> +#include <vcl/uitest/uiobject.hxx> +#include <vcl/uitest/uitest.hxx> + #include <salframe.hxx> #include <salobj.hxx> #include <salinst.hxx> |