summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-29 15:32:33 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-18 17:01:49 +0200
commit6f1c82f2a08231d716a1a2acace350f3a4987f9e (patch)
tree61dae10b9cd59b05e92db732398eb50ebaa8ca6e
parent971b76d95a8e2c19be04c38319299cf0a20bd98c (diff)
uitest: work on supporting ui objects in sfx2 for uitesting
Change-Id: I693fe9cf697701a8cde5b78c382982c852ae7dfa
-rw-r--r--sfx2/Library_sfx.mk2
-rw-r--r--sfx2/inc/uitest/sfx_uiobject.hxx37
-rw-r--r--sfx2/inc/uitest/uitest_factory.hxx21
-rw-r--r--sfx2/source/dialog/tabdlg.cxx9
-rw-r--r--sfx2/source/uitest/factory.cxx26
-rw-r--r--sfx2/source/uitest/sfx_uiobject.cxx49
6 files changed, 144 insertions, 0 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 9aca9d7f058c..ac848db0356c 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -286,6 +286,8 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/styles/StyleManager \
sfx2/source/toolbox/imgmgr \
sfx2/source/toolbox/tbxitem \
+ sfx2/source/uitest/factory \
+ sfx2/source/uitest/sfx_uiobject \
sfx2/source/view/classificationcontroller \
sfx2/source/view/classificationhelper \
sfx2/source/view/frame \
diff --git a/sfx2/inc/uitest/sfx_uiobject.hxx b/sfx2/inc/uitest/sfx_uiobject.hxx
new file mode 100644
index 000000000000..6d77a5dcc3dd
--- /dev/null
+++ b/sfx2/inc/uitest/sfx_uiobject.hxx
@@ -0,0 +1,37 @@
+/* -*- 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>
+#include <memory>
+
+class SfxTabDialog;
+
+class SfxTabDialogUIObject : public UIObject
+{
+private:
+
+ VclPtr<SfxTabDialog> mxTabDialog;
+
+public:
+
+ SfxTabDialogUIObject(VclPtr<SfxTabDialog> xTabDialog);
+
+ virtual ~SfxTabDialogUIObject();
+
+ 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);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/uitest/uitest_factory.hxx b/sfx2/inc/uitest/uitest_factory.hxx
new file mode 100644
index 000000000000..b2d298f5a6eb
--- /dev/null
+++ b/sfx2/inc/uitest/uitest_factory.hxx
@@ -0,0 +1,21 @@
+/* -*- 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/factory.hxx>
+
+class SfxUITestFactory
+{
+public:
+
+ static void registerSfxTabDialog();
+
+ static void registerSfxTabPage();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index d112680ec36e..c61c1e285f13 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -37,6 +37,8 @@
#include <sfx2/sfxdlg.hxx>
#include <sfx2/itemconnect.hxx>
+#include "uitest/uitest_factory.hxx"
+
#include "dialog.hrc"
#include "helpid.hrc"
@@ -327,6 +329,13 @@ SfxTabDialog::SfxTabDialog
, m_pExampleSet(nullptr)
{
Init_Impl(bEditFmt);
+
+ static bool bRegisterUITest = false;
+ if (!bRegisterUITest)
+ {
+ SfxUITestFactory::registerSfxTabDialog();
+ bRegisterUITest = true;
+ }
}
diff --git a/sfx2/source/uitest/factory.cxx b/sfx2/source/uitest/factory.cxx
new file mode 100644
index 000000000000..447943706ed1
--- /dev/null
+++ b/sfx2/source/uitest/factory.cxx
@@ -0,0 +1,26 @@
+/* -*- 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 <uitest/uitest_factory.hxx>
+#include <uitest/sfx_uiobject.hxx>
+
+#include <vcl/uitest/factory.hxx>
+
+
+void SfxUITestFactory::registerSfxTabDialog()
+{
+ registerUITestFactory(WINDOW_TABDIALOG, FactoryFunction(SfxTabDialogUIObject::create));
+}
+
+void SfxUITestFactory::registerSfxTabPage()
+{
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/uitest/sfx_uiobject.cxx b/sfx2/source/uitest/sfx_uiobject.cxx
new file mode 100644
index 000000000000..590ffd3a95ac
--- /dev/null
+++ b/sfx2/source/uitest/sfx_uiobject.cxx
@@ -0,0 +1,49 @@
+/* -*- 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 <uitest/sfx_uiobject.hxx>
+
+#include <sfx2/tabdlg.hxx>
+
+SfxTabDialogUIObject::SfxTabDialogUIObject(VclPtr<SfxTabDialog> xTabDialog):
+ mxTabDialog(xTabDialog)
+{
+}
+
+SfxTabDialogUIObject::~SfxTabDialogUIObject()
+{
+}
+
+StringMap SfxTabDialogUIObject::get_state()
+{
+}
+
+void SfxTabDialogUIObject::execute(const OUString& /*rAction*/,
+ const StringMap& /*rParameters*/)
+{
+
+}
+
+UIObjectType SfxTabDialogUIObject::get_type() const
+{
+}
+
+std::unique_ptr<UIObject> SfxTabDialogUIObject::create(vcl::Window* pWindow)
+{
+ SfxTabDialog* pDialog = dynamic_cast<SfxTabDialog*>(pWindow);
+
+ if (pDialog)
+ {
+ return std::unique_ptr<UIObject>(new SfxTabDialogUIObject(pDialog));
+ }
+
+ return nullptr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */