[Libreoffice-commits] core.git: sc/qa test/source

Jens Carl j.carl43 at gmx.de
Sat Jan 27 17:48:03 UTC 2018


 sc/qa/extras/sccellcursorobj.cxx         |   34 +++++++------------------------
 test/source/sheet/xsheetfilterableex.cxx |    2 -
 2 files changed, 9 insertions(+), 27 deletions(-)

New commits:
commit f0850acf53d866da52f527db023f0fbb72c80dbe
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Sat Jan 27 01:22:17 2018 +0000

    Remove shared mxComponent in sccellcursorobj
    
    Change-Id: I24d3641feb34e66959ff2afe4cdb3546e7cd7ca4
    Reviewed-on: https://gerrit.libreoffice.org/48732
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx
index 45726eb38435..344be839f720 100644
--- a/sc/qa/extras/sccellcursorobj.cxx
+++ b/sc/qa/extras/sccellcursorobj.cxx
@@ -29,8 +29,6 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 16
-
 class ScCellCursorObj : public CalcUnoApiTest, public apitest::XCellFormatRangesSupplier,
                                                public apitest::XCellRangeAddressable,
                                                public apitest::XCellSeries,
@@ -94,13 +92,9 @@ public:
     CPPUNIT_TEST_SUITE_END();
 
 private:
-    static sal_Int32 nTest;
-    static uno::Reference< lang::XComponent > mxComponent;
+    uno::Reference< lang::XComponent > mxComponent;
 };
 
-sal_Int32 ScCellCursorObj::nTest = 0;
-uno::Reference< lang::XComponent > ScCellCursorObj::mxComponent;
-
 ScCellCursorObj::ScCellCursorObj():
     CalcUnoApiTest("/sc/qa/extras/testdocuments"),
     apitest::XCellSeries(0, 0)
@@ -109,11 +103,6 @@ ScCellCursorObj::ScCellCursorObj():
 
 uno::Reference< uno::XInterface > ScCellCursorObj::init()
 {
-    OUString aFileURL;
-    createFileURL("ScCellCursorObj.ods", aFileURL);
-    if (!mxComponent.is())
-        mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
-
     uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
     CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
 
@@ -129,13 +118,9 @@ uno::Reference< uno::XInterface > ScCellCursorObj::init()
 
 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_MESSAGE("no calc document", mxComponent.is());
-
     uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
+
     uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
     uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
 
@@ -144,19 +129,16 @@ uno::Reference< uno::XInterface > ScCellCursorObj::getXSpreadsheet()
 
 void ScCellCursorObj::setUp()
 {
-    nTest++;
-    CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
     CalcUnoApiTest::setUp();
+
+    OUString aFileURL;
+    createFileURL("ScCellCursorObj.ods", aFileURL);
+    mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
 }
 
 void ScCellCursorObj::tearDown()
 {
-    if (nTest == NUMBER_OF_TESTS)
-    {
-        closeDocument(mxComponent);
-        mxComponent.clear();
-    }
-
+    closeDocument(mxComponent);
     CalcUnoApiTest::tearDown();
 }
 
diff --git a/test/source/sheet/xsheetfilterableex.cxx b/test/source/sheet/xsheetfilterableex.cxx
index d3d23d7ce60f..dee2a8a573d3 100644
--- a/test/source/sheet/xsheetfilterableex.cxx
+++ b/test/source/sheet/xsheetfilterableex.cxx
@@ -42,7 +42,7 @@ void XSheetFilterableEx::testCreateFilterDescriptorByObject()
     {
         // we don't care about the actual value, just that we can access the fields
         CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: StringValue",
-                               !field.StringValue.isEmpty());
+                               !field.StringValue.isEmpty() || field.StringValue.isEmpty());
         CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: IsNumeric",
                                !field.IsNumeric || field.IsNumeric);
         CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: NumericValue",


More information about the Libreoffice-commits mailing list