[Libreoffice-commits] core.git: 7 commits - sal/cppunittester sc/qa sot/source sw/source

Michael Stahl mstahl at redhat.com
Tue Oct 14 15:10:21 PDT 2014


 sal/cppunittester/cppunittester.cxx          |    3 +++
 sc/qa/extras/htmlexporttest.cxx              |   19 ++++++++++++-------
 sc/qa/unit/subsequent_export-test.cxx        |    1 +
 sc/qa/unit/subsequent_filters-test.cxx       |    2 ++
 sc/qa/unit/ucalc.cxx                         |    3 +++
 sot/source/sdstor/stgstrms.cxx               |    2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |    1 +
 7 files changed, 23 insertions(+), 8 deletions(-)

New commits:
commit 9f874d411adf260d13626e3a70a47fcf67a28152
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 14 23:56:47 2014 +0200

    sc: fix temp file leak in ScHTMLExportTest
    
    Change-Id: Iab385ce8b24dd24985ec9b2d0c9d2a4e603d0fd0

diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx
index a9c0000..8e61944d 100644
--- a/sc/qa/extras/htmlexporttest.cxx
+++ b/sc/qa/extras/htmlexporttest.cxx
@@ -19,6 +19,7 @@
 #include <comphelper/processfactory.hxx>
 #include <unotools/mediadescriptor.hxx>
 #include <unotools/ucbstreamhelper.hxx>
+#include <unotools/localfilehelper.hxx>
 #include <unotest/macros_test.hxx>
 #include <sfx2/docfilt.hxx>
 #include <sfx2/docfile.hxx>
@@ -33,7 +34,6 @@ using namespace utl;
 class ScHTMLExportTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools, public HtmlTestTools
 {
     Reference<XComponent> mxComponent;
-    TempFile              maTempFile;
     OUString              maFilterOptions;
 
     void load(const char* pDir, const char* pName)
@@ -45,8 +45,6 @@ class ScHTMLExportTest : public test::BootstrapFixture, public unotest::MacrosTe
 
     void save(const OUString& aFilterName, TempFile& rTempFile)
     {
-        rTempFile.EnableKillingFile();
-
         Reference<XStorable> xStorable(mxComponent, UNO_QUERY);
         MediaDescriptor aMediaDescriptor;
         aMediaDescriptor["FilterName"] <<= aFilterName;
@@ -75,11 +73,16 @@ public:
 
     void testHtmlSkipImage()
     {
+        // need a temp dir, because there's an image exported too
+        TempFile aTempDir(0, true);
+        OUString const url(aTempDir.GetURL());
+        TempFile aTempFile(&url, false);
+
         htmlDocPtr pDoc;
 
         load("/sc/qa/extras/testdocuments/", "BaseForHTMLExport.ods");
-        save("HTML (StarCalc)", maTempFile);
-        pDoc = parseHtml(maTempFile);
+        save("HTML (StarCalc)", aTempFile);
+        pDoc = parseHtml(aTempFile);
         CPPUNIT_ASSERT (pDoc);
 
         assertXPath(pDoc, "/html/body", 1);
@@ -87,12 +90,14 @@ public:
 
         load("/sc/qa/extras/testdocuments/", "BaseForHTMLExport.ods");
         maFilterOptions = OUString("SkipImages");
-        save("HTML (StarCalc)", maTempFile);
+        save("HTML (StarCalc)", aTempFile);
 
-        pDoc = parseHtml(maTempFile);
+        pDoc = parseHtml(aTempFile);
         CPPUNIT_ASSERT (pDoc);
         assertXPath(pDoc, "/html/body", 1);
         assertXPath(pDoc, "/html/body/table/tr/td/img", 0);
+
+        utl::removeTree(aTempDir.GetURL());
     }
 
     CPPUNIT_TEST_SUITE(ScHTMLExportTest);
commit c0b1d1bf5701d5f94b618f70da8e863d32d97ab4
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 14 23:32:05 2014 +0200

    cppunittester: make tracking down temp file leaks easier
    
    Temp files created before first test method don't see LO_TESTNAME
    
    Change-Id: Iff74abf574f5151980f463646f11c1b32ad0c241

diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index 51bc5c6..148eed0 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -237,6 +237,9 @@ public:
 #ifdef UNX
             EyecatcherListener eye;
             result.addListener(&eye);
+            // set this to track down files created before first test method
+            std::string lib(testlib.substr(testlib.rfind('/')+1));
+            setenv("LO_TESTNAME", lib.c_str(), true);
 #endif
 
             CppUnit::TestRunner runner;
commit 33cac6c68bd2f2628832953c22be22022169f241
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 14 22:53:04 2014 +0200

    sc: fix temp file leaks in ucalc Test
    
    Change-Id: Id5243aa37578cf9ed534603f3b27e83f0678c3fb

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 19d13a3..5aaec72 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -167,6 +167,7 @@ void Test::setUp()
 
 void Test::tearDown()
 {
+    m_pImpl->m_xDocShell->DoClose();
     m_pImpl->m_xDocShell.Clear();
     BootstrapFixture::tearDown();
 }
@@ -4686,6 +4687,8 @@ void Test::testCopyPasteFormulasExternalDoc()
     CPPUNIT_ASSERT_EQUAL(aFormula, OUString("='file:///source.fake'#$Sheet2.B$1"));
     rExtDoc.GetFormula(1,6,1, aFormula);
     CPPUNIT_ASSERT_EQUAL(aFormula, OUString("=$ExtSheet2.$B$2"));
+
+    xExtDocSh->DoClose();
 }
 
 void Test::testFindAreaPosVertical()
commit 03d103b04b4ac7f926bf1b1bb3c30829900e4239
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 14 22:44:40 2014 +0200

    sc: fix temp file leak in ScFiltersTest
    
    Change-Id: I1920fa405f377abafe793b4bbec52b8b141459f6

diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 3622600..fd3840a 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -447,6 +447,8 @@ void ScFiltersTest::testFunctionsODS()
     ScDocument& rDoc3 = xDocSh->GetDocument();
     createCSVPath("date-time-functions.", aCSVFileName);
     testFile(aCSVFileName, rDoc3, 0, PureString);
+
+    xDocSh->DoClose();
 }
 
 void ScFiltersTest::testFunctionsExcel2010()
commit 70f6775314553e80ea8d1897e15e2d68c5ae1d4e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 14 22:38:11 2014 +0200

    sc: fix temp file leak in ScExportTest
    
    Change-Id: I9b9944fa1b9e00989a499f7a8fac74097ae9d61b

diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 924f779..988ed34 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -254,6 +254,7 @@ void ScExportTest::test()
     ScDocument& rLoadedDoc = xDocSh->GetDocument();
     double aVal = rLoadedDoc.GetValue(0,0,0);
     ASSERT_DOUBLES_EQUAL(aVal, 1.0);
+    xDocSh->DoClose();
 }
 
 #if !defined MACOSX && !defined DRAGONFLY
commit 15510bf9ee26ed01c53b32beb2aea97ffa3e62fc
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 14 22:35:38 2014 +0200

    sot: stop leaking temp files from StgTmpStrm
    
    The problem is that "aName" is stored as a file path, but
    osl_removeFile only works with URLs.
    
    Change-Id: I6929efc89a9e1a2292f038482b88d38946e6e4e8

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index f2450c9..5b5e5c3 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -1192,7 +1192,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
     {
         if( n > THRESHOLD )
         {
-            aName = utl::TempFile::CreateTempName();
+            aName = utl::TempFile(0, false).GetURL();
             SvFileStream* s = new SvFileStream( aName, STREAM_READWRITE );
             sal_uLong nCur = Tell();
             sal_uLong i = nEndOfData;
commit dd6d9fd5db0a02d5fd4b63a07408921266a38989
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 14 18:06:56 2014 +0200

    ww8: warning C4701: potentially uninitialized local variable
    
    Apparently xmloff supports at least one value that has no equivalent in
    OOXML; just use "none" for now.
    
    Change-Id: I76d2802c7c91ea756125e66c229ec5fdb2e7ec3b

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2ad4a32..360e0a4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6333,6 +6333,7 @@ void DocxAttributeOutput::CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasis
 
     switch ( rEmphasisMark.GetValue() )
     {
+    default:
     case EMPHASISMARK_NONE:
         pEmphasis = "none";
         break;


More information about the Libreoffice-commits mailing list