Kaydet (Commit) 914b211a authored tarafından Jens Carl's avatar Jens Carl

Remove shared mxComponent (test document) in new_cond_format

Change-Id: I4f23971186ab7c61fb6c76422f654291333ee07d
Reviewed-on: https://gerrit.libreoffice.org/49067Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 740137d8
...@@ -25,11 +25,6 @@ using namespace css; ...@@ -25,11 +25,6 @@ using namespace css;
namespace sc_apitest { 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 class ScConditionalFormatTest : public CalcUnoApiTest
{ {
public: public:
...@@ -58,13 +53,9 @@ public: ...@@ -58,13 +53,9 @@ public:
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
static sal_Int32 nTest; uno::Reference< lang::XComponent > mxComponent;
static uno::Reference< lang::XComponent > mxComponent;
}; };
sal_Int32 ScConditionalFormatTest::nTest = 0;
uno::Reference< lang::XComponent > ScConditionalFormatTest::mxComponent;
ScConditionalFormatTest::ScConditionalFormatTest() ScConditionalFormatTest::ScConditionalFormatTest()
: CalcUnoApiTest("sc/qa/extras/testdocuments/") : CalcUnoApiTest("sc/qa/extras/testdocuments/")
{ {
...@@ -72,17 +63,9 @@ ScConditionalFormatTest::ScConditionalFormatTest() ...@@ -72,17 +63,9 @@ ScConditionalFormatTest::ScConditionalFormatTest()
uno::Reference< uno::XInterface > ScConditionalFormatTest::init(sal_Int32 nIndex) 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 // get the first sheet
uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW); 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< container::XIndexAccess > xIndex (xDoc->getSheets(), uno::UNO_QUERY_THROW);
uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(nIndex), uno::UNO_QUERY_THROW); uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(nIndex), uno::UNO_QUERY_THROW);
...@@ -456,18 +439,16 @@ void ScConditionalFormatTest::testColorScaleProperties() ...@@ -456,18 +439,16 @@ void ScConditionalFormatTest::testColorScaleProperties()
void ScConditionalFormatTest::setUp() void ScConditionalFormatTest::setUp()
{ {
nTest++;
CalcUnoApiTest::setUp(); CalcUnoApiTest::setUp();
// get the test file
OUString aFileURL;
createFileURL("new_cond_format_api.ods", aFileURL);
mxComponent = loadFromDesktop(aFileURL);
} }
void ScConditionalFormatTest::tearDown() void ScConditionalFormatTest::tearDown()
{ {
if (nTest == NUMBER_OF_TESTS) closeDocument(mxComponent);
{
closeDocument(mxComponent);
mxComponent.clear();
}
CalcUnoApiTest::tearDown(); CalcUnoApiTest::tearDown();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment