[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
Wed Aug 23 21:44:43 UTC 2017


 include/test/sheet/xuniquecellformatrangessupplier.hxx              |   34 ++++
 qadevOOo/Jar_OOoRunner.mk                                           |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv     |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv      |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv     |    1 
 qadevOOo/tests/java/ifc/sheet/_XUniqueCellFormatRangesSupplier.java |   74 ----------
 sc/qa/extras/sccellcursorobj.cxx                                    |    8 -
 sc/qa/extras/sccellrangeobj.cxx                                     |   30 +++-
 sc/qa/extras/sctablesheetobj.cxx                                    |   19 ++
 test/Library_subsequenttest.mk                                      |    1 
 test/source/sheet/xuniquecellformatrangessupplier.cxx               |   37 +++++
 11 files changed, 117 insertions(+), 90 deletions(-)

New commits:
commit 4818ee60172b2c7d5d04e57499e345e1cfd7b430
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Wed Aug 23 07:35:01 2017 +0000

    tdf#45904 Move Java _XUniqueCellFormatRangesSupplier test to C++
    
    Change-Id: I66c62f1676515437197d1875600407408040ca74
    Reviewed-on: https://gerrit.libreoffice.org/41445
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/test/sheet/xuniquecellformatrangessupplier.hxx b/include/test/sheet/xuniquecellformatrangessupplier.hxx
new file mode 100644
index 000000000000..f3adcc21664f
--- /dev/null
+++ b/include/test/sheet/xuniquecellformatrangessupplier.hxx
@@ -0,0 +1,34 @@
+/* -*- 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_TEST_SHEET_XUNIQUECELLFORMATRANGESSUPPLIER_HXX
+#define INCLUDED_TEST_SHEET_XUNIQUECELLFORMATRANGESSUPPLIER_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 XUniqueCellFormatRangesSupplier
+{
+public:
+    virtual css::uno::Reference< css::uno::XInterface > init() = 0;
+
+    void testGetUniqueCellFormatRanges();
+
+protected:
+    ~XUniqueCellFormatRangesSupplier() {}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XUNIQUECELLFORMATRANGESSUPPLIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 92b9912342f5..c09c9134c895 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -639,7 +639,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sheet/_XSubTotalCalculatable \
     qadevOOo/tests/java/ifc/sheet/_XSubTotalDescriptor \
     qadevOOo/tests/java/ifc/sheet/_XSubTotalField \
-    qadevOOo/tests/java/ifc/sheet/_XUniqueCellFormatRangesSupplier \
     qadevOOo/tests/java/ifc/style/_CharacterProperties \
     qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
     qadevOOo/tests/java/ifc/style/_CharacterPropertiesComplex \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
index b8a24da282db..3ce35d7a5460 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
@@ -138,7 +138,6 @@
 "ScCellCursorObj";"com::sun::star::sheet::XCellRangesQuery";"queryColumnDifferences()"
 "ScCellCursorObj";"com::sun::star::sheet::XCellRangesQuery";"queryRowDifferences()"
 "ScCellCursorObj";"com::sun::star::sheet::XCellRangesQuery";"queryIntersection()"
-"ScCellCursorObj";"com::sun::star::sheet::XUniqueCellFormatRangesSupplier";"getUniqueCellFormatRanges()"
 "ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
 "ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
 "ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
index a07777d2ecb8..396876793189 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
@@ -133,7 +133,6 @@
 "ScCellRangeObj";"com::sun::star::sheet::XCellRangesQuery";"queryColumnDifferences()"
 "ScCellRangeObj";"com::sun::star::sheet::XCellRangesQuery";"queryRowDifferences()"
 "ScCellRangeObj";"com::sun::star::sheet::XCellRangesQuery";"queryIntersection()"
-"ScCellRangeObj";"com::sun::star::sheet::XUniqueCellFormatRangesSupplier";"getUniqueCellFormatRanges()"
 "ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
 "ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
 "ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
index 2dbb627cf654..776469521bec 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
@@ -164,7 +164,6 @@
 "ScTableSheetObj";"com::sun::star::sheet::XScenario";"setScenarioComment()"
 "ScTableSheetObj";"com::sun::star::sheet::XScenario";"addRanges()"
 "ScTableSheetObj";"com::sun::star::sheet::XScenario";"apply()"
-"ScTableSheetObj";"com::sun::star::sheet::XUniqueCellFormatRangesSupplier";"getUniqueCellFormatRanges()"
 "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
 "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
 "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XUniqueCellFormatRangesSupplier.java b/qadevOOo/tests/java/ifc/sheet/_XUniqueCellFormatRangesSupplier.java
deleted file mode 100644
index 982a85e4e25c..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XUniqueCellFormatRangesSupplier.java
+++ /dev/null
@@ -1,74 +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 lib.MultiMethodTest;
-
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.sheet.XUniqueCellFormatRangesSupplier;
-
-public class _XUniqueCellFormatRangesSupplier extends MultiMethodTest {
-
-    public XUniqueCellFormatRangesSupplier oObj;
-
-    /**
-     * call the method getUniqueCellFormatRanges and returns OK result if
-     * the gained XIndexAccess isn't null and the method checkIndexAccess
-     * returns true.
-     */
-
-    public void _getUniqueCellFormatRanges() {
-        boolean res = true;
-        XIndexAccess xIA = oObj.getUniqueCellFormatRanges();
-        if (xIA != null) {
-            res = checkIndexAccess(xIA);
-        } else {
-            log.println("The gained IndexAccess is null");
-            res = false;
-        }
-        tRes.tested("getUniqueCellFormatRanges()",res);
-    }
-
-    /**
-     * 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;
-    }
-
-
-}
diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx
index eefdcb98bd6d..674c9eff0b98 100644
--- a/sc/qa/extras/sccellcursorobj.cxx
+++ b/sc/qa/extras/sccellcursorobj.cxx
@@ -10,6 +10,7 @@
 #include <test/calc_unoapi_test.hxx>
 #include <test/sheet/xcellseries.hxx>
 #include <test/sheet/xusedareacursor.hxx>
+#include <test/sheet/xuniquecellformatrangessupplier.hxx>
 
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
@@ -20,9 +21,9 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 4
+#define NUMBER_OF_TESTS 5
 
-class ScCellCursorObj : public CalcUnoApiTest, private apitest::XCellSeries, public apitest::XUsedAreaCursor
+class ScCellCursorObj : public CalcUnoApiTest, private apitest::XCellSeries, public apitest::XUsedAreaCursor, public apitest::XUniqueCellFormatRangesSupplier
 {
 public:
     ScCellCursorObj();
@@ -42,6 +43,9 @@ public:
     CPPUNIT_TEST(testFillAuto);
     CPPUNIT_TEST(testFillSeries);
 
+    // XUniqueCellFormatRangesSupplier
+    CPPUNIT_TEST(testGetUniqueCellFormatRanges);
+
     CPPUNIT_TEST_SUITE_END();
 
 private:
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index 65c9c697ba07..fff430036bda 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -8,12 +8,13 @@
  */
 
 #include <test/calc_unoapi_test.hxx>
-#include <test/sheet/xcellrangesquery.hxx>
 #include <test/sheet/cellproperties.hxx>
-#include <test/util/xreplaceable.hxx>
-#include <test/util/xsearchable.hxx>
 #include <test/sheet/xcellrangedata.hxx>
+#include <test/sheet/xcellrangesquery.hxx>
 #include <test/sheet/xcellseries.hxx>
+#include <test/sheet/xuniquecellformatrangessupplier.hxx>
+#include <test/util/xreplaceable.hxx>
+#include <test/util/xsearchable.hxx>
 
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
@@ -27,11 +28,11 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 17
+#define NUMBER_OF_TESTS 18
 
 class ScCellRangeObj : public CalcUnoApiTest, public apitest::XCellRangesQuery, public apitest::CellProperties,
                         public apitest::XSearchable, public apitest::XReplaceable, public apitest::XCellRangeData,
-                        public apitest::XCellSeries
+                        public apitest::XCellSeries, public apitest::XUniqueCellFormatRangesSupplier
 {
 public:
     ScCellRangeObj();
@@ -42,26 +43,43 @@ public:
     virtual uno::Reference< uno::XInterface > getXCellRangeData() override;
     void testSortOOB();
 
-
     CPPUNIT_TEST_SUITE(ScCellRangeObj);
+
+    // XCellRangesQuery
     CPPUNIT_TEST(testQueryColumnDifference);
     CPPUNIT_TEST(testQueryContentDifference);
     CPPUNIT_TEST(testQueryEmptyCells);
+
     //CPPUNIT_TEST(testQueryFormulaCells);
     CPPUNIT_TEST(testQueryIntersection);
     CPPUNIT_TEST(testQueryRowDifference);
     CPPUNIT_TEST(testQueryVisibleCells);
+
+    // CellProperties
     CPPUNIT_TEST(testVertJustify);
     CPPUNIT_TEST(testRotateReference);
+
+    // XSearchable
     CPPUNIT_TEST(testFindAll);
     CPPUNIT_TEST(testFindFirst);
+
+    // XReplaceable
     CPPUNIT_TEST(testReplaceAll);
     CPPUNIT_TEST(testCreateReplaceDescriptor);
+
+    // XCellRangeData
     CPPUNIT_TEST(testGetDataArray);
     CPPUNIT_TEST(testSetDataArray);
+
     CPPUNIT_TEST(testSortOOB);
+
+    // XCellSeries
     CPPUNIT_TEST(testFillAuto);
     CPPUNIT_TEST(testFillSeries);
+
+    // XUniqueCellFormatRangesSupplier
+    CPPUNIT_TEST(testGetUniqueCellFormatRanges);
+
     CPPUNIT_TEST_SUITE_END();
 
 private:
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index fabe8b7b0d76..c97e5230fbe3 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -8,10 +8,11 @@
  */
 
 #include <test/calc_unoapi_test.hxx>
+#include <test/sheet/xcellseries.hxx>
+#include <test/sheet/xprintareas.hxx>
+#include <test/sheet/xuniquecellformatrangessupplier.hxx>
 #include <test/util/xreplaceable.hxx>
 #include <test/util/xsearchable.hxx>
-#include <test/sheet/xprintareas.hxx>
-#include <test/sheet/xcellseries.hxx>
 
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
@@ -22,9 +23,9 @@ using namespace css::uno;
 namespace sc_apitest
 {
 
-#define NUMBER_OF_TESTS 9
+#define NUMBER_OF_TESTS 10
 
-class ScTableSheetObj : public CalcUnoApiTest, public apitest::XSearchable, public apitest::XReplaceable, public apitest::XPrintAreas, public apitest::XCellSeries
+class ScTableSheetObj : public CalcUnoApiTest, public apitest::XSearchable, public apitest::XReplaceable, public apitest::XPrintAreas, public apitest::XCellSeries, public apitest::XUniqueCellFormatRangesSupplier
 {
 public:
     ScTableSheetObj();
@@ -35,17 +36,27 @@ public:
     virtual uno::Reference< uno::XInterface > init() override;
 
     CPPUNIT_TEST_SUITE(ScTableSheetObj);
+
+    // XSearchable
     CPPUNIT_TEST(testFindAll);
     CPPUNIT_TEST(testFindNext);
     CPPUNIT_TEST(testFindFirst);
+
+    // XReplaceable
     CPPUNIT_TEST(testReplaceAll);
     CPPUNIT_TEST(testCreateReplaceDescriptor);
+
     // XPrintAreas
     CPPUNIT_TEST(testSetAndGetPrintTitleColumns);
     CPPUNIT_TEST(testSetAndGetPrintTitleRows);
+
     // XCellSeries
     CPPUNIT_TEST(testFillAuto);
     CPPUNIT_TEST(testFillSeries);
+
+    // XUniqueCellFormatRangesSupplier
+    CPPUNIT_TEST(testGetUniqueCellFormatRanges);
+
     CPPUNIT_TEST_SUITE_END();
 
 private:
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 8d1402d4f383..2563e0aa06f9 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -67,6 +67,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
 	test/source/sheet/xsheetannotationshapesupplier \
 	test/source/sheet/xsheetoutline \
 	test/source/sheet/xstyleloader \
+	test/source/sheet/xuniquecellformatrangessupplier\
 	test/source/sheet/xusedareacursor \
 	test/source/sheet/xviewpane \
 	test/source/sheet/xviewfreezable \
diff --git a/test/source/sheet/xuniquecellformatrangessupplier.cxx b/test/source/sheet/xuniquecellformatrangessupplier.cxx
new file mode 100644
index 000000000000..1f4af6c97b15
--- /dev/null
+++ b/test/source/sheet/xuniquecellformatrangessupplier.cxx
@@ -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 <test/sheet/xuniquecellformatrangessupplier.hxx>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/sheet/XUniqueCellFormatRangesSupplier.hpp>
+
+#include "cppunit/extensions/HelperMacros.h"
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest {
+
+void XUniqueCellFormatRangesSupplier::testGetUniqueCellFormatRanges()
+{
+    uno::Reference< sheet::XUniqueCellFormatRangesSupplier > xSupplier(init(), UNO_QUERY_THROW);
+    uno::Reference< container::XIndexAccess > xIndexAccess = xSupplier->getUniqueCellFormatRanges();
+
+    auto count = xIndexAccess->getCount();
+    CPPUNIT_ASSERT_MESSAGE("No elements found", count);
+    for (auto i = 0; i<count; i++) {
+        CPPUNIT_ASSERT_NO_THROW_MESSAGE(OUStringToOString("Unable to access element " + OUString::number(i), RTL_TEXTENCODING_UTF8).getStr(),
+                                        xIndexAccess->getByIndex(i));
+    }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list