diff options
-rw-r--r-- | include/test/testdllapi.hxx | 6 | ||||
-rw-r--r-- | include/test/uiobject.hxx | 35 | ||||
-rw-r--r-- | include/test/uitest.hxx | 6 | ||||
-rw-r--r-- | test/Library_uitest.mk | 2 | ||||
-rw-r--r-- | test/source/uitest/uiobject.cxx | 79 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 5 |
6 files changed, 124 insertions, 9 deletions
diff --git a/include/test/testdllapi.hxx b/include/test/testdllapi.hxx index 3e33b0b51ec0..b7af82c72e4e 100644 --- a/include/test/testdllapi.hxx +++ b/include/test/testdllapi.hxx @@ -28,6 +28,12 @@ #define OOO_DLLPUBLIC_TEST SAL_DLLPUBLIC_IMPORT #endif +#if defined DLLIMPLEMENTATION_UITEST +#define UITEST_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define UITEST_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/test/uiobject.hxx b/include/test/uiobject.hxx index 8f0c04568dce..c33bd4380790 100644 --- a/include/test/uiobject.hxx +++ b/include/test/uiobject.hxx @@ -9,20 +9,27 @@ #include <rtl/ustring.hxx> #include <map> +#include <memory> + +#include <vcl/window.hxx> +#include <test/testdllapi.hxx> enum class UIObjectType { + WINDOW, DIALOG, UNKNOWN }; +typedef std::map<const OUString, OUString> StringMap; + /** * This class wraps a UI object like vcl::Window and provides * an interface for the UI testing. * * This class should only have virtual methods. */ -class UIObject +class UITEST_DLLPUBLIC UIObject { public: @@ -31,16 +38,36 @@ public: /** * returns the state of the wrapped UI object */ - virtual std::map<const OUString, OUString> get_state(); + virtual StringMap get_state(); /** * executes an action on the wrapped UI object, * possibly with some additional parameters */ virtual void execute(const OUString& rAction, - const std::map<const OUString, OUString>& rParameters); + const StringMap& rParameters); + + virtual UIObjectType getType() const; + + virtual std::unique_ptr<UIObject> get_child(const OUString& rID); +}; + +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 getType() const override; - virtual UIObjectType getType(); + virtual std::unique_ptr<UIObject> get_child(const OUString& rID); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/test/uitest.hxx b/include/test/uitest.hxx index b090651ac6a1..2fb08f5ff6a2 100644 --- a/include/test/uitest.hxx +++ b/include/test/uitest.hxx @@ -7,6 +7,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <test/testdllapi.hxx> + +class UITEST_DLLPUBLIC UITest +{ +public: +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/Library_uitest.mk b/test/Library_uitest.mk index 851b543e2378..83c15520470d 100644 --- a/test/Library_uitest.mk +++ b/test/Library_uitest.mk @@ -10,7 +10,7 @@ $(eval $(call gb_Library_Library,uitest)) $(eval $(call gb_Library_add_defs,uitest,\ - -DOOO_DLLIMPLEMENTATION_UITEST \ + -DDLLIMPLEMENTATION_UITEST \ )) $(eval $(call gb_Library_use_sdk_api,uitest)) diff --git a/test/source/uitest/uiobject.cxx b/test/source/uitest/uiobject.cxx index ea8a71594799..f1b0244d9725 100644 --- a/test/source/uitest/uiobject.cxx +++ b/test/source/uitest/uiobject.cxx @@ -9,27 +9,98 @@ #include <test/uiobject.hxx> +#include <iostream> + UIObject::~UIObject() { } -std::map<const OUString, OUString> UIObject::get_state() +StringMap UIObject::get_state() { - std::map<const OUString, OUString> aMap; + StringMap aMap; aMap["NotImplemented"] = "NotImplemented"; return aMap; } void UIObject::execute(const OUString& /*rAction*/, - const std::map<const OUString, OUString>& /*rParameters*/) + const StringMap& /*rParameters*/) { // should never be called throw std::exception(); } -UIObjectType UIObject::getType() +UIObjectType UIObject::getType() const { return UIObjectType::UNKNOWN; } +std::unique_ptr<UIObject> UIObject::get_child(const OUString&) +{ + return std::unique_ptr<UIObject>(); +} + + +WindowUIObject::WindowUIObject(VclPtr<vcl::Window> xWindow): + mxWindow(xWindow) +{ +} + +StringMap WindowUIObject::get_state() +{ + StringMap aMap; + aMap["Visible"] = OUString::boolean(mxWindow->IsVisible()); + aMap["Enabled"] = OUString::boolean(mxWindow->IsEnabled()); + if (mxWindow->GetParent()) + aMap["Parent"] = mxWindow->GetParent()->get_id(); + + return aMap; +} + +void WindowUIObject::execute(const OUString& rAction, + const StringMap& rParameters) +{ + if (rAction == "SET") + { + for (auto itr = rParameters.begin(); itr != rParameters.end(); ++itr) + { + std::cout << itr->first; + } + } +} + +UIObjectType WindowUIObject::getType() const +{ + return UIObjectType::WINDOW; +} + +namespace { + +vcl::Window* findChild(vcl::Window* pParent, const OUString& rID) +{ + if (!pParent) + return nullptr; + + size_t nCount = pParent->GetChildCount(); + for (size_t i = 0; i < nCount; ++i) + { + vcl::Window* pChild = pParent->GetChild(i); + if (pChild && pChild->get_id() == rID) + return pChild; + + vcl::Window* pResult = findChild(pChild, rID); + if (pResult) + return pResult; + } +} + +} + +std::unique_ptr<UIObject> WindowUIObject::get_child(const OUString& rID) +{ + vcl::Window* pWindow = findChild(mxWindow.get(), rID); + + if (pWindow) + return std::unique_ptr<UIObject>(new WindowUIObject(pWindow)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 1d897d745543..d0d0c2c48bb5 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1829,6 +1829,11 @@ void Window::KeyInput( const KeyEvent& rKEvt ) if (autoacc && cod.GetModifier () != 0x4000) return; } + if (cod.IsShift() && cod.IsMod1() && cod.GetCode() == KEY_F12) + { + + } + NotifyEvent aNEvt( MouseNotifyEvent::KEYINPUT, this, &rKEvt ); if ( !CompatNotify( aNEvt ) ) mpWindowImpl->mbKeyInput = true; |