summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAleksas Pantechovskis <alex.pantec@gmail.com>2016-03-06 16:47:31 +0200
committerMichael Stahl <mstahl@redhat.com>2016-03-07 12:17:08 +0000
commit14c14094e8587d28eb9cd2a3b5c0c57b355635b5 (patch)
treea4a962194421c522b4e0a293aaf18864a7b03026 /sc
parent48c887fc7a9adfe390512c807c99b08b5f5b41f3 (diff)
tdf#65219 Fix temp files clean up in sc unit tests
Change-Id: I23bf5d47c2cce31d6dd076eeac58cb2ce47b248a Reviewed-on: https://gerrit.libreoffice.org/22953 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/extras/new_cond_format.cxx5
-rw-r--r--sc/qa/extras/sccondformats.cxx2
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx4
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx15
4 files changed, 25 insertions, 1 deletions
diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index c4fab7cd85f7..0ac9888d539b 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -25,7 +25,10 @@ using namespace css;
namespace sc_apitest {
-#define NUMBER_OF_TESTS 5
+// 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
{
diff --git a/sc/qa/extras/sccondformats.cxx b/sc/qa/extras/sccondformats.cxx
index 02ebd5146b4e..0ac865b4c762 100644
--- a/sc/qa/extras/sccondformats.cxx
+++ b/sc/qa/extras/sccondformats.cxx
@@ -218,6 +218,8 @@ void ScConditionalFormatTest::testUndoAnchor()
CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), newType == ScDrawLayer::GetAnchorType(*pObject) );
CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), GRAPHIC_BITMAP, rGraphicObj.GetGraphic().GetType());
CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes());
+
+ xComponent->dispose();
}
void ScConditionalFormatTest::setUp()
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 4c6e6d8d033d..a32cd5af3fdc 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3075,6 +3075,8 @@ void ScExportTest::testRefStringConfigXLSX()
CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_OOO,
aConfig.meStringRefAddressSyntax);
+ xDocSh->DoClose();
+
// this doc has no entry for ref syntax
xDocSh = loadDoc("empty-noconf.", FORMAT_XLSX);
CPPUNIT_ASSERT_MESSAGE("Failed to open 2nd doc", xDocSh.Is());
@@ -3142,6 +3144,8 @@ void ScExportTest::testHeaderImage()
OUString aURL;
xStyle->getPropertyValue("HeaderBackGraphicURL") >>= aURL;
CPPUNIT_ASSERT(aURL.startsWith("vnd.sun.star.GraphicObject:"));
+
+ xDocSh->DoClose();
}
void ScExportTest::testTextDirection()
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index d4a8426c79e7..144e19e40e16 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -1731,6 +1731,8 @@ void ScFiltersTest::testCellAnchoredHiddenShapesXLSX()
SdrObject* pObj = pPage->GetObj(1);
CPPUNIT_ASSERT_MESSAGE("Failed to get drawing object.", pObj);
CPPUNIT_ASSERT_MESSAGE("The shape having same twocellanchor from and to attribute values, is visible.", !pObj->IsVisible());
+
+ xDocSh->DoClose();
}
namespace {
@@ -2439,6 +2441,8 @@ void ScFiltersTest::testCondFormatThemeColorXLSX()
pColorScaleEntry = pColorScale->GetEntry(1);
CPPUNIT_ASSERT(pColorScaleEntry);
CPPUNIT_ASSERT_EQUAL(Color(157, 195, 230), pColorScaleEntry->GetColor());
+
+ xDocSh->DoClose();
}
void ScFiltersTest::testCondFormatThemeColor2XLSX()
@@ -2460,6 +2464,8 @@ void ScFiltersTest::testCondFormatThemeColor2XLSX()
CPPUNIT_ASSERT(pDataBarFormatData->mpNegativeColor.get());
CPPUNIT_ASSERT_EQUAL(Color(217, 217, 217), *pDataBarFormatData->mpNegativeColor.get());
CPPUNIT_ASSERT_EQUAL(Color(197, 90, 17), pDataBarFormatData->maAxisColor);
+
+ xDocSh->DoClose();
}
namespace {
@@ -2520,6 +2526,8 @@ void ScFiltersTest::testComplexIconSetsXLSX()
testCustomIconSetsXLSX_Impl(rDoc, 3, 1, IconSet_4RedToBlack, 3);
testCustomIconSetsXLSX_Impl(rDoc, 3, 2, IconSet_3TrafficLights1, 1);
testCustomIconSetsXLSX_Impl(rDoc, 3, 3, IconSet_3Arrows, 2);
+
+ xDocSh->DoClose();
}
void ScFiltersTest::testCondFormatParentXLSX()
@@ -2534,6 +2542,8 @@ void ScFiltersTest::testCondFormatParentXLSX()
const SfxPoolItem& rPoolItem = pPattern->GetItem(ATTR_VER_JUSTIFY, pCondSet);
const SvxVerJustifyItem& rVerJustify = static_cast<const SvxVerJustifyItem&>(rPoolItem);
CPPUNIT_ASSERT_EQUAL(SVX_VER_JUSTIFY_TOP, static_cast<SvxCellVerJustify>(rVerJustify.GetValue()));
+
+ xDocSh->DoClose();
}
void ScFiltersTest::testColorScaleNumWithRefXLSX()
@@ -2563,6 +2573,8 @@ void ScFiltersTest::testColorScaleNumWithRefXLSX()
const ScColorScaleEntry* pColorScaleEntry = pColorScale->GetEntry(1);
CPPUNIT_ASSERT_EQUAL(OUString("=$A$1"),
pColorScaleEntry->GetFormula(formula::FormulaGrammar::GRAM_NATIVE));
+
+ xDocSh->DoClose();
}
void ScFiltersTest::testLiteralInFormulaXLS()
@@ -3143,6 +3155,7 @@ void ScFiltersTest::testRefStringXLSX()
const ScCalcConfig& rCalcConfig = rDoc.GetCalcConfig();
CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, rCalcConfig.meStringRefAddressSyntax);
+ xDocSh->DoClose();
}
void ScFiltersTest::testBnc762542()
@@ -3180,6 +3193,8 @@ void ScFiltersTest::testHiddenSheetsXLSX()
CPPUNIT_ASSERT_EQUAL_MESSAGE("1st sheet should be hidden", false, rDoc.IsVisible(0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("2nd sheet should be visible", true, rDoc.IsVisible(1));
CPPUNIT_ASSERT_EQUAL_MESSAGE("3rd sheet should be hidden", false, rDoc.IsVisible(2));
+
+ xDocSh->DoClose();
}
ScFiltersTest::ScFiltersTest()