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

Aleksas Pantechovskis alex.pantec at gmail.com
Mon Mar 7 12:17:29 UTC 2016


 sc/qa/extras/new_cond_format.cxx       |    5 ++++-
 sc/qa/extras/sccondformats.cxx         |    2 ++
 sc/qa/unit/subsequent_export-test.cxx  |    4 ++++
 sc/qa/unit/subsequent_filters-test.cxx |   15 +++++++++++++++
 4 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 14c14094e8587d28eb9cd2a3b5c0c57b355635b5
Author: Aleksas Pantechovskis <alex.pantec at gmail.com>
Date:   Sun Mar 6 16:47:31 2016 +0200

    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 at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index c4fab7c..0ac9888 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 02ebd51..0ac865b 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 4c6e6d8..a32cd5a 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 d4a8426..144e19e 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()


More information about the Libreoffice-commits mailing list