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

Jens Carl j.carl43 at gmx.de
Fri Dec 8 05:31:27 UTC 2017


 include/test/sheet/xdatapilotfield.hxx                              |   34 +++++
 qadevOOo/Jar_OOoRunner.mk                                           |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotFieldObj.csv |    1 
 qadevOOo/tests/java/ifc/sheet/_XDataPilotField.java                 |   61 ----------
 sc/qa/extras/scdatapilotfieldobj.cxx                                |   20 ++-
 test/Library_subsequenttest.mk                                      |    1 
 test/source/sheet/xdatapilotfield.cxx                               |   40 ++++++
 7 files changed, 91 insertions(+), 67 deletions(-)

New commits:
commit 7345bef0f354673e2fd3127b8fc707eae4c936ed
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Fri Dec 8 03:36:00 2017 +0000

    tdf#45904 Move _XDataPilotField Java test to C++
    
    Change-Id: I5ba1733a8e675048366651aa5f3affc9c249622c
    Reviewed-on: https://gerrit.libreoffice.org/46066
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/include/test/sheet/xdatapilotfield.hxx b/include/test/sheet/xdatapilotfield.hxx
new file mode 100644
index 000000000000..6622b71bcfbd
--- /dev/null
+++ b/include/test/sheet/xdatapilotfield.hxx
@@ -0,0 +1,34 @@
+/* -*- 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_SHEET_XDATAPILOTFIELD_HXX
+#define INCLUDED_TEST_SHEET_XDATAPILOTFIELD_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 XDataPilotField
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+    void testGetItems();
+
+protected:
+    ~XDataPilotField() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XDATAPILOTFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 539a24e803e4..bf717ebb1f37 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -596,7 +596,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sheet/_XConsolidatable \
     qadevOOo/tests/java/ifc/sheet/_XConsolidationDescriptor \
     qadevOOo/tests/java/ifc/sheet/_XDatabaseRanges \
-    qadevOOo/tests/java/ifc/sheet/_XDataPilotField \
     qadevOOo/tests/java/ifc/sheet/_XDDELink \
     qadevOOo/tests/java/ifc/sheet/_XDocumentAuditing \
     qadevOOo/tests/java/ifc/sheet/_XEnhancedMouseClickBroadcaster \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotFieldObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotFieldObj.csv
index c5efdd130e60..de2cb74f71ba 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotFieldObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDataPilotFieldObj.csv
@@ -7,4 +7,3 @@
 "ScDataPilotFieldObj";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()"
 "ScDataPilotFieldObj";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()"
 "ScDataPilotFieldObj";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()"
-"ScDataPilotFieldObj";"com::sun::star::sheet::XDataPilotField#optional";"getItems()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XDataPilotField.java b/qadevOOo/tests/java/ifc/sheet/_XDataPilotField.java
deleted file mode 100644
index 54ed131a5c52..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XDataPilotField.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package ifc.sheet;
-
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.sheet.XDataPilotField;
-
-import lib.MultiMethodTest;
-
-
-public class _XDataPilotField extends MultiMethodTest {
-    public XDataPilotField oObj = null;
-
-    public void _getItems() {
-        XIndexAccess xIA = oObj.getItems();
-        tRes.tested("getItems()", checkIndexAccess(xIA));
-    }
-
-    /**
-     * calls the method getCount at the IndexAccess, returns true is it is >0
-     * and getByIndex() doesn't throw an exception for Indexes between 0 and count
-     */
-    protected boolean checkIndexAccess(XIndexAccess xIA) {
-        boolean res = true;
-        int count = xIA.getCount();
-        log.println("Found " + count + " Elements");
-        res &= (count > 0);
-
-        for (int k = 0; k < count; k++) {
-            try {
-                Object element = xIA.getByIndex(k);
-                log.println("Element " + k + " = " + element);
-            } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
-                log.println("Unexpected Exception while getting by Index (" + k +
-                            ")" + e.getMessage());
-                res &= false;
-            } catch (com.sun.star.lang.WrappedTargetException e) {
-                log.println("Unexpected Exception while getting by Index (" + k +
-                            ")" + e.getMessage());
-                res &= false;
-            }
-        }
-
-        return res;
-    }
-}
\ No newline at end of file
diff --git a/sc/qa/extras/scdatapilotfieldobj.cxx b/sc/qa/extras/scdatapilotfieldobj.cxx
index 903839dd55fa..6c4fce2cbbae 100644
--- a/sc/qa/extras/scdatapilotfieldobj.cxx
+++ b/sc/qa/extras/scdatapilotfieldobj.cxx
@@ -8,8 +8,10 @@
  */
 
 #include <test/calc_unoapi_test.hxx>
