summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-10-14 23:56:47 +0200
committerMichael Stahl <mstahl@redhat.com>2014-10-15 00:04:33 +0200
commit9f874d411adf260d13626e3a70a47fcf67a28152 (patch)
tree9001d9c61cd8bbb079ef4c6bd5c45f6e5417c777 /sc
parentc0b1d1bf5701d5f94b618f70da8e863d32d97ab4 (diff)
sc: fix temp file leak in ScHTMLExportTest
Change-Id: Iab385ce8b24dd24985ec9b2d0c9d2a4e603d0fd0
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/extras/htmlexporttest.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx
index a9c0000e37d1..8e61944d583e 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);