summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-05-18 17:32:21 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2020-05-23 10:02:59 +0200
commit1668d38a14e10f7433eed83b21c11f5e0f2915d6 (patch)
tree464f9d16534a146ba7a85a4200a3bd22d29cdab9 /basctl
parent5ef3267c3a02da283ae15de3e2ad73395130a053 (diff)
uitest: add wrapper for macro editor
Change-Id: I729c5cdbc3ba925a0c08750eba199a400babba1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94445 Tested-by: Jenkins Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/Library_basctl.mk1
-rw-r--r--basctl/source/basicide/baside2.hxx3
-rw-r--r--basctl/source/basicide/baside2b.cxx9
-rw-r--r--basctl/source/basicide/uiobject.cxx51
-rw-r--r--basctl/source/basicide/uiobject.hxx35
5 files changed, 99 insertions, 0 deletions
diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk
index acd12b474160..0a6e2fb3f3ac 100644
--- a/basctl/Library_basctl.mk
+++ b/basctl/Library_basctl.mk
@@ -97,6 +97,7 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\
basctl/source/basicide/register \
basctl/source/basicide/sbxitem \
basctl/source/basicide/scriptdocument \
+ basctl/source/basicide/uiobject \
basctl/source/basicide/unomodel \
basctl/source/dlged/dlgedclip \
basctl/source/dlged/dlged \
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 110e8f483388..49e9c3759f6d 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -63,6 +63,7 @@ void setTextEngineText (ExtTextEngine&, OUString const&);
class EditorWindow final : public vcl::Window, public SfxListener
{
friend class CodeCompleteWindow;
+friend class EditorWindowUIObject;
private:
class ChangesListener;
@@ -151,6 +152,8 @@ public:
void UpdateSyntaxHighlighting ();
bool GetProcedureName(OUString const & rLine, OUString& rProcType, OUString& rProcName) const;
+
+ FactoryFunction GetUITestFactory() const override;
};
class BreakPointWindow final : public vcl::Window
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a3f227f9a0ef..a1efc0bcd93c 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -62,6 +62,8 @@
#include <vector>
#include <com/sun/star/reflection/theCoreReflection.hpp>
#include <unotools/charclass.hxx>
+#include "uiobject.hxx"
+
namespace basctl
{
@@ -240,6 +242,7 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) :
bDelayHighlight(true),
pCodeCompleteWnd(VclPtr<CodeCompleteWindow>::Create(this))
{
+ set_id("EditorWindow");
SetBackground(Wallpaper(rModulWindow.GetLayout().GetSyntaxBackgroundColor()));
SetPointer( PointerStyle::Text );
SetHelpId( HID_BASICIDE_EDITORWINDOW );
@@ -1359,6 +1362,12 @@ void EditorWindow::ForceSyntaxTimeout()
aSyntaxIdle.Invoke();
}
+FactoryFunction EditorWindow::GetUITestFactory() const
+{
+ return EditorWindowUIObject::create;
+}
+
+
// BreakPointWindow
BreakPointWindow::BreakPointWindow (vcl::Window* pParent, ModulWindow* pModulWindow)
diff --git a/basctl/source/basicide/uiobject.cxx b/basctl/source/basicide/uiobject.cxx
new file mode 100644
index 000000000000..80807d3a40a6
--- /dev/null
+++ b/basctl/source/basicide/uiobject.cxx
@@ -0,0 +1,51 @@
+/* -*- 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 <memory>
+#include "uiobject.hxx"
+#include <vcl/xtextedt.hxx>
+
+namespace basctl
+{
+EditorWindowUIObject::EditorWindowUIObject(const VclPtr<basctl::EditorWindow>& xEditorWindow)
+ : WindowUIObject(xEditorWindow)
+ , mxEditorWindow(xEditorWindow)
+{
+}
+
+StringMap EditorWindowUIObject::get_state()
+{
+ StringMap aMap = WindowUIObject::get_state();
+
+ ExtTextEngine* pEditEngine = mxEditorWindow->GetEditEngine();
+ sal_Int32 i, nParas;
+ OUStringBuffer aRes;
+ for (i = 0, nParas = pEditEngine->GetParagraphCount(); i < nParas; ++i)
+ {
+ aRes.append(pEditEngine->GetText(i));
+ aRes.append("\n");
+ }
+
+ aMap["Text"] = aRes.makeStringAndClear();
+
+ return aMap;
+}
+
+std::unique_ptr<UIObject> EditorWindowUIObject::create(vcl::Window* pWindow)
+{
+ basctl::EditorWindow* pEditorWindow = dynamic_cast<basctl::EditorWindow*>(pWindow);
+ assert(pEditorWindow);
+ return std::unique_ptr<UIObject>(new EditorWindowUIObject(pEditorWindow));
+}
+
+OUString EditorWindowUIObject::get_name() const { return "EditorWindowUIObject"; }
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/uiobject.hxx b/basctl/source/basicide/uiobject.hxx
new file mode 100644
index 000000000000..f3a1e5ec88f3
--- /dev/null
+++ b/basctl/source/basicide/uiobject.hxx
@@ -0,0 +1,35 @@
+/* -*- 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 <memory>
+#include <vcl/uitest/uiobject.hxx>
+#include "baside2.hxx"
+
+namespace basctl
+{
+class EditorWindow;
+
+class EditorWindowUIObject : public WindowUIObject
+{
+ VclPtr<basctl::EditorWindow> mxEditorWindow;
+
+public:
+ EditorWindowUIObject(const VclPtr<basctl::EditorWindow>& xEditorWindow);
+
+ virtual StringMap get_state() override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+protected:
+ virtual OUString get_name() const override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */