include/test/sheet/xusedareacursor.hxx |    1 +
 sc/qa/extras/sccellcursorobj.cxx       |   18 ++++++++++++++++++
 test/source/sheet/xcellseries.cxx      |    7 ++-----
 test/source/sheet/xusedareacursor.cxx  |    4 ++--
 4 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit 1f54caef187dc73acda934808cc5d8d91f72b882
Author: Jens Carl <j.car...@gmx.de>
Date:   Tue Aug 8 09:54:47 2017 +0000

    Fix for failing tests of xcellseries with ScCellRangeObj ...
    
    ... (CppunitTest_sc_cellrangeobj) introduced by
    commit 27cbca2c8dccbbb299621b49e5ffd836188202f0.
    
    Change-Id: I97be4f70de52abd974bf1198063d28f2ff419dbd
    Reviewed-on: https://gerrit.libreoffice.org/40871
    Reviewed-by: Michael Stahl <mst...@redhat.com>
    Tested-by: Michael Stahl <mst...@redhat.com>

diff --git a/include/test/sheet/xusedareacursor.hxx 
b/include/test/sheet/xusedareacursor.hxx
index 9e98aa3ae25b..546907ddfa7c 100644
--- a/include/test/sheet/xusedareacursor.hxx
+++ b/include/test/sheet/xusedareacursor.hxx
@@ -23,6 +23,7 @@ class OOO_DLLPUBLIC_TEST XUsedAreaCursor
 {
 public:
     virtual uno::Reference< uno::XInterface > init() = 0;
+    virtual uno::Reference< uno::XInterface > getXSpreadsheet() = 0;
     virtual ~XUsedAreaCursor(){}
 
     void testGotoStartOfUsedArea();
diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx
index 7450034b7705..eefdcb98bd6d 100644
--- a/sc/qa/extras/sccellcursorobj.cxx
+++ b/sc/qa/extras/sccellcursorobj.cxx
@@ -13,6 +13,7 @@
 
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCellCursor.hpp>
 
 using namespace css;
 using namespace css::uno;
@@ -29,6 +30,7 @@ public:
     virtual void setUp() override;
     virtual void tearDown() override;
     virtual uno::Reference< uno::XInterface > init() override;
+    virtual uno::Reference< uno::XInterface > getXSpreadsheet() override;
 
     CPPUNIT_TEST_SUITE(ScCellCursorObj);
 
@@ -67,6 +69,22 @@ uno::Reference< uno::XInterface > ScCellCursorObj::init()
     uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, 
UNO_QUERY_THROW);
     uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), 
UNO_QUERY_THROW);
     uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), 
UNO_QUERY_THROW);
+    uno::Reference< table::XCellCursor > xCellCursor( xSheet->createCursor(), 
UNO_QUERY_THROW);
+
+    return xCellCursor;
+}
+
+uno::Reference< uno::XInterface > ScCellCursorObj::getXSpreadsheet()
+{
+    OUString aFileURL;
+    createFileURL("ScCellCursorObj.ods", aFileURL);
+    if(!mxComponent.is())
+        mxComponent = loadFromDesktop(aFileURL, 
"com.sun.star.sheet.SpreadsheetDocument");
+    CPPUNIT_ASSERT(mxComponent.is());
+
+    uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, 
UNO_QUERY_THROW);
+    uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), 
UNO_QUERY_THROW);
+    uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), 
UNO_QUERY_THROW);
 
     return xSheet;
 }
diff --git a/test/source/sheet/xcellseries.cxx 
b/test/source/sheet/xcellseries.cxx
index 222fce29ef7e..61dbcecdc751 100644
--- a/test/source/sheet/xcellseries.cxx
+++ b/test/source/sheet/xcellseries.cxx
@@ -10,7 +10,6 @@
 #include <test/sheet/xcellseries.hxx>
 
 #include <com/sun/star/sheet/XCellSeries.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
 
 #include "cppunit/extensions/HelperMacros.h"
@@ -22,8 +21,7 @@ namespace apitest {
 
 void XCellSeries::testFillAuto()
 {
-    uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW);
-    uno::Reference<table::XCellRange> xCellRange(xSheet->createCursor(), 
UNO_QUERY_THROW);
+    uno::Reference<table::XCellRange> xCellRange(init(), UNO_QUERY_THROW);
     sal_Int32 maValue = xCellRange->getCellByPosition(maStartX, 
maStartY)->getValue();
 
     uno::Reference<table::XCellRange> 
xCellRangeH(xCellRange->getCellRangeByPosition(maStartX, maStartY, maStartX + 
2, maStartY), UNO_QUERY_THROW);
@@ -56,8 +54,7 @@ void XCellSeries::testFillAuto()
 
 void XCellSeries::testFillSeries()
 {
-    uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW);
-    uno::Reference<table::XCellRange> xCellRange(xSheet->createCursor(), 
UNO_QUERY_THROW);
+    uno::Reference<table::XCellRange> xCellRange(init(), UNO_QUERY_THROW);
     sal_Int32 maValue = xCellRange->getCellByPosition(maStartX, 
maStartY)->getValue();
 
     uno::Reference<table::XCellRange> 
xCellRangeH(xCellRange->getCellRangeByPosition(maStartX, maStartY, maStartX + 
2, maStartY), UNO_QUERY_THROW);
diff --git a/test/source/sheet/xusedareacursor.cxx 
b/test/source/sheet/xusedareacursor.cxx
index fdde5f6cd52f..7613842bd5dc 100644
--- a/test/source/sheet/xusedareacursor.cxx
+++ b/test/source/sheet/xusedareacursor.cxx
@@ -26,7 +26,7 @@ namespace apitest {
 
 void XUsedAreaCursor::testGotoStartOfUsedArea()
 {
-    uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW);
+    uno::Reference< sheet::XSpreadsheet > xSheet(getXSpreadsheet(), 
UNO_QUERY_THROW);
     uno::Reference< sheet::XSheetCellCursor > 
xSheetCellCursor(xSheet->createCursor(), UNO_QUERY_THROW);
     uno::Reference< sheet::XCellRangeAddressable> 
xCellRangeAddressable(xSheetCellCursor, UNO_QUERY_THROW);
 
@@ -60,7 +60,7 @@ void XUsedAreaCursor::testGotoStartOfUsedArea()
 
 void XUsedAreaCursor::testGotoEndOfUsedArea()
 {
-    uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW);
+    uno::Reference< sheet::XSpreadsheet > xSheet(getXSpreadsheet(), 
UNO_QUERY_THROW);
     uno::Reference< sheet::XSheetCellCursor > 
xSheetCellCursor(xSheet->createCursor(), UNO_QUERY_THROW);
     uno::Reference< sheet::XCellRangeAddressable> 
xCellRangeAddressable(xSheetCellCursor, UNO_QUERY_THROW);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to