include/test/sheet/xcellrangedata.hxx | 3 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv | 2 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv | 2 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv | 2 sc/qa/extras/sccellcursorobj.cxx | 12 ++ sc/qa/extras/sctablesheetobj.cxx | 12 ++ test/source/sheet/xcellrangedata.cxx | 45 +++++++--- 7 files changed, 61 insertions(+), 17 deletions(-)
New commits: commit 939fc7dc50a038edb252a8da941ef4e1c018f2b0 Author: Jens Carl <j.car...@gmx.de> Date: Tue Jun 12 06:21:24 2018 +0000 tdf#45904 Move _XCellRangeData Java test to C++ Move the remaining tests to C++ and also enable/fix #i84671 by creating test cases for ScTableSheetObj. Change-Id: I9412fe7a1947b9afb4343a8f5726eccf9ea371a3 Reviewed-on: https://gerrit.libreoffice.org/55657 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Jens Carl <j.car...@gmx.de> diff --git a/include/test/sheet/xcellrangedata.hxx b/include/test/sheet/xcellrangedata.hxx index 7af4e7d9ea0f..00aef5e8152c 100644 --- a/include/test/sheet/xcellrangedata.hxx +++ b/include/test/sheet/xcellrangedata.hxx @@ -18,10 +18,13 @@ namespace apitest { class OOO_DLLPUBLIC_TEST XCellRangeData { public: + virtual css::uno::Reference< css::uno::XInterface > init() = 0; virtual css::uno::Reference< css::uno::XInterface > getXCellRangeData() = 0; void testGetDataArray(); void testSetDataArray(); + void testGetDataArrayOnTableSheet(); + void testSetDataArrayOnTableSheet(); protected: ~XCellRangeData() {} 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 cf6417dcdf44..74d9a7752bb9 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv @@ -190,8 +190,6 @@ "ScCellCursorObj";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()" "ScCellCursorObj";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()" "ScCellCursorObj";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()" -"ScCellCursorObj";"com::sun::star::sheet::XCellRangeData";"getDataArray()" -"ScCellCursorObj";"com::sun::star::sheet::XCellRangeData";"setDataArray()" "ScCellCursorObj";"com::sun::star::chart::XChartDataArray";"getData()" "ScCellCursorObj";"com::sun::star::chart::XChartDataArray";"setData()" "ScCellCursorObj";"com::sun::star::chart::XChartDataArray";"getRowDescriptions()" 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 3ca844258495..581e8884dec1 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv @@ -185,8 +185,6 @@ "ScCellRangeObj";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()" "ScCellRangeObj";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()" "ScCellRangeObj";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()" -"ScCellRangeObj";"com::sun::star::sheet::XCellRangeData";"getDataArray()" -"ScCellRangeObj";"com::sun::star::sheet::XCellRangeData";"setDataArray()" "ScCellRangeObj";"com::sun::star::chart::XChartDataArray";"getData()" "ScCellRangeObj";"com::sun::star::chart::XChartDataArray";"setData()" "ScCellRangeObj";"com::sun::star::chart::XChartDataArray";"getRowDescriptions()" 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 78efd29dae01..cb29417eb43b 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv @@ -192,8 +192,6 @@ "ScTableSheetObj";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()" "ScTableSheetObj";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()" "ScTableSheetObj";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()" -"ScTableSheetObj";"com::sun::star::sheet::XCellRangeData";"getDataArray()" -"ScTableSheetObj";"com::sun::star::sheet::XCellRangeData";"setDataArray()" "ScTableSheetObj";"com::sun::star::chart::XChartDataArray";"getData()" "ScTableSheetObj";"com::sun::star::chart::XChartDataArray";"setData()" "ScTableSheetObj";"com::sun::star::chart::XChartDataArray";"getRowDescriptions()" diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx index 61e564215787..eb38ea141087 100644 --- a/sc/qa/extras/sccellcursorobj.cxx +++ b/sc/qa/extras/sccellcursorobj.cxx @@ -12,6 +12,7 @@ #include <test/sheet/xarrayformularange.hxx> #include <test/sheet/xcellformatrangessupplier.hxx> #include <test/sheet/xcellrangeaddressable.hxx> +#include <test/sheet/xcellrangedata.hxx> #include <test/sheet/xcellrangeformula.hxx> #include <test/sheet/xcellseries.hxx> #include <test/sheet/xmultipleoperation.hxx> @@ -36,6 +37,7 @@ class ScCellCursorObj : public CalcUnoApiTest, public apitest::SheetCellRange, public apitest::XArrayFormulaRange, public apitest::XCellFormatRangesSupplier, public apitest::XCellRangeAddressable, + public apitest::XCellRangeData, public apitest::XCellRangeFormula, public apitest::XCellSeries, public apitest::XMultipleOperation, @@ -53,6 +55,7 @@ public: virtual void setUp() override; virtual void tearDown() override; virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference< uno::XInterface > getXCellRangeData() override; virtual uno::Reference< uno::XInterface > getXSpreadsheet() override; CPPUNIT_TEST_SUITE(ScCellCursorObj); @@ -69,6 +72,10 @@ public: // XCellRangeAddressable CPPUNIT_TEST(testGetRangeAddress); + // XCellRangeData + CPPUNIT_TEST(testGetDataArray); + CPPUNIT_TEST(testSetDataArray); + // XCellRangeFormula CPPUNIT_TEST(testGetSetFormulaArray); @@ -130,6 +137,11 @@ uno::Reference< uno::XInterface > ScCellCursorObj::init() return xCellCursor; } +uno::Reference< uno::XInterface > ScCellCursorObj::getXCellRangeData() +{ + return init(); +} + uno::Reference< uno::XInterface > ScCellCursorObj::getXSpreadsheet() { uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW); diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx index 475bf9a7b95f..8316207f605f 100644 --- a/sc/qa/extras/sctablesheetobj.cxx +++ b/sc/qa/extras/sctablesheetobj.cxx @@ -14,6 +14,7 @@ #include <test/sheet/xarrayformularange.hxx> #include <test/sheet/xcellformatrangessupplier.hxx> #include <test/sheet/xcellrangeaddressable.hxx> +#include <test/sheet/xcellrangedata.hxx> #include <test/sheet/xcellrangeformula.hxx> #include <test/sheet/xcellrangemovement.hxx> #include <test/sheet/xcellseries.hxx> @@ -54,6 +55,7 @@ class ScTableSheetObj : public CalcUnoApiTest, public apitest::Scenario, public apitest::XArrayFormulaRange, public apitest::XCellFormatRangesSupplier, public apitest::XCellRangeAddressable, + public apitest::XCellRangeData, public apitest::XCellRangeFormula, public apitest::XCellRangeMovement, public apitest::XCellSeries, @@ -86,6 +88,7 @@ public: virtual OUString getFileURL() override; virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference< uno::XInterface > getXCellRangeData() override; virtual uno::Reference< uno::XInterface > getXSpreadsheetDocument() override; virtual uno::Reference< uno::XInterface > getXSpreadsheet() override; virtual uno::Reference< uno::XInterface > getScenarioSpreadsheet() override; @@ -112,6 +115,10 @@ public: // XCellRangeAddressable CPPUNIT_TEST(testGetRangeAddress); + // XCellRangeData + CPPUNIT_TEST(testGetDataArrayOnTableSheet); + CPPUNIT_TEST(testSetDataArrayOnTableSheet); + // XCellRangeFormula #if 0 // disable, because it makes no sense to set an FormulaArray over the whole sheet CPPUNIT_TEST(testGetSetFormulaArray); @@ -245,6 +252,11 @@ uno::Reference< uno::XInterface > ScTableSheetObj::init() return xSheet; } +uno::Reference< uno::XInterface > ScTableSheetObj::getXCellRangeData() +{ + return init(); +} + uno::Reference<uno::XInterface> ScTableSheetObj::getXSpreadsheetDocument() { uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW); diff --git a/test/source/sheet/xcellrangedata.cxx b/test/source/sheet/xcellrangedata.cxx index acf99f2136e4..223fd5f7b32d 100644 --- a/test/source/sheet/xcellrangedata.cxx +++ b/test/source/sheet/xcellrangedata.cxx @@ -8,7 +8,12 @@ */ #include <test/sheet/xcellrangedata.hxx> + #include <com/sun/star/sheet/XCellRangeData.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.hxx> #include <cppunit/extensions/HelperMacros.h> @@ -43,17 +48,7 @@ void XCellRangeData::testSetDataArray() aColRow.realloc(4); setValues(aColRow, 1); xCellRangeData->setDataArray(aColRow); - // need to check here for correct values - - // set old values - setValues(aColRow, 0); - xCellRangeData->setDataArray(aColRow); -} -void XCellRangeData::testGetDataArray() -{ - uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); - uno::Sequence< uno::Sequence < Any > > aColRow = xCellRangeData->getDataArray(); for ( sal_Int32 i = 0; i < aColRow.getLength(); ++i) { for ( sal_Int32 j = 0; j < aColRow[i].getLength(); ++j) @@ -61,11 +56,39 @@ void XCellRangeData::testGetDataArray() Any& aAny = aColRow[i][j]; double nValue = 0.0; CPPUNIT_ASSERT( aAny >>= nValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i+j), nValue, 0.000001); + CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i+j+1), nValue, 0.000001); } } + + // set old values + setValues(aColRow, 0); + xCellRangeData->setDataArray(aColRow); } +void XCellRangeData::testGetDataArray() +{ + uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); + uno::Sequence< uno::Sequence < Any > > aColRow = xCellRangeData->getDataArray(); + CPPUNIT_ASSERT(aColRow.getLength()); +} + +void XCellRangeData::testGetDataArrayOnTableSheet() +{ + uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_THROW_MESSAGE("No RuntimeException thrown", xCellRangeData->getDataArray(), + css::uno::RuntimeException); +} + +void XCellRangeData::testSetDataArrayOnTableSheet() +{ + uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); + + uno::Sequence< uno::Sequence < Any > > aColRow; + aColRow.realloc(4); + setValues(aColRow, 1); + CPPUNIT_ASSERT_THROW_MESSAGE("No RuntimeException thrown", xCellRangeData->setDataArray(aColRow), + css::uno::RuntimeException); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits