[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 Jan 3 02:51:03 UTC 2018


 include/test/sheet/scenario.hxx                                 |   34 ++
 qadevOOo/Jar_OOoRunner.mk                                       |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv |    8 
 qadevOOo/tests/java/ifc/sheet/_Scenario.java                    |   33 --
 sc/qa/extras/sctablesheetobj.cxx                                |    9 
 test/Library_subsequenttest.mk                                  |    1 
 test/source/sheet/scenario.cxx                                  |  115 ++++++++++
 7 files changed, 157 insertions(+), 44 deletions(-)

New commits:
commit 23a1c5429c67986a945baab6dae553e58d2d72d9
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Wed Jan 3 00:47:36 2018 +0000

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

diff --git a/include/test/sheet/scenario.hxx b/include/test/sheet/scenario.hxx
new file mode 100644
index 000000000000..3a3ec8d87121
--- /dev/null
+++ b/include/test/sheet/scenario.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_SCENARIO_HXX
+#define INCLUDED_TEST_SHEET_SCENARIO_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 Scenario
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> getScenarioSpreadsheet() = 0;
+
+    void testScenarioProperties();
+
+protected:
+    ~Scenario() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SCENARIO_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 1fa333cd889b..de087a156028 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -567,7 +567,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sheet/_DocumentSettings \
     qadevOOo/tests/java/ifc/sheet/_FunctionDescription \
     qadevOOo/tests/java/ifc/sheet/_GlobalSheetSettings \
-    qadevOOo/tests/java/ifc/sheet/_Scenario \
     qadevOOo/tests/java/ifc/sheet/_Shape \
     qadevOOo/tests/java/ifc/sheet/_SheetCell \
     qadevOOo/tests/java/ifc/sheet/_SheetCellRange \
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 fcebef99d308..a733f9e19d38 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
@@ -109,14 +109,6 @@
 "ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontPitchComplex"
 "ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharPostureComplex"
 "ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharLocaleComplex"
-"ScTableSheetObj";"com::sun::star::sheet::Scenario";"IsActive#optional"
-"ScTableSheetObj";"com::sun::star::sheet::Scenario";"BorderColor#optional"
-"ScTableSheetObj";"com::sun::star::sheet::Scenario";"Protected#optional"
-"ScTableSheetObj";"com::sun::star::sheet::Scenario";"ShowBorder#optional"
-"ScTableSheetObj";"com::sun::star::sheet::Scenario";"PrintBorder#optional"
-"ScTableSheetObj";"com::sun::star::sheet::Scenario";"CopyBack#optional"
-"ScTableSheetObj";"com::sun::star::sheet::Scenario";"CopyStyles#optional"
-"ScTableSheetObj";"com::sun::star::sheet::Scenario";"CopyFormulas#optional"
 "ScTableSheetObj";"com::sun::star::util::XProtectable";"protect()"
 "ScTableSheetObj";"com::sun::star::util::XProtectable";"unprotect()"
 "ScTableSheetObj";"com::sun::star::util::XProtectable";"isProtected()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_Scenario.java b/qadevOOo/tests/java/ifc/sheet/_Scenario.java
deleted file mode 100644
index 48efe7a84bb6..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_Scenario.java
+++ /dev/null
@@ -1,33 +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.beans.XPropertySet;
-import com.sun.star.uno.UnoRuntime;
-
-import lib.MultiPropertyTest;
-
-
-public class _Scenario extends MultiPropertyTest {
-    @Override
-    public void before() {
-        oObj = UnoRuntime.queryInterface(XPropertySet.class,
-                                                        tEnv.getObjRelation(
-                                                                "ScenarioSheet"));
-    }
-}
\ No newline at end of file
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index 9345c3f32a7f..ad859a6a4153 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <test/calc_unoapi_test.hxx>
+#include <test/sheet/scenario.hxx>
 #include <test/sheet/xcellformatrangessupplier.hxx>
 #include <test/sheet/xcellrangeaddressable.hxx>
 #include <test/sheet/xcellseries.hxx>
@@ -41,9 +42,10 @@ using namespace css::uno;
 namespace sc_apitest
 {
 
-#define NUMBER_OF_TESTS 34
+#define NUMBER_OF_TESTS 35
 
-class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellFormatRangesSupplier,
+class ScTableSheetObj : public CalcUnoApiTest, public apitest::Scenario,
+                                               public apitest::XCellFormatRangesSupplier,
                                                public apitest::XCellRangeAddressable,
                                                public apitest::XCellSeries,
                                                public apitest::XDataPilotTablesSupplier,
@@ -79,6 +81,9 @@ public:
 
     CPPUNIT_TEST_SUITE(ScTableSheetObj);
 
+    // Scenario
+    CPPUNIT_TEST(testScenarioProperties);
+
     // XCellFormatRangesSupplier
     CPPUNIT_TEST(testGetCellFormatRanges);
 
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 0cb66492db9f..5793f689fc82 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -47,6 +47,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
 	test/source/sheet/databaserange \
 	test/source/sheet/datapilotfield \
 	test/source/sheet/datapilotitem \
+	test/source/sheet/scenario \
 	test/source/sheet/xarealink \
 	test/source/sheet/xarealinks \
 	test/source/sheet/xcelladdressable \
diff --git a/test/source/sheet/scenario.cxx b/test/source/sheet/scenario.cxx
new file mode 100644
index 000000000000..1e89d0fa7a20
--- /dev/null
+++ b/test/source/sheet/scenario.cxx
@@ -0,0 +1,115 @@
+/* -*- 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 <array>
+#include <test/sheet/scenario.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#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 Scenario::testScenarioProperties()
+{
+    uno::Reference<beans::XPropertySet> xScenario(getScenarioSpreadsheet(), UNO_QUERY_THROW);
+    OUString propName;
+    uno::Any aNewValue;
+
+    propName = "IsActive";
+    bool aIsActive = false;
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aIsActive);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value IsActive", aIsActive);
+
+    aNewValue <<= false;
+    xScenario->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aIsActive);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value IsActive", !aIsActive);
+
+    propName = "BorderColor";
+    sal_Int32 aBorderColor = 0;
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aBorderColor);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value BorderColor", sal_Int32(12632256),
+                                 aBorderColor);
+
+    aNewValue <<= sal_Int32(42);
+    xScenario->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aBorderColor);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set property value BorderColor", sal_Int32(42),
+                                 aBorderColor);
+
+    propName = "Protected";
+    bool aProtected = false;
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aProtected);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value Protected", aProtected);
+
+    aNewValue <<= false;
+    xScenario->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aProtected);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value Protected", !aProtected);
+
+    propName = "ShowBorder";
+    bool aShowBorder = false;
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aShowBorder);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value ShowBorder", aShowBorder);
+
+    aNewValue <<= false;
+    xScenario->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aShowBorder);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value ShowBorder", !aShowBorder);
+
+    propName = "PrintBorder";
+    bool aPrintBorder = false;
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aPrintBorder);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value PrintBorder", aPrintBorder);
+
+    aNewValue <<= false;
+    xScenario->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aPrintBorder);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value PrintBorder", !aPrintBorder);
+
+    propName = "CopyBack";
+    bool aCopyBack = false;
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyBack);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyBack", aCopyBack);
+
+    aNewValue <<= false;
+    xScenario->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyBack);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyBack", !aCopyBack);
+
+    propName = "CopyStyles";
+    bool aCopyStyles = true;
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyStyles);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyStyles", !aCopyStyles);
+
+    aNewValue <<= true;
+    xScenario->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyStyles);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyStyles", aCopyStyles);
+
+    propName = "CopyFormulas";
+    bool aCopyFormulas = false;
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyFormulas);
+    CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyFormulas", aCopyFormulas);
+
+    aNewValue <<= false;
+    xScenario->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyFormulas);
+    CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyFormulas", !aCopyFormulas);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list