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

Jens Carl j.carl43 at gmx.de
Thu Feb 1 17:16:07 UTC 2018


 sc/qa/extras/new_cond_format.cxx |   33 +++++++--------------------------
 1 file changed, 7 insertions(+), 26 deletions(-)

New commits:
commit 914b211addb231d24f721bdf249b4cc19658a308
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Wed Jan 31 22:31:07 2018 +0000

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

diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index bd5bdeecc40e..ee0a0e60e6b1 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -25,11 +25,6 @@ using namespace css;
 
 namespace sc_apitest {
 
-// tearDown checks this value before disposing mxCompnent
-// if NUMBER_OF_TESTS is less than the number of tests that call init(),
-// then the component is created again but not disposed, resulting in temp file leak
-#define NUMBER_OF_TESTS 7
-
 class ScConditionalFormatTest : public CalcUnoApiTest
 {
 public:
@@ -58,13 +53,9 @@ public:
     CPPUNIT_TEST_SUITE_END();
 private:
 
-    static sal_Int32 nTest;
-    static uno::Reference< lang::XComponent > mxComponent;
+    uno::Reference< lang::XComponent > mxComponent;
 };
 
-sal_Int32 ScConditionalFormatTest::nTest = 0;
-uno::Reference< lang::XComponent > ScConditionalFormatTest::mxComponent;
-
 ScConditionalFormatTest::ScConditionalFormatTest()
     : CalcUnoApiTest("sc/qa/extras/testdocuments/")
 {
@@ -72,17 +63,9 @@ ScConditionalFormatTest::ScConditionalFormatTest()
 
 uno::Reference< uno::XInterface > ScConditionalFormatTest::init(sal_Int32 nIndex)
 {
-    if(!mxComponent.is())
-    {
-        // get the test file
-        OUString aFileURL;
-        createFileURL("new_cond_format_api.ods", aFileURL);
-        mxComponent = loadFromDesktop(aFileURL);
-    }
-    CPPUNIT_ASSERT_MESSAGE("Component not loaded", mxComponent.is());
-
     // get the first sheet
     uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
     uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), uno::UNO_QUERY_THROW);
     uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(nIndex), uno::UNO_QUERY_THROW);
 
@@ -456,18 +439,16 @@ void ScConditionalFormatTest::testColorScaleProperties()
 
 void ScConditionalFormatTest::setUp()
 {
-    nTest++;
     CalcUnoApiTest::setUp();
+    // get the test file
+    OUString aFileURL;
+    createFileURL("new_cond_format_api.ods", aFileURL);
+    mxComponent = loadFromDesktop(aFileURL);
 }
 
 void ScConditionalFormatTest::tearDown()
 {
-    if (nTest == NUMBER_OF_TESTS)
-    {
-        closeDocument(mxComponent);
-        mxComponent.clear();
-    }
-
+    closeDocument(mxComponent);
     CalcUnoApiTest::tearDown();
 }
 


More information about the Libreoffice-commits mailing list