Kaydet (Commit) f15023d3 authored tarafından Luboš Luňák's avatar Luboš Luňák

do not let a unittest create temp files in the current directory

üst ccd8e23b
...@@ -596,15 +596,14 @@ namespace ...@@ -596,15 +596,14 @@ namespace
pdfi::PDFIRawAdaptor aAdaptor( impl_getComponentContext() ); pdfi::PDFIRawAdaptor aAdaptor( impl_getComponentContext() );
aAdaptor.setTreeVisitorFactory( createDrawTreeVisitorFactory() ); aAdaptor.setTreeVisitorFactory( createDrawTreeVisitorFactory() );
::rtl::OUString aURL, aAbsURL, aBaseURL; ::rtl::OUString tempFileURL;
osl_getFileURLFromSystemPath( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pdfi_unittest_draw.xml"))).pData, CPPUNIT_ASSERT( osl::File::createTempFile( NULL, NULL, &tempFileURL ) == osl::File::E_None );
&aURL.pData ); osl::File::remove( tempFileURL ); // FIXME the below apparently fails silently if the file already exists
osl_getProcessWorkingDir(&aBaseURL.pData);
osl_getAbsoluteFileURL(aBaseURL.pData,aURL.pData,&aAbsURL.pData);
CPPUNIT_ASSERT_MESSAGE("Exporting to ODF", CPPUNIT_ASSERT_MESSAGE("Exporting to ODF",
aAdaptor.odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), aAdaptor.odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"),
new OutputWrap(aAbsURL), new OutputWrap(tempFileURL),
NULL )); NULL ));
osl::File::remove( tempFileURL );
} }
void testOdfWriterExport() void testOdfWriterExport()
...@@ -612,15 +611,14 @@ namespace ...@@ -612,15 +611,14 @@ namespace
pdfi::PDFIRawAdaptor aAdaptor( impl_getComponentContext() ); pdfi::PDFIRawAdaptor aAdaptor( impl_getComponentContext() );
aAdaptor.setTreeVisitorFactory( createWriterTreeVisitorFactory() ); aAdaptor.setTreeVisitorFactory( createWriterTreeVisitorFactory() );
::rtl::OUString aURL, aAbsURL, aBaseURL; ::rtl::OUString tempFileURL;
osl_getFileURLFromSystemPath( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pdfi_unittest_writer.xml"))).pData, CPPUNIT_ASSERT( osl::File::createTempFile( NULL, NULL, &tempFileURL ) == osl::File::E_None );
&aURL.pData ); osl::File::remove( tempFileURL ); // FIXME the below apparently fails silently if the file already exists
osl_getProcessWorkingDir(&aBaseURL.pData);
osl_getAbsoluteFileURL(aBaseURL.pData,aURL.pData,&aAbsURL.pData);
CPPUNIT_ASSERT_MESSAGE("Exporting to ODF", CPPUNIT_ASSERT_MESSAGE("Exporting to ODF",
aAdaptor.odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), aAdaptor.odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"),
new OutputWrap(aAbsURL), new OutputWrap(tempFileURL),
NULL )); NULL ));
osl::File::remove( tempFileURL );
} }
CPPUNIT_TEST_SUITE(PDFITest); CPPUNIT_TEST_SUITE(PDFITest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment