include/test/sheet/sheetcellranges.hxx                          |   34 ++
 qadevOOo/Jar_OOoRunner.mk                                       |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangesObj.csv |    4 
 qadevOOo/tests/java/ifc/sheet/_SheetCellRanges.java             |   24 -
 sc/qa/extras/sccellrangesobj.cxx                                |    5 
 test/Library_subsequenttest.mk                                  |    1 
 test/source/sheet/sheetcellranges.cxx                           |  143 
++++++++++
 7 files changed, 183 insertions(+), 29 deletions(-)

New commits:
commit 4a8856dad808e0ae8b6f4efc49edcee0b0678a37
Author: Jens Carl <j.car...@gmx.de>
Date:   Thu Feb 1 23:24:30 2018 +0000

    tdf#45904 Move _SheetCellRanges Java tests to C++
    
    Change-Id: If391071a7e44c2fbeaaa0fa46f6043f30e777cec
    Reviewed-on: https://gerrit.libreoffice.org/49125
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Jens Carl <j.car...@gmx.de>

diff --git a/include/test/sheet/sheetcellranges.hxx 
b/include/test/sheet/sheetcellranges.hxx
new file mode 100644
index 000000000000..f40b186fad65
--- /dev/null
+++ b/include/test/sheet/sheetcellranges.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_SHEETCELLRANGES_HXX
+#define INCLUDED_TEST_SHEET_SHEETCELLRANGES_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 SheetCellRanges
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+
+    void testSheetCellRangesProperties();
+
+protected:
+    ~SheetCellRanges() {}
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_SHEETCELLRANGES_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 c86db777237a..b3f79bb2feb5 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -565,7 +565,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sdb/_XSQLErrorBroadcaster \
     qadevOOo/tests/java/ifc/sheet/_FunctionDescription \
     qadevOOo/tests/java/ifc/sheet/_Shape \
-    qadevOOo/tests/java/ifc/sheet/_SheetCellRanges \
     qadevOOo/tests/java/ifc/sheet/_SheetFilterDescriptor \
     qadevOOo/tests/java/ifc/sheet/_SheetLink \
     qadevOOo/tests/java/ifc/sheet/_SheetSortDescriptor \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangesObj.csv 
b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangesObj.csv
index bedb81212c36..94ac66e6be7c 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangesObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangesObj.csv
@@ -115,10 +115,6 @@
 
"ScCellRangesObj";"com::sun::star::style::CharacterPropertiesComplex";"CharLocaleComplex"
 "ScCellRangesObj";"com::sun::star::sheet::XFormulaQuery";"queryDependents()"
 "ScCellRangesObj";"com::sun::star::sheet::XFormulaQuery";"queryPrecedents()"
-"ScCellRangesObj";"com::sun::star::sheet::SheetCellRanges";"ConditionalFormat"
-"ScCellRangesObj";"com::sun::star::sheet::SheetCellRanges";"ConditionalFormatLocal#optional"
-"ScCellRangesObj";"com::sun::star::sheet::SheetCellRanges";"Validation"
-"ScCellRangesObj";"com::sun::star::sheet::SheetCellRanges";"ValidationLocal#optional"
 "ScCellRangesObj";"com::sun::star::util::XIndent";"decrementIndent()"
 "ScCellRangesObj";"com::sun::star::util::XIndent";"incrementIndent()"
 
"ScCellRangesObj";"com::sun::star::sheet::XCellRangesQuery";"queryVisibleCells()"
diff --git a/qadevOOo/tests/java/ifc/sheet/_SheetCellRanges.java 
b/qadevOOo/tests/java/ifc/sheet/_SheetCellRanges.java
deleted file mode 100644
index 8e26a37e5b5e..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_SheetCellRanges.java
+++ /dev/null
@@ -1,24 +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.MultiPropertyTest;
-
-public class _SheetCellRanges extends MultiPropertyTest {
-
-}
diff --git a/sc/qa/extras/sccellrangesobj.cxx b/sc/qa/extras/sccellrangesobj.cxx
index 17dbe4f9b614..5a0c5e90139c 100644
--- a/sc/qa/extras/sccellrangesobj.cxx
+++ b/sc/qa/extras/sccellrangesobj.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <test/calc_unoapi_test.hxx>
+#include <test/sheet/sheetcellranges.hxx>
 #include <test/sheet/xsheetcellrangecontainer.hxx>
 #include <test/sheet/xsheetcellranges.hxx>
 #include <test/sheet/xsheetoperation.hxx>
@@ -28,6 +29,7 @@ using namespace css::uno;
 namespace sc_apitest {
 
 class ScCellRangesObj : public CalcUnoApiTest,
+                        public apitest::SheetCellRanges,
                         public apitest::XSheetCellRangeContainer,
                         public apitest::XSheetCellRanges,
                         public apitest::XSheetOperation
@@ -42,6 +44,9 @@ public:
 
     CPPUNIT_TEST_SUITE(ScCellRangesObj);
 
+    // SheetCellRanges
+    CPPUNIT_TEST(testSheetCellRangesProperties);
+
     // XSheetCellRangeContainer
     CPPUNIT_TEST(testAddRemoveRangeAddress);
     CPPUNIT_TEST(testAddRemoveRangeAddresses);
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 20e8f2b15568..4c976adb2ccf 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -55,6 +55,7 @@ $(eval $(call 
gb_Library_add_exception_objects,subsequenttest,\
        test/source/sheet/subtotaldescriptor \
        test/source/sheet/sheetcell \
        test/source/sheet/sheetcellrange \
+       test/source/sheet/sheetcellranges \
        test/source/sheet/tableautoformat \
        test/source/sheet/tablevalidation \
        test/source/sheet/xarealink \
diff --git a/test/source/sheet/sheetcellranges.cxx 
b/test/source/sheet/sheetcellranges.cxx
new file mode 100644
index 000000000000..013968f0ec5e
--- /dev/null
+++ b/test/source/sheet/sheetcellranges.cxx
@@ -0,0 +1,143 @@
+/* -*- 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/cppunitasserthelper.hxx>
+#include <test/sheet/sheetcellranges.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/ValidationType.hpp>
+#include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
+#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void SheetCellRanges::testSheetCellRangesProperties()
+{
+    uno::Reference<beans::XPropertySet> xSheetCellRanges(init(), 
UNO_QUERY_THROW);
+    OUString propName;
+    uno::Any aNewValue;
+
+    uno::Sequence<beans::PropertyValue> aPropValue(1);
+    aPropValue[0].Name = "StyleName";
+    aPropValue[0].Value <<= OUString("Result2");
+
+    propName = "ConditionalFormat";
+    uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatGet;
+    uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatSet;
+
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormat",
+                           xSheetCellRanges->getPropertyValue(propName) >>= 
aConditionalFormatGet);
+
+    uno::Reference<sheet::XSheetConditionalEntries> 
aConditionalFormatNew(aConditionalFormatGet,
+                                                                          
UNO_QUERY_THROW);
+    aConditionalFormatNew->addNew(aPropValue);
+
+    aNewValue <<= aConditionalFormatNew;
+    xSheetCellRanges->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= 
aConditionalFormatSet);
+    for (auto i = 0; i < aConditionalFormatSet->getCount(); i++)
+    {
+        uno::Reference<sheet::XSheetConditionalEntry> 
xSCENew(aConditionalFormatNew->getByIndex(i),
+                                                              UNO_QUERY_THROW);
+        uno::Reference<sheet::XSheetConditionalEntry> 
xSCESet(aConditionalFormatSet->getByIndex(i),
+                                                              UNO_QUERY_THROW);
+
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue 
ConditionalFormat["
+                                         + std::to_string(i) + "]",
+                                     xSCENew->getStyleName(), 
xSCESet->getStyleName());
+    }
+
+    propName = "ConditionalFormatLocal";
+    uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalGet;
+    uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalSet;
+
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue 
ConditionalFormatLocal",
+                           xSheetCellRanges->getPropertyValue(propName)
+                           >>= aConditionalFormatLocalGet);
+
+    uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalNew(
+        aConditionalFormatLocalGet, UNO_QUERY_THROW);
+    aConditionalFormatLocalNew->addNew(aPropValue);
+
+    aNewValue <<= aConditionalFormatLocalNew;
+    xSheetCellRanges->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= 
aConditionalFormatLocalSet);
+    for (auto i = 0; i < aConditionalFormatLocalSet->getCount(); i++)
+    {
+        uno::Reference<sheet::XSheetConditionalEntry> xSCENew(
+            aConditionalFormatLocalNew->getByIndex(i), UNO_QUERY_THROW);
+        uno::Reference<sheet::XSheetConditionalEntry> xSCESet(
+            aConditionalFormatLocalSet->getByIndex(i), UNO_QUERY_THROW);
+
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue 
ConditionalFormatLocal["
+                                         + std::to_string(i) + "]",
+                                     xSCENew->getStyleName(), 
xSCESet->getStyleName());
+    }
+
+    propName = "Validation";
+    uno::Reference<beans::XPropertySet> aValidationGet;
+    uno::Reference<beans::XPropertySet> aValidationSet;
+
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Validation",
+                           xSheetCellRanges->getPropertyValue(propName) >>= 
aValidationGet);
+
+    uno::Reference<beans::XPropertySet> aValidationNew(aValidationGet, 
UNO_QUERY_THROW);
+    uno::Any aValidationType;
+    aValidationType <<= sheet::ValidationType_WHOLE;
+    aValidationNew->setPropertyValue("Type", aValidationType);
+
+    aNewValue <<= aValidationNew;
+    xSheetCellRanges->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= 
aValidationSet);
+    sheet::ValidationType aType;
+    aValidationSet->getPropertyValue("Type") >>= aType;
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Validation",
+                                 sheet::ValidationType_WHOLE, aType);
+
+    propName = "ValidationLocal";
+    uno::Reference<beans::XPropertySet> aValidationLocalGet;
+    uno::Reference<beans::XPropertySet> aValidationLocalSet;
+
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ValidationLocal",
+                           xSheetCellRanges->getPropertyValue(propName) >>= 
aValidationLocalGet);
+
+    uno::Reference<beans::XPropertySet> 
aValidationLocalNew(aValidationLocalGet, UNO_QUERY_THROW);
+    aValidationType <<= sheet::ValidationType_WHOLE;
+    aValidationLocalNew->setPropertyValue("Type", aValidationType);
+
+    aNewValue <<= aValidationLocalNew;
+    xSheetCellRanges->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= 
aValidationLocalSet);
+    aValidationLocalSet->getPropertyValue("Type") >>= aType;
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ValidationLocal",
+                                 sheet::ValidationType_WHOLE, aType);
+
+    propName = "AbsoluteName";
+    OUString aAbsoluteNameGet = "";
+    CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue AbsoluteName",
+                           xSheetCellRanges->getPropertyValue(propName) >>= 
aAbsoluteNameGet);
+
+    OUString aAbsoluteNameSet = "$Sheet1.$C$3";
+    aNewValue <<= aAbsoluteNameSet;
+    xSheetCellRanges->setPropertyValue(propName, aNewValue);
+    CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= 
aAbsoluteNameSet);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue AbsoluteName", 
aAbsoluteNameGet,
+                                 aAbsoluteNameSet);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to