summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-03-16 20:06:59 +0100
committerLuboš Luňák <l.lunak@suse.cz>2012-03-16 20:09:34 +0100
commitf15023d34037068147f6afe83a187b2fb515351b (patch)
tree65376bfb263216538a64fb2d71487b01a27e374e /sdext
parentccd8e23b4d42c492ce0836313b99118c974a02b0 (diff)
do not let a unittest create temp files in the current directory
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/test/tests.cxx22
1 files changed, 10 insertions, 12 deletions
diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx
index d3fa3e748b31..b73da1ddb133 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -596,15 +596,14 @@ namespace
pdfi::PDFIRawAdaptor aAdaptor( impl_getComponentContext() );
aAdaptor.setTreeVisitorFactory( createDrawTreeVisitorFactory() );
- ::rtl::OUString aURL, aAbsURL, aBaseURL;
- osl_getFileURLFromSystemPath( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pdfi_unittest_draw.xml"))).pData,
- &aURL.pData );
- osl_getProcessWorkingDir(&aBaseURL.pData);
- osl_getAbsoluteFileURL(aBaseURL.pData,aURL.pData,&aAbsURL.pData);
+ ::rtl::OUString tempFileURL;
+ CPPUNIT_ASSERT( osl::File::createTempFile( NULL, NULL, &tempFileURL ) == osl::File::E_None );
+ osl::File::remove( tempFileURL ); // FIXME the below apparently fails silently if the file already exists
CPPUNIT_ASSERT_MESSAGE("Exporting to ODF",
aAdaptor.odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"),
- new OutputWrap(aAbsURL),
+ new OutputWrap(tempFileURL),
NULL ));
+ osl::File::remove( tempFileURL );
}
void testOdfWriterExport()
@@ -612,15 +611,14 @@ namespace
pdfi::PDFIRawAdaptor aAdaptor( impl_getComponentContext() );
aAdaptor.setTreeVisitorFactory( createWriterTreeVisitorFactory() );
- ::rtl::OUString aURL, aAbsURL, aBaseURL;
- osl_getFileURLFromSystemPath( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pdfi_unittest_writer.xml"))).pData,
- &aURL.pData );
- osl_getProcessWorkingDir(&aBaseURL.pData);
- osl_getAbsoluteFileURL(aBaseURL.pData,aURL.pData,&aAbsURL.pData);
+ ::rtl::OUString tempFileURL;
+ CPPUNIT_ASSERT( osl::File::createTempFile( NULL, NULL, &tempFileURL ) == osl::File::E_None );
+ osl::File::remove( tempFileURL ); // FIXME the below apparently fails silently if the file already exists
CPPUNIT_ASSERT_MESSAGE("Exporting to ODF",
aAdaptor.odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"),
- new OutputWrap(aAbsURL),
+ new OutputWrap(tempFileURL),
NULL ));
+ osl::File::remove( tempFileURL );
}
CPPUNIT_TEST_SUITE(PDFITest);