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

Jens Carl j.carl43 at gmx.de
Wed Jan 31 08:06:14 UTC 2018


 sc/qa/extras/scsubtotalfieldobj.cxx |   24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

New commits:
commit 43b19dc7c23fd75c4e7bedfb8290d296d756573e
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Tue Jan 30 21:42:08 2018 +0000

    Remove shared mxComponent (test document) in scsubtotalfieldobj
    
    Change-Id: If47716c6dbc353059c42a2bcd09f7c11ed53796f
    Reviewed-on: https://gerrit.libreoffice.org/48937
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jens Carl <j.carl43 at gmx.de>

diff --git a/sc/qa/extras/scsubtotalfieldobj.cxx b/sc/qa/extras/scsubtotalfieldobj.cxx
index 6ddbaf8686c0..50e55745a756 100644
--- a/sc/qa/extras/scsubtotalfieldobj.cxx
+++ b/sc/qa/extras/scsubtotalfieldobj.cxx
@@ -31,8 +31,6 @@ using namespace com::sun::star;
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 2
-
 class ScSubTotalFieldObj : public CalcUnoApiTest, public apitest::XSubTotalField
 {
 public:
@@ -51,14 +49,10 @@ public:
     CPPUNIT_TEST_SUITE_END();
 
 private:
-    static sal_Int32 nTest;
-    static uno::Reference< lang::XComponent > mxComponent;
+    uno::Reference< lang::XComponent > mxComponent;
 
 };
 
-sal_Int32 ScSubTotalFieldObj::nTest = 0;
-uno::Reference< lang::XComponent > ScSubTotalFieldObj::mxComponent;
-
 ScSubTotalFieldObj::ScSubTotalFieldObj()
     : CalcUnoApiTest("/sc/qa/extras/testdocuments")
 {
@@ -66,10 +60,6 @@ ScSubTotalFieldObj::ScSubTotalFieldObj()
 
 uno::Reference< uno::XInterface > ScSubTotalFieldObj::init()
 {
-    // create a calc document
-    if (!mxComponent.is())
-        mxComponent = loadFromDesktop("private:factory/scalc");
-
     uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
 
@@ -94,19 +84,15 @@ uno::Reference< uno::XInterface > ScSubTotalFieldObj::init()
 
 void ScSubTotalFieldObj::setUp()
 {
-    nTest++;
-    CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
     CalcUnoApiTest::setUp();
+    // create a calc document
+    mxComponent = loadFromDesktop("private:factory/scalc");
+
 }
 
 void ScSubTotalFieldObj::tearDown()
 {
-    if (nTest == NUMBER_OF_TESTS)
-    {
-        closeDocument(mxComponent);
-        mxComponent.clear();
-    }
-
+    closeDocument(mxComponent);
     CalcUnoApiTest::tearDown();
 }
 


More information about the Libreoffice-commits mailing list