[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
Sun Oct 29 21:10:04 UTC 2017


 include/test/sheet/xspreadsheet.hxx                             |   38 ++++
 qadevOOo/Jar_OOoRunner.mk                                       |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv |    2 
 qadevOOo/tests/java/ifc/sheet/_XSpreadsheet.java                |   80 ----------
 sc/qa/extras/sctablesheetobj.cxx                                |   20 +-
 test/Library_subsequenttest.mk                                  |    1 
 test/source/sheet/xspreadsheet.cxx                              |   44 +++++
 7 files changed, 97 insertions(+), 89 deletions(-)

New commits:
commit 410515366c466c1f8b0a81d47f8263d278af3a18
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Thu Oct 12 08:31:48 2017 +0000

    tdf#45904 Move Java _XSpreadsheet tests to C++
    
    Change-Id: Idb398c87c89aa9b5613b9952bffde5929c1bc76b
    Reviewed-on: https://gerrit.libreoffice.org/43398
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/test/sheet/xspreadsheet.hxx b/include/test/sheet/xspreadsheet.hxx
new file mode 100644
index 000000000000..300d3670e1b5
--- /dev/null
+++ b/include/test/sheet/xspreadsheet.hxx
@@ -0,0 +1,38 @@
+/* -*- 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_XSPREADSHEET_HXX
+#define INCLUDED_TEST_SHEET_XSPREADSHEET_HXX
+
+#include <test/testdllapi.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSpreadsheet
+{
+public:
+    virtual uno::Reference< uno::XInterface > init() = 0;
+
+    void testCreateCursor();
+    void testCreateCursorByRange();
+
+protected:
+    ~XSpreadsheet(){}
+};
+
+}
+
+#endif // INCLUDED_TEST_SHEET_XSPREADSHEET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 4aa239d98ce0..5f74bc7f8818 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -630,7 +630,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sheet/_XSheetLinkable \
     qadevOOo/tests/java/ifc/sheet/_XSheetOperation \
     qadevOOo/tests/java/ifc/sheet/_XSheetPageBreak \
-    qadevOOo/tests/java/ifc/sheet/_XSpreadsheet \
     qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \
     qadevOOo/tests/java/ifc/style/_CharacterProperties \
     qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
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 db2a2b9225bc..4d0cd3fadbfc 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
@@ -129,8 +129,6 @@
 "ScTableSheetObj";"com::sun::star::sheet::XFormulaQuery";"queryDependents()"
 "ScTableSheetObj";"com::sun::star::sheet::XFormulaQuery";"queryPrecedents()"
 "ScTableSheetObj";"com::sun::star::sheet::XSheetFilterableEx";"createFilterDescriptorByObject()"
-"ScTableSheetObj";"com::sun::star::sheet::XSpreadsheet";"createCursor()"
-"ScTableSheetObj";"com::sun::star::sheet::XSpreadsheet";"createCursorByRange()"
 "ScTableSheetObj";"com::sun::star::sheet::XArrayFormulaRange";"getArrayFormula()"
 "ScTableSheetObj";"com::sun::star::sheet::XArrayFormulaRange";"setArrayFormula()"
 "ScTableSheetObj";"com::sun::star::sheet::XCellRangeFormula#optional";"getFormulaArray()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XSpreadsheet.java b/qadevOOo/tests/java/ifc/sheet/_XSpreadsheet.java
deleted file mode 100644
index bbee1ec6432a..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XSpreadsheet.java
+++ /dev/null
@@ -1,80 +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.sheet.XSheetCellCursor;
-import com.sun.star.sheet.XSheetCellRange;
-import com.sun.star.sheet.XSpreadsheet;
-import com.sun.star.table.XCellRange;
-import com.sun.star.uno.UnoRuntime;
-
-/**
-* Testing <code>com.sun.star.sheet.XSpreadsheet</code>
-* interface methods :
-* <ul>
-*  <li><code> createCursor()</code></li>
-*  <li><code> createCursorByRange()</code></li>
-* </ul> <p>
-* @see com.sun.star.sheet.XSpreadsheet
-*/
-public class _XSpreadsheet extends MultiMethodTest {
-
-    // oObj filled by MultiMethodTest
-    public XSpreadsheet oObj = null;
-
-    /**
-    * Test calls the method and checks returned value. <p>
-    * Has <b> OK </b> status if returned value isn't null. <p>
-    */
-    public void _createCursor() {
-        log.println("Testing createCursor");
-        XSheetCellCursor oCursor = oObj.createCursor() ;
-        tRes.tested("createCursor()", oCursor != null);
-    }
-
-    /**
-    * Test gets a cell range, call method using this cell range
-    * and checks returned value. <p>
-    * Has <b> OK </b> status if returned value isn't null
-    * and no exceptions were thrown. <p>
-    */
-    public void _createCursorByRange() {
-        log.println("Testing createCursorByRange");
-
-        log.println("getting cellrange");
-        XCellRange oRange = null;
-        try {
-            oRange = oObj.getCellRangeByPosition (1, 1, 2, 3);
-        } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
-            log.println("Can't get cell range by address");
-            e.printStackTrace(log);
-            tRes.tested("createCursorByRange()", false);
-        }
-
-        XSheetCellRange oSheetRange = UnoRuntime.queryInterface(XSheetCellRange.class, oRange) ;
-        log.println("getting Cursor");
-        XSheetCellCursor oCursor = oObj.createCursorByRange(oSheetRange);
-        tRes.tested("createCursorByRange()", oCursor != null);
-    }
-
-} // finish class _XSpreadsheet
-
-
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index 1566dce64fc4..a509c5bd2202 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -11,9 +11,10 @@
 #include <test/sheet/xcellseries.hxx>
 #include <test/sheet/xprintareas.hxx>
 #include <test/sheet/xuniquecellformatrangessupplier.hxx>
+#include <test/sheet/xspreadsheet.hxx>
+#include <test/sheet/xsubtotalcalculatable.hxx>
 #include <test/util/xreplaceable.hxx>
 #include <test/util/xsearchable.hxx>
-#include <test/sheet/xsubtotalcalculatable.hxx>
 
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
@@ -24,12 +25,15 @@ using namespace css::uno;
 namespace sc_apitest
 {
 
-#define NUMBER_OF_TESTS 12
+#define NUMBER_OF_TESTS 14
 
-class ScTableSheetObj : public CalcUnoApiTest,
-                          public apitest::XSearchable, public apitest::XReplaceable,
-                          public apitest::XPrintAreas, public apitest::XCellSeries,
-                          public apitest::XUniqueCellFormatRangesSupplier, public apitest::XSubTotalCalculatable
+class ScTableSheetObj : public CalcUnoApiTest, public apitest::XSearchable,
+                                               public apitest::XReplaceable,
+                                               public apitest::XPrintAreas,
+                                               public apitest::XCellSeries,
+                                               public apitest::XUniqueCellFormatRangesSupplier,
+                                               public apitest::XSpreadsheet,
+                                               public apitest::XSubTotalCalculatable
 {
 public:
     ScTableSheetObj();
@@ -62,6 +66,10 @@ public:
     // XUniqueCellFormatRangesSupplier
     CPPUNIT_TEST(testGetUniqueCellFormatRanges);
 
+    // XSpreadsheet
+    CPPUNIT_TEST(testCreateCursor);
+    CPPUNIT_TEST(testCreateCursorByRange);
+
     // XSubTotalCalculatable
     CPPUNIT_TEST(testCreateSubTotalDescriptor);
     CPPUNIT_TEST(testApplyRemoveSubTotals);
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index b9378036942c..9c1e8524b27b 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -64,6 +64,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
 	test/source/sheet/xnamedranges \
 	test/source/sheet/xprintareas \
 	test/source/sheet/xspreadsheetdocument \
+	test/source/sheet/xspreadsheet \
 	test/source/sheet/xspreadsheets \
 	test/source/sheet/xspreadsheets2 \
 	test/source/sheet/xsheetannotation \
diff --git a/test/source/sheet/xspreadsheet.cxx b/test/source/sheet/xspreadsheet.cxx
new file mode 100644
index 000000000000..2b6d0a0fec27
--- /dev/null
+++ b/test/source/sheet/xspreadsheet.cxx
@@ -0,0 +1,44 @@
+/* -*- 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/xspreadsheet.hxx>
+
+#include <com/sun/star/sheet/XSheetCellCursor.hpp>
+#include <com/sun/star/sheet/XSheetCellRange.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+
+namespace apitest {
+
+void XSpreadsheet::testCreateCursor()
+{
+    uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW);
+
+    uno::Reference< sheet::XSheetCellCursor > xCursor(xSheet->createCursor(), UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("Unable to create XSheetCellCursor", xCursor.is());
+}
+
+void XSpreadsheet::testCreateCursorByRange()
+{
+    uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW);
+
+    uno::Reference< sheet::XSheetCellRange > xCellRange(xSheet->getCellRangeByPosition(1, 1, 2, 3), UNO_QUERY_THROW);
+    uno::Reference< sheet::XSheetCellCursor > xCursor(xSheet->createCursorByRange(xCellRange), UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("Unable to create XSheetCellCursor", xCursor.is());
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list