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

Jens Carl j.carl43 at gmx.de
Tue Jan 30 23:21:17 UTC 2018


 sc/qa/extras/scoutlineobj.cxx |   36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

New commits:
commit 1a43f636b20dbeed0c112bd1b97d862184ead089
Author: Jens Carl <j.carl43 at gmx.de>
Date:   Tue Jan 30 18:26:46 2018 +0000

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

diff --git a/sc/qa/extras/scoutlineobj.cxx b/sc/qa/extras/scoutlineobj.cxx
index de14185e2db5..167cab94ad6a 100644
--- a/sc/qa/extras/scoutlineobj.cxx
+++ b/sc/qa/extras/scoutlineobj.cxx
@@ -10,6 +10,7 @@
 #include <test/calc_unoapi_test.hxx>
 #include <test/sheet/xsheetoutline.hxx>
 
+#include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 
@@ -18,8 +19,6 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 6
-
 class ScOutlineObj : public CalcUnoApiTest, public apitest::XSheetOutline
 {
 public:
@@ -31,23 +30,22 @@ public:
     virtual uno::Reference< uno::XInterface > init() override;
 
     CPPUNIT_TEST_SUITE(ScOutlineObj);
+
+    // XSheetOutline
     CPPUNIT_TEST(testHideDetail);
     CPPUNIT_TEST(testShowDetail);
     CPPUNIT_TEST(testShowLevel);
     CPPUNIT_TEST(testUngroup);
     CPPUNIT_TEST(testGroup);
-  //  CPPUNIT_TEST(testAutoOutline);
+    //CPPUNIT_TEST(testAutoOutline);
     CPPUNIT_TEST(testClearOutline);
+
     CPPUNIT_TEST_SUITE_END();
-private:
 
-    static sal_Int32 nTest;
-    static uno::Reference< lang::XComponent > mxComponent;
+private:
+    uno::Reference< lang::XComponent > mxComponent;
 };
 
-sal_Int32 ScOutlineObj::nTest = 0;
-uno::Reference< lang::XComponent > ScOutlineObj::mxComponent;
-
 ScOutlineObj::ScOutlineObj()
     : CalcUnoApiTest("/sc/qa/extras/testdocuments")
 {
@@ -55,13 +53,6 @@ ScOutlineObj::ScOutlineObj()
 
 uno::Reference< uno::XInterface > ScOutlineObj::init()
 {
-    // get the test file
-    OUString aFileURL;
-    createFileURL("ScOutlineObj.ods", aFileURL);
-    if(!mxComponent.is())
-        mxComponent = loadFromDesktop(aFileURL);
-    CPPUNIT_ASSERT_MESSAGE("Component not loaded", mxComponent.is());
-
     // get the first sheet
     uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW);
     CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
@@ -74,19 +65,16 @@ uno::Reference< uno::XInterface > ScOutlineObj::init()
 
 void ScOutlineObj::setUp()
 {
-    nTest++;
-    CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
     CalcUnoApiTest::setUp();
+    // create a calc document
+    OUString aFileURL;
+    createFileURL("ScOutlineObj.ods", aFileURL);
+    mxComponent = loadFromDesktop(aFileURL);
 }
 
 void ScOutlineObj::tearDown()
 {
-    if (nTest == NUMBER_OF_TESTS)
-    {
-        closeDocument(mxComponent);
-        mxComponent.clear();
-    }
-
+    closeDocument(mxComponent);
     CalcUnoApiTest::tearDown();
 }
 


More information about the Libreoffice-commits mailing list