[Libreoffice-commits] core.git: framework/qa qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests sc/CppunitTest_sc_indexenumeration_scenariosenumeration.mk sc/Module_sc.mk sc/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 15 16:51:17 UTC 2018


 framework/qa/complex/api_internal/api.lst                                               |    1 
 qadevOOo/Jar_OOoRunner.mk                                                               |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScIndexEnumeration_ScenariosEnumeration.csv |    2 
 qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java                |  116 ----------
 sc/CppunitTest_sc_indexenumeration_scenariosenumeration.mk                              |   43 +++
 sc/Module_sc.mk                                                                         |    1 
 sc/qa/extras/scindexenumeration_scenariosenumeration.cxx                                |  106 +++++++++
 sc/qa/unoapi/sc_5.sce                                                                   |    1 
 8 files changed, 150 insertions(+), 121 deletions(-)

New commits:
commit 32a8c55c9746f27db6a825372913e639d67c3476
Author:     Jens Carl <j.carl43 at gmx.de>
AuthorDate: Thu Nov 15 07:53:58 2018 +0000
Commit:     Jens Carl <j.carl43 at gmx.de>
CommitDate: Thu Nov 15 17:50:49 2018 +0100

    tdf#45904 Move XEnumeration Java test to C++
    
    Move XEnumeration Java tests for
    ScIndexEnumeration_ScenariosEnumeration to C++;
    
    Change-Id: Ia778f644cbb2836e6c6bfc12ae389cda3420e5b2
    Reviewed-on: https://gerrit.libreoffice.org/63399
    Tested-by: Jenkins
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst
index 5e1bce8e72ed..60ea1a45e2d1 100644
--- a/framework/qa/complex/api_internal/api.lst
+++ b/framework/qa/complex/api_internal/api.lst
@@ -102,7 +102,6 @@ job105=sc.ScIndexEnumeration_DataPilotTablesEnumeration
 job107=sc.ScIndexEnumeration_FunctionDescriptionEnumeration
 job108=sc.ScIndexEnumeration_LabelRangesEnumeration
 job109=sc.ScIndexEnumeration_NamedRangesEnumeration
-job110=sc.ScIndexEnumeration_ScenariosEnumeration
 job111=sc.ScIndexEnumeration_SheetCellRangesEnumeration
 job112=sc.ScIndexEnumeration_SheetLinksEnumeration
 job113=sc.ScIndexEnumeration_SpreadsheetsEnumeration
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index ddc54bd13ceb..ef5d60294bd8 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -1001,7 +1001,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration \
     qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration \
     qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration \
-    qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration \
     qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration \
     qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration \
     qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetsEnumeration \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScIndexEnumeration_ScenariosEnumeration.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScIndexEnumeration_ScenariosEnumeration.csv
deleted file mode 100644
index ef8fb10de08f..000000000000
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScIndexEnumeration_ScenariosEnumeration.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"ScIndexEnumeration_ScenariosEnumeration";"com::sun::star::container::XEnumeration";"hasMoreElements()"
-"ScIndexEnumeration_ScenariosEnumeration";"com::sun::star::container::XEnumeration";"nextElement()"
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java
deleted file mode 100644
index 6c0385ea9c8b..000000000000
--- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java
+++ /dev/null
@@ -1,116 +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 mod._sc;
-
-import java.io.PrintWriter;
-
-import lib.StatusException;
-import lib.TestCase;
-import lib.TestEnvironment;
-import lib.TestParameters;
-import util.SOfficeFactory;
-
-import com.sun.star.container.XEnumerationAccess;
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.lang.XComponent;
-import com.sun.star.sheet.XCellRangeAddressable;
-import com.sun.star.sheet.XScenariosSupplier;
-import com.sun.star.sheet.XSpreadsheet;
-import com.sun.star.sheet.XSpreadsheetDocument;
-import com.sun.star.sheet.XSpreadsheets;
-import com.sun.star.table.CellRangeAddress;
-import com.sun.star.table.XCellRange;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XInterface;
-
-public class ScIndexEnumeration_ScenariosEnumeration extends TestCase {
-    private XSpreadsheetDocument xSpreadsheetDoc;
-
-    /**
-    * Creates Spreadsheet document.
-    */
-    @Override
-    public void initialize( TestParameters Param, PrintWriter log ) {
-        // get a soffice factory object
-        SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF());
-
-        try {
-            log.println("creating a spreadsheetdocument");
-            xSpreadsheetDoc = SOF.createCalcDoc(null);
-        } catch (com.sun.star.uno.Exception e) {
-            e.printStackTrace( log );
-            throw new StatusException( "Couldn't create document ", e );
-        }
-    }
-
-    /**
-    * Disposes Spreadsheet document.
-    */
-    @Override
-    protected void cleanup( TestParameters tParam, PrintWriter log ) {
-        log.println( "    disposing xSheetDoc " );
-        XComponent oComp = UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
-        util.DesktopTools.closeDoc(oComp);
-    }
-
-    @Override
-    protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
-
-        log.println("getting sheets");
-        XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets();
-        log.println("getting a sheet");
-        XSpreadsheet oSheet = null;
-        XIndexAccess oIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
-        oSheet = (XSpreadsheet) AnyConverter.toObject(
-                new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
-
-        log.println("filling some cells");
-        oSheet.getCellByPosition(5, 5).setValue(15);
-        oSheet.getCellByPosition(1, 4).setValue(10);
-        oSheet.getCellByPosition(2, 0).setValue(-5.15);
-
-        XScenariosSupplier xSupp = UnoRuntime.queryInterface(XScenariosSupplier.class, oSheet);
-        XCellRange oRange = UnoRuntime.queryInterface(XCellRange.class, oSheet);
-        XCellRange myRange = oRange.getCellRangeByName("A1:N4");
-        XCellRangeAddressable oRangeAddr = UnoRuntime.queryInterface(XCellRangeAddressable.class, myRange);
-        CellRangeAddress myAddr = oRangeAddr.getRangeAddress();
-
-        CellRangeAddress[] oAddr = new CellRangeAddress[1];
-        oAddr[0] = myAddr;
-
-        xSupp.getScenarios().addNewByName("ScScenarios", oAddr, "Range");
-
-        XInterface oObj = xSupp.getScenarios();
-
-        XEnumerationAccess ea = UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
-
-        oObj = ea.createEnumeration();
-
-        log.println("ImplementationName: "+util.utils.getImplName(oObj));
-        // creating test environment
-        TestEnvironment tEnv = new TestEnvironment( oObj );
-
-        tEnv.addObjRelation("ENUM",ea);
-
-        return tEnv;
-    }
-}
-
diff --git a/sc/CppunitTest_sc_indexenumeration_scenariosenumeration.mk b/sc/CppunitTest_sc_indexenumeration_scenariosenumeration.mk
new file mode 100644
index 000000000000..74c83007b34f
--- /dev/null
+++ b/sc/CppunitTest_sc_indexenumeration_scenariosenumeration.mk
@@ -0,0 +1,43 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# 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/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_indexenumeration_scenariosenumeration))
+
+$(eval $(call gb_CppunitTest_use_external,sc_indexenumeration_scenariosenumeration,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_indexenumeration_scenariosenumeration, \
+	sc/qa/extras/scindexenumeration_scenariosenumeration \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_indexenumeration_scenariosenumeration, \
+	cppu \
+	sal \
+	subsequenttest \
+	test \
+	unotest \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_indexenumeration_scenariosenumeration,\
+	$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_indexenumeration_scenariosenumeration))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_indexenumeration_scenariosenumeration))
+$(eval $(call gb_CppunitTest_use_vcl,sc_indexenumeration_scenariosenumeration))
+
+$(eval $(call gb_CppunitTest_use_components,sc_indexenumeration_scenariosenumeration,\
+    $(sc_unoapi_common_components) \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_indexenumeration_scenariosenumeration))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index c4d0d7d87c7e..bb405f80f0a1 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -135,6 +135,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
 	CppunitTest_sc_functionlistobj \
 	CppunitTest_sc_headerfootercontentobj \
 	CppunitTest_sc_indexenumeration_ddelinksenumeration \
+	CppunitTest_sc_indexenumeration_scenariosenumeration \
 	CppunitTest_sc_importdescriptorbaseobj \
 	CppunitTest_sc_labelrangeobj \
 	CppunitTest_sc_labelrangesobj \
diff --git a/sc/qa/extras/scindexenumeration_scenariosenumeration.cxx b/sc/qa/extras/scindexenumeration_scenariosenumeration.cxx
new file mode 100644
index 000000000000..44c4c29f2677
--- /dev/null
+++ b/sc/qa/extras/scindexenumeration_scenariosenumeration.cxx
@@ -0,0 +1,106 @@
+/* -*- 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/calc_unoapi_test.hxx>
+#include <test/container/xenumeration.hxx>
+
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XScenariosSupplier.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSpreadsheets.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace sc_apitest
+{
+class ScIndexEnumeration_ScenariosEnumeration : public CalcUnoApiTest, public apitest::XEnumeration
+{
+public:
+    ScIndexEnumeration_ScenariosEnumeration();
+
+    virtual uno::Reference<uno::XInterface> init() override;
+    virtual void setUp() override;
+    virtual void tearDown() override;
+
+    CPPUNIT_TEST_SUITE(ScIndexEnumeration_ScenariosEnumeration);
+
+    // XEnumeration
+    CPPUNIT_TEST(testHasMoreElements);
+    CPPUNIT_TEST(testNextElement);
+
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    uno::Reference<lang::XComponent> m_xComponent;
+};
+
+ScIndexEnumeration_ScenariosEnumeration::ScIndexEnumeration_ScenariosEnumeration()
+    : CalcUnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
+uno::Reference<uno::XInterface> ScIndexEnumeration_ScenariosEnumeration::init()
+{
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
+
+    uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
+    uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
+
+    xSheet0->getCellByPosition(5, 5)->setValue(15);
+    xSheet0->getCellByPosition(1, 4)->setValue(10);
+    xSheet0->getCellByPosition(2, 0)->setValue(-5.15);
+
+    uno::Reference<sheet::XScenariosSupplier> xScenariosSupplier(xSheet0, uno::UNO_QUERY_THROW);
+    uno::Reference<table::XCellRange> xCellRange0(xSheet0, uno::UNO_QUERY_THROW);
+    uno::Reference<table::XCellRange> xCellRange1(xCellRange0->getCellRangeByName("A1:N4"),
+                                                  uno::UNO_QUERY_THROW);
+    uno::Reference<sheet::XCellRangeAddressable> xCRA(xCellRange1, uno::UNO_QUERY_THROW);
+
+    uno::Sequence<table::CellRangeAddress> aCRA(1);
+    aCRA[0] = xCRA->getRangeAddress();
+    xScenariosSupplier->getScenarios()->addNewByName("ScScenario", aCRA, "Range");
+    uno::Reference<container::XEnumerationAccess> xEA(xScenariosSupplier->getScenarios(),
+                                                      uno::UNO_QUERY_THROW);
+
+    return xEA->createEnumeration();
+}
+
+void ScIndexEnumeration_ScenariosEnumeration::setUp()
+{
+    CalcUnoApiTest::setUp();
+    m_xComponent = loadFromDesktop("private:factory/scalc");
+    CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent.is());
+}
+
+void ScIndexEnumeration_ScenariosEnumeration::tearDown()
+{
+    closeDocument(m_xComponent);
+    CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_ScenariosEnumeration);
+
+} // namespace sc_apitest
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sc/qa/unoapi/sc_5.sce b/sc/qa/unoapi/sc_5.sce
index 4c90d8a6b19a..d86af5afd130 100644
--- a/sc/qa/unoapi/sc_5.sce
+++ b/sc/qa/unoapi/sc_5.sce
@@ -22,7 +22,6 @@
 -o sc.ScIndexEnumeration_FunctionDescriptionEnumeration
 -o sc.ScIndexEnumeration_LabelRangesEnumeration
 -o sc.ScIndexEnumeration_NamedRangesEnumeration
--o sc.ScIndexEnumeration_ScenariosEnumeration
 -o sc.ScIndexEnumeration_SheetCellRangesEnumeration
 -o sc.ScIndexEnumeration_SheetLinksEnumeration
 -o sc.ScIndexEnumeration_SpreadsheetViewPanesEnumeration


More information about the Libreoffice-commits mailing list