summaryrefslogtreecommitdiff
path: root/sc/qa/extras/new_cond_format.cxx
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2018-01-31 22:31:07 +0000
committerJens Carl <j.carl43@gmx.de>2018-02-01 18:15:39 +0100
commit914b211addb231d24f721bdf249b4cc19658a308 (patch)
treef21538234936b221c0bc630d48ffdb3e0a9b7476 /sc/qa/extras/new_cond_format.cxx
parent740137d8ccc50fea073224cc7e69173676536f5e (diff)
Remove shared mxComponent (test document) in new_cond_format
Change-Id: I4f23971186ab7c61fb6c76422f654291333ee07d Reviewed-on: https://gerrit.libreoffice.org/49067 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'sc/qa/extras/new_cond_format.cxx')
-rw-r--r--sc/qa/extras/new_cond_format.cxx33
1 files changed, 7 insertions, 26 deletions
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();
}