summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-07-14 12:33:28 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-07-16 18:27:13 +0200
commitb1e1b38349d2c28420598f3b8612682989f5db90 (patch)
tree4e1e7478e3a695eedfe9de90eb3bd918c9b4126a
parent7b2966dbf283b168fa0cc1eadf989387ab6e25b9 (diff)
uitest: add initial support for selecting chart elements
Change-Id: I3af11d44067618b5188f3dbf4abccc171dd98d0c
-rw-r--r--chart2/Library_chartcontroller.mk1
-rw-r--r--chart2/source/controller/inc/ChartWindow.hxx (renamed from chart2/source/controller/main/ChartWindow.hxx)2
-rw-r--r--chart2/source/controller/inc/uiobject.hxx43
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx6
-rw-r--r--chart2/source/controller/uitest/uiobject.cxx56
5 files changed, 108 insertions, 0 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 080eef3caa83..1f95bc022c29 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -199,6 +199,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/sidebar/ChartSeriesPanel \
chart2/source/controller/sidebar/ChartSidebarModifyListener \
chart2/source/controller/sidebar/ChartSidebarSelectionListener \
+ chart2/source/controller/uitest/uiobject \
))
# Runtime dependency for unit-tests
diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/inc/ChartWindow.hxx
index 1ad1507bed75..ca2bc710493f 100644
--- a/chart2/source/controller/main/ChartWindow.hxx
+++ b/chart2/source/controller/inc/ChartWindow.hxx
@@ -65,6 +65,8 @@ public:
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+ virtual FactoryFunction GetUITestFactory() const override;
+
private:
ChartController* m_pWindowController;
bool m_bInPaint;
diff --git a/chart2/source/controller/inc/uiobject.hxx b/chart2/source/controller/inc/uiobject.hxx
new file mode 100644
index 000000000000..e458b6d42f33
--- /dev/null
+++ b/chart2/source/controller/inc/uiobject.hxx
@@ -0,0 +1,43 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_UIOBJECT_HXX
+#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_UIOBJECT_HXX
+
+#include <vcl/uitest/uiobject.hxx>
+
+#include "ChartWindow.hxx"
+
+class ChartWindowUIObject : public WindowUIObject
+{
+ VclPtr<chart::ChartWindow> mxChartWindow;
+
+public:
+
+ ChartWindowUIObject(VclPtr<chart::ChartWindow> xChartWindow);
+
+ virtual StringMap get_state() override;
+
+ virtual void execute(const OUString& rAction,
+ const StringMap& rParameters) override;
+
+ virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override;
+
+ virtual std::set<OUString> get_children() const override;
+
+ static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+
+protected:
+
+ virtual OUString get_name() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 23721191e1c7..d84880017a08 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -20,6 +20,7 @@
#include "ChartWindow.hxx"
#include "ChartController.hxx"
#include "HelpIds.hrc"
+#include "uiobject.hxx"
#include <vcl/help.hxx>
#include <vcl/openglwin.hxx>
@@ -306,6 +307,11 @@ void ChartWindow::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags
}
}
+FactoryFunction ChartWindow::GetUITestFactory() const
+{
+ return ChartWindowUIObject::create;
+}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/uitest/uiobject.cxx b/chart2/source/controller/uitest/uiobject.cxx
new file mode 100644
index 000000000000..a343b50b2f3a
--- /dev/null
+++ b/chart2/source/controller/uitest/uiobject.cxx
@@ -0,0 +1,56 @@
+/* -*- 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 "uiobject.hxx"
+
+ChartWindowUIObject::ChartWindowUIObject(VclPtr<chart::ChartWindow> xChartWindow):
+ WindowUIObject(xChartWindow),
+ mxChartWindow(xChartWindow)
+{
+}
+
+StringMap ChartWindowUIObject::get_state()
+{
+ StringMap aMap = WindowUIObject::get_state();
+
+ return aMap;
+}
+
+void ChartWindowUIObject::execute(const OUString& rAction,
+ const StringMap& rParameters)
+{
+ WindowUIObject::execute(rAction, rParameters);
+}
+
+std::unique_ptr<UIObject> ChartWindowUIObject::get_child(const OUString& rID)
+{
+ return nullptr;
+}
+
+std::set<OUString> ChartWindowUIObject::get_children() const
+{
+ std::set<OUString> aChildren;
+
+ return aChildren;
+}
+
+std::unique_ptr<UIObject> ChartWindowUIObject::create(vcl::Window* pWindow)
+{
+ chart::ChartWindow* pChartWindow = dynamic_cast<chart::ChartWindow*>(pWindow);
+ assert(pChartWindow);
+
+ return std::unique_ptr<UIObject>(new ChartWindowUIObject(pChartWindow));
+}
+
+OUString ChartWindowUIObject::get_name() const
+{
+ return OUString("ChartWindowUIObject");
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */