diff options
-rw-r--r-- | include/test/sheet/sheetcellrange.hxx | 34 | ||||
-rw-r--r-- | qadevOOo/Jar_OOoRunner.mk | 1 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv | 6 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv | 6 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv | 6 | ||||
-rw-r--r-- | qadevOOo/tests/java/ifc/sheet/_SheetCellRange.java | 35 | ||||
-rw-r--r-- | sc/qa/extras/sccellcursorobj.cxx | 7 | ||||
-rw-r--r-- | sc/qa/extras/sccellrangeobj.cxx | 5 | ||||
-rw-r--r-- | sc/qa/extras/sctablesheetobj.cxx | 5 | ||||
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/sheet/sheetcellrange.cxx | 167 |
11 files changed, 218 insertions, 55 deletions
diff --git a/include/test/sheet/sheetcellrange.hxx b/include/test/sheet/sheetcellrange.hxx new file mode 100644 index 000000000000..d4c2b551a27b --- /dev/null +++ b/include/test/sheet/sheetcellrange.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_SHEETCELLRANGE_HXX +#define INCLUDED_TEST_SHEET_SHEETCELLRANGE_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 SheetCellRange +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + + void testSheetCellRangeProperties(); + +protected: + ~SheetCellRange() {} +}; +} + +#endif // INCLUDED_TEST_SHEET_SHEETCELLRANGE_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 ac4ae33a1f08..c86db777237a 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/_SheetCellRange \ qadevOOo/tests/java/ifc/sheet/_SheetCellRanges \ qadevOOo/tests/java/ifc/sheet/_SheetFilterDescriptor \ qadevOOo/tests/java/ifc/sheet/_SheetLink \ 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 d95c2f6d4327..3f85f6821258 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv @@ -133,12 +133,6 @@ "ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellByPosition()" "ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()" "ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellRangeByName()" -"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"Position" -"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"Size" -"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat" -"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormatLocal#optional" -"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"Validation" -"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"ValidationLocal#optional" "ScCellCursorObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"setPropertyValuesTolerant()" "ScCellCursorObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getPropertyValuesTolerant()" "ScCellCursorObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getDirectPropertyValuesTolerant()" 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 7be5d04df577..08ca6f6f39c3 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv @@ -128,12 +128,6 @@ "ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellByPosition()" "ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()" "ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellRangeByName()" -"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"Position" -"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"Size" -"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat" -"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormatLocal#optional" -"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"Validation" -"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"ValidationLocal#optional" "ScCellRangeObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"setPropertyValuesTolerant()" "ScCellRangeObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getPropertyValuesTolerant()" "ScCellRangeObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getDirectPropertyValuesTolerant()" 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 a733f9e19d38..a28faa13a253 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv @@ -140,12 +140,6 @@ "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellByPosition()" "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()" "ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByName()" -"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"Position" -"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"Size" -"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat" -"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormatLocal#optional" -"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"Validation" -"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"ValidationLocal#optional" "ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"setPropertyValuesTolerant()" "ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getPropertyValuesTolerant()" "ScTableSheetObj";"com::sun::star::beans::XTolerantMultiPropertySet#optional";"getDirectPropertyValuesTolerant()" diff --git a/qadevOOo/tests/java/ifc/sheet/_SheetCellRange.java b/qadevOOo/tests/java/ifc/sheet/_SheetCellRange.java deleted file mode 100644 index 84f4b9d44664..000000000000 --- a/qadevOOo/tests/java/ifc/sheet/_SheetCellRange.java +++ /dev/null @@ -1,35 +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; - -/** -* Testing <code>com.sun.star.sheet.SheetCellRange</code> -* service properties : -* <ul> -* <li><code> Position</code></li> -* <li><code> Size</code></li> -* </ul> <p> -* Properties testing is automated by <code>lib.MultiPropertyTest</code>. -* @see com.sun.star.sheet.SheetCellRange -*/ -public class _SheetCellRange extends MultiPropertyTest { -} // finish class _SheetCellRange - diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx index 344be839f720..b4ea737616c7 100644 --- a/sc/qa/extras/sccellcursorobj.cxx +++ b/sc/qa/extras/sccellcursorobj.cxx @@ -8,6 +8,7 @@ */ #include <test/calc_unoapi_test.hxx> +#include <test/sheet/sheetcellrange.hxx> #include <test/sheet/xcellformatrangessupplier.hxx> #include <test/sheet/xcellrangeaddressable.hxx> #include <test/sheet/xcellseries.hxx> @@ -29,7 +30,8 @@ using namespace css::uno; namespace sc_apitest { -class ScCellCursorObj : public CalcUnoApiTest, public apitest::XCellFormatRangesSupplier, +class ScCellCursorObj : public CalcUnoApiTest, public apitest::SheetCellRange, + public apitest::XCellFormatRangesSupplier, public apitest::XCellRangeAddressable, public apitest::XCellSeries, public apitest::XMultipleOperation, @@ -51,6 +53,9 @@ public: CPPUNIT_TEST_SUITE(ScCellCursorObj); + // SheetCellRange + CPPUNIT_TEST(testSheetCellRangeProperties); + // XUsedAreaCursor CPPUNIT_TEST(testGotoStartOfUsedArea); CPPUNIT_TEST(testGotoEndOfUsedArea); diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx index 8c9b9423696b..1fd0b4ada63f 100644 --- a/sc/qa/extras/sccellrangeobj.cxx +++ b/sc/qa/extras/sccellrangeobj.cxx @@ -9,6 +9,7 @@ #include <test/calc_unoapi_test.hxx> #include <test/sheet/cellproperties.hxx> +#include <test/sheet/sheetcellrange.hxx> #include <test/sheet/xcellformatrangessupplier.hxx> #include <test/sheet/xcellrangeaddressable.hxx> #include <test/sheet/xcellrangedata.hxx> @@ -47,6 +48,7 @@ using namespace css::uno; namespace sc_apitest { class ScCellRangeObj : public CalcUnoApiTest, public apitest::CellProperties, + public apitest::SheetCellRange, public apitest::XCellFormatRangesSupplier, public apitest::XCellRangeAddressable, public apitest::XCellRangeData, @@ -78,6 +80,9 @@ public: CPPUNIT_TEST(testVertJustify); CPPUNIT_TEST(testRotateReference); + // SheetCellRange + CPPUNIT_TEST(testSheetCellRangeProperties); + // XCellFormatRangesSupplier CPPUNIT_TEST(testGetCellFormatRanges); diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx index 30a2d365dedb..4a10553ea774 100644 --- a/sc/qa/extras/sctablesheetobj.cxx +++ b/sc/qa/extras/sctablesheetobj.cxx @@ -9,6 +9,7 @@ #include <test/calc_unoapi_test.hxx> #include <test/sheet/scenario.hxx> +#include <test/sheet/sheetcellrange.hxx> #include <test/sheet/xcellformatrangessupplier.hxx> #include <test/sheet/xcellrangeaddressable.hxx> #include <test/sheet/xcellseries.hxx> @@ -43,6 +44,7 @@ namespace sc_apitest { class ScTableSheetObj : public CalcUnoApiTest, public apitest::Scenario, + public apitest::SheetCellRange, public apitest::XCellFormatRangesSupplier, public apitest::XCellRangeAddressable, public apitest::XCellSeries, @@ -82,6 +84,9 @@ public: // Scenario CPPUNIT_TEST(testScenarioProperties); + // SheetCellRange + CPPUNIT_TEST(testSheetCellRangeProperties); + // XCellFormatRangesSupplier CPPUNIT_TEST(testGetCellFormatRanges); diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index df6a7c71d842..20e8f2b15568 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -54,6 +54,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/sheet/spreadsheetviewsettings \ test/source/sheet/subtotaldescriptor \ test/source/sheet/sheetcell \ + test/source/sheet/sheetcellrange \ test/source/sheet/tableautoformat \ test/source/sheet/tablevalidation \ test/source/sheet/xarealink \ diff --git a/test/source/sheet/sheetcellrange.cxx b/test/source/sheet/sheetcellrange.cxx new file mode 100644 index 000000000000..f9870d79145a --- /dev/null +++ b/test/source/sheet/sheetcellrange.cxx @@ -0,0 +1,167 @@ +/* -*- 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/sheetcellrange.hxx> + +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#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 SheetCellRange::testSheetCellRangeProperties() +{ + uno::Reference<beans::XPropertySet> xSheetCellRange(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "Position"; + awt::Point aPositionGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Position", + xSheetCellRange->getPropertyValue(propName) >>= aPositionGet); + + awt::Point aPositionSet(42, 42); + aNewValue <<= aPositionSet; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aPositionSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue Position", aPositionGet, aPositionGet); + + propName = "Size"; + awt::Size aSizeGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Size", + xSheetCellRange->getPropertyValue(propName) >>= aSizeGet); + + awt::Size aSizeSet(42, 42); + aNewValue <<= aSizeGet; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aSizeSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue Size", aSizeGet, aSizeSet); + + 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", + xSheetCellRange->getPropertyValue(propName) >>= aConditionalFormatGet); + + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatNew(aConditionalFormatGet, + UNO_QUERY_THROW); + aConditionalFormatNew->addNew(aPropValue); + + aNewValue <<= aConditionalFormatNew; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->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", + xSheetCellRange->getPropertyValue(propName) + >>= aConditionalFormatLocalGet); + + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalNew( + aConditionalFormatLocalGet, UNO_QUERY_THROW); + aConditionalFormatLocalNew->addNew(aPropValue); + + aNewValue <<= aConditionalFormatLocalNew; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->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", + xSheetCellRange->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; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->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", + xSheetCellRange->getPropertyValue(propName) >>= aValidationLocalGet); + + uno::Reference<beans::XPropertySet> aValidationLocalNew(aValidationLocalGet, UNO_QUERY_THROW); + aValidationType <<= sheet::ValidationType_WHOLE; + aValidationLocalNew->setPropertyValue("Type", aValidationType); + + aNewValue <<= aValidationLocalNew; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->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", + xSheetCellRange->getPropertyValue(propName) >>= aAbsoluteNameGet); + + OUString aAbsoluteNameSet = "$Sheet1.$C$3"; + aNewValue <<= aAbsoluteNameSet; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->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: */ |