-#include <test/sheet/xdatapilotfieldgrouping.hxx>
+
 #include <test/sheet/datapilotfield.hxx>
+#include <test/sheet/xdatapilotfield.hxx>
+#include <test/sheet/xdatapilotfieldgrouping.hxx>
 
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
@@ -22,10 +24,11 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 6
+#define NUMBER_OF_TESTS 7
 
-class ScDataPilotFieldObj : public CalcUnoApiTest, public apitest::XDataPilotFieldGrouping,
-                                public apitest::DataPilotField
+class ScDataPilotFieldObj : public CalcUnoApiTest, public apitest::DataPilotField,
+                                                   public apitest::XDataPilotField,
+                                                   public apitest::XDataPilotFieldGrouping
 {
 public:
     virtual void setUp() override;
@@ -35,15 +38,24 @@ public:
     ScDataPilotFieldObj();
 
     CPPUNIT_TEST_SUITE(ScDataPilotFieldObj);
+
+    // DataPilotField
     CPPUNIT_TEST(testSortInfo);
     CPPUNIT_TEST(testLayoutInfo);
     CPPUNIT_TEST(testAutoShowInfo);
     CPPUNIT_TEST(testReference);
     CPPUNIT_TEST(testIsGroupField);
+
+    // XDataPilotField
+    CPPUNIT_TEST(testGetItems);
+
+    // XDataPilotFieldGrouping
     CPPUNIT_TEST(testCreateNameGroup);
     // see fdo#
     //CPPUNIT_TEST(testCreateDateGroup);
+
     CPPUNIT_TEST_SUITE_END();
+
 private:
     static sal_Int32 nTest;
     static uno::Reference< lang::XComponent > mxComponent;
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 0197f564ba55..a03fb5b822f4 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
 	test/source/sheet/xgoalseek \
 	test/source/sheet/xdatabaserange \
 	test/source/sheet/xdatapilotdescriptor \
+	test/source/sheet/xdatapilotfield \
 	test/source/sheet/xdatapilotfieldgrouping \
 	test/source/sheet/xdatapilottable \
 	test/source/sheet/xdatapilottable2 \
diff --git a/test/source/sheet/xdatapilotfield.cxx b/test/source/sheet/xdatapilotfield.cxx
new file mode 100644
index 000000000000..a2fbbca0d3d6
--- /dev/null
+++ b/test/source/sheet/xdatapilotfield.cxx
@@ -0,0 +1,40 @@
+/* -*- 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/sheet/xdatapilotfield.hxx>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/sheet/XDataPilotField.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest
+{
+void XDataPilotField::testGetItems()
+{
+    uno::Reference<sheet::XDataPilotField> xDPF(init(), UNO_QUERY_THROW);
+
+    uno::Reference<container::XIndexAccess> xIA(xDPF->getItems(), UNO_QUERY_THROW);
+
+    const sal_Int32 nCount = xIA->getCount();
+    CPPUNIT_ASSERT_MESSAGE("No items found", sal_Int32(0) != nCount);
+
+    for (auto i = 0; i < nCount; i++)
+    {
+        CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to access element at position " + std::to_string(i),
+                                        xIA->getByIndex(i));
+    }
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list