[Libreoffice-commits] core.git: include/test qadevOOo/objdsc sc/qa test/Library_subsequenttest.mk test/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 5 17:47:47 UTC 2018


 include/test/view/xcontrolaccess.hxx                          |   35 ++++++
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScViewPaneObj.csv |    1 
 sc/qa/extras/scviewpaneobj.cxx                                |   11 +
 test/Library_subsequenttest.mk                                |    2 
 test/source/view/xcontrolaccess.cxx                           |   56 ++++++++++
 5 files changed, 104 insertions(+), 1 deletion(-)

New commits:
commit 4cb874c1b068d45039d7eed6f47c5ae5229fa301
Author:     Jens Carl <j.carl43 at gmx.de>
AuthorDate: Wed Dec 5 05:01:27 2018 +0000
Commit:     Jens Carl <j.carl43 at gmx.de>
CommitDate: Wed Dec 5 18:47:23 2018 +0100

    tdf#45904 Move XControlAccess Java test to C++
    
    Move XControlAccess Java test to C++ for ScViewPaneObj.
    
    Change-Id: If18596b41fccc140186820c9e370f502fb2b6458
    Reviewed-on: https://gerrit.libreoffice.org/64606
    Tested-by: Jenkins
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/include/test/view/xcontrolaccess.hxx b/include/test/view/xcontrolaccess.hxx
new file mode 100644
index 000000000000..b25cb169c377
--- /dev/null
+++ b/include/test/view/xcontrolaccess.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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_TEST_VIEW_XCONTROLACCESS_HXX
+#define INCLUDED_TEST_VIEW_XCONTROLACCESS_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XControlAccess
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+    virtual css::uno::Reference<css::uno::XInterface> getXComponent() = 0;
+
+    void testGetControl();
+
+protected:
+    ~XControlAccess() {}
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_VIEW_XCONTROLACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScViewPaneObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScViewPaneObj.csv
index fb9eba91fcf4..a4a3586f943f 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScViewPaneObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScViewPaneObj.csv
@@ -1,4 +1,3 @@
-"ScViewPaneObj";"com::sun::star::view::XControlAccess#optional";"getControl()"
 "ScViewPaneObj";"com::sun::star::view::XFormLayerAccess#optional";"getFromController()"
 "ScViewPaneObj";"com::sun::star::view::XFormLayerAccess#optional";"isFormDesignMode()"
 "ScViewPaneObj";"com::sun::star::view::XFormLayerAccess#optional";"setFormDesignMode()"
diff --git a/sc/qa/extras/scviewpaneobj.cxx b/sc/qa/extras/scviewpaneobj.cxx
index 9aee4a553cd6..499cc7924f31 100644
--- a/sc/qa/extras/scviewpaneobj.cxx
+++ b/sc/qa/extras/scviewpaneobj.cxx
@@ -10,6 +10,7 @@
 #include <test/calc_unoapi_test.hxx>
 #include <test/sheet/xcellrangereferrer.hxx>
 #include <test/sheet/xviewpane.hxx>
+#include <test/view/xcontrolaccess.hxx>
 
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/frame/XController.hpp>
@@ -26,12 +27,14 @@ namespace sc_apitest {
 
 class ScViewPaneObj : public CalcUnoApiTest,
                       public apitest::XCellRangeReferrer,
+                      public apitest::XControlAccess,
                       public apitest::XViewPane
 {
 public:
     ScViewPaneObj();
 
     virtual uno::Reference< uno::XInterface > init() override;
+    virtual uno::Reference< uno::XInterface > getXComponent() override;
     virtual void setUp() override;
     virtual void tearDown() override;
 
@@ -40,6 +43,9 @@ public:
     // XCellRangeReferrer
     CPPUNIT_TEST(testGetReferredCells);
 
+    // XControlAccess
+    CPPUNIT_TEST(testGetControl);
+
     // XViewPane
     CPPUNIT_TEST(testFirstVisibleColumn);
     CPPUNIT_TEST(testFirstVisibleRow);
@@ -56,6 +62,11 @@ ScViewPaneObj::ScViewPaneObj()
 {
 }
 
+uno::Reference<uno::XInterface> ScViewPaneObj::getXComponent()
+{
+    return mxComponent;
+}
+
 uno::Reference< uno::XInterface > ScViewPaneObj::init()
 {
     uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW);
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 78c2e7f6a727..1b71ab44270b 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -10,6 +10,7 @@
 $(eval $(call gb_Library_Library,subsequenttest))
 
 $(eval $(call gb_Library_set_include,subsequenttest,\
+	-I$(SRCDIR)/test/inc \
     $$(INCLUDE) \
 ))
 
@@ -162,6 +163,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
 	test/source/util/xrefreshable \
 	test/source/util/xreplaceable \
 	test/source/util/xsearchable \
+	test/source/view/xcontrolaccess \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/test/source/view/xcontrolaccess.cxx b/test/source/view/xcontrolaccess.cxx
new file mode 100644
index 000000000000..29ca1fa339aa
--- /dev/null
+++ b/test/source/view/xcontrolaccess.cxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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 <test/view/xcontrolaccess.hxx>
+#include <helper/form.hxx>
+
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/view/XControlAccess.hpp>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest
+{
+void XControlAccess::testGetControl()
+{
+    uno::Reference<view::XControlAccess> xCA(init(), uno::UNO_QUERY_THROW);
+
+    uno::Reference<lang::XComponent> xComponent(getXComponent(), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XDrawPagesSupplier> xDPS(xComponent, uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XDrawPage> xDP(xDPS->getDrawPages()->getByIndex(0),
+                                           uno::UNO_QUERY_THROW);
+
+    uno::Reference<drawing::XShapes> xShapes(xDP, uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape(
+        createControlShape(xComponent, 100, 100, 10000, 50000, "CommandButton"),
+        uno::UNO_QUERY_THROW);
+
+    xShapes->add(xShape);
+
+    uno::Reference<drawing::XControlShape> xCS(xShape, uno::UNO_QUERY_THROW);
+    uno::Reference<awt::XControlModel> xCM(xCS->getControl(), uno::UNO_QUERY_THROW);
+    uno::Reference<awt::XControl> xControl(xCA->getControl(xCM), uno::UNO_QUERY_THROW);
+
+    CPPUNIT_ASSERT(xControl.is());
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list