summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-17 13:20:13 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-17 13:22:57 +0200
commit461cb8fb430bfab2f67ae22d40852c3ca42841a2 (patch)
tree6292e00ca8a096242478f51550a453aecdaa6780 /sd
parenta4928075958fd911d751a74b3a06e6730b557272 (diff)
make the temp file names random in sd tests
All the temp files got the same names for the temp files which might conflict when two tests try to get teh same temp file at the same time. Additionally it makes the dbgutil check by Norbert for finding leaked temp files useless. Change-Id: I692107f7705787c360247785b8d95daf4199c2a6
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/HtmlExportTest.cxx2
-rw-r--r--sd/qa/unit/export-tests.cxx20
-rw-r--r--sd/qa/unit/import-tests.cxx54
-rw-r--r--sd/qa/unit/sdmodeltestbase.hxx21
4 files changed, 45 insertions, 52 deletions
diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx
index 81a62b4cca9a..7796666db833 100644
--- a/sd/qa/unit/HtmlExportTest.cxx
+++ b/sd/qa/unit/HtmlExportTest.cxx
@@ -32,7 +32,7 @@ public:
void testHTMLExport()
{
- sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/HtmlExportTestDocument.odp"));
+ sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/HtmlExportTestDocument.odp"), ODP);
htmlDocPtr htmlDoc = exportAndParseHtml(xDocShRef);
assertXPath(htmlDoc, "/html", 1);
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 44c5c9a5d113..3a939d75c228 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -82,7 +82,7 @@ public:
void SdFiltersTest::testN821567()
{
OUString bgImage;
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx"), PPTX );
xDocShRef = saveAndReload( xDocShRef, ODP );
uno::Reference< drawing::XDrawPagesSupplier > xDoc(
@@ -147,7 +147,7 @@ void checkFontAttributes(const SdrTextObj* pObj, sal_uInt32 nColor,
void SdFiltersTest::testBnc870233_1()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
@@ -176,7 +176,7 @@ void SdFiltersTest::testBnc870233_1()
void SdFiltersTest::testBnc870233_2()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
@@ -213,7 +213,7 @@ void SdFiltersTest::testBnc870233_2()
void SdFiltersTest::testN828390_4()
{
bool bPassed = false;
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP );
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -251,7 +251,7 @@ void SdFiltersTest::testN828390_4()
void SdFiltersTest::testN828390_5()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_5.odp") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP );
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -274,7 +274,7 @@ void SdFiltersTest::testN828390_5()
void SdFiltersTest::testMediaEmbedding()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/media_embedding.odp"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/media_embedding.odp"), ODP);
#if HAVE_FEATURE_GLTF
xDocShRef = saveAndReload( xDocShRef, ODP );
@@ -309,7 +309,7 @@ void SdFiltersTest::testMediaEmbedding()
void SdFiltersTest::testFdo71961()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP);
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -341,7 +341,7 @@ void SdFiltersTest::testFdo71961()
void SdFiltersTest::testN828390()
{
bool bPassed = false;
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX );
xDocShRef = saveAndReload( xDocShRef, PPTX );
@@ -377,7 +377,7 @@ void SdFiltersTest::testN828390()
void SdFiltersTest::testBnc880763()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
@@ -401,7 +401,7 @@ void SdFiltersTest::testBnc880763()
void SdFiltersTest::testBnc862510_5()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index e8e148f85a0d..6567f3d8e026 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -126,25 +126,25 @@ the test, and re-running; it should break.
*/
void SdFiltersTest::testDocumentLayout()
{
- struct { const char *pInput, *pDump; sal_Int32 nExportType; } aFilesToCompare[] =
+ struct { const char *pInput, *pDump; sal_Int32 nFormat; sal_Int32 nExportType; } aFilesToCompare[] =
{
- { "odp/shapes-test.odp", "xml/shapes-test_page", -1 },
- { "fdo47434.pptx", "xml/fdo47434_", -1 },
- { "n758621.ppt", "xml/n758621_", -1 },
- { "fdo64586.ppt", "xml/fdo64586_", -1 },
- { "n819614.pptx", "xml/n819614_", -1 },
- { "n820786.pptx", "xml/n820786_", -1 },
- { "n762695.pptx", "xml/n762695_", -1 },
- { "n593612.pptx", "xml/n593612_", -1 },
- { "fdo71434.pptx", "xml/fdo71434_", -1 },
- // { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX }, // Example
+ { "odp/shapes-test.odp", "xml/shapes-test_page", ODP, -1 },
+ { "fdo47434.pptx", "xml/fdo47434_", PPTX, -1 },
+ { "n758621.ppt", "xml/n758621_", PPT, -1 },
+ { "fdo64586.ppt", "xml/fdo64586_", PPT, -1 },
+ { "n819614.pptx", "xml/n819614_", PPTX, -1 },
+ { "n820786.pptx", "xml/n820786_", PPTX, -1 },
+ { "n762695.pptx", "xml/n762695_", PPTX, -1 },
+ { "n593612.pptx", "xml/n593612_", PPTX, -1 },
+ { "fdo71434.pptx", "xml/fdo71434_", PPTX, -1 },
+ // { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX, PPTX }, // Example
};
for ( int i = 0; i < static_cast< int >( SAL_N_ELEMENTS( aFilesToCompare ) ); ++i )
{
int nUpdateMe = -1; // index of test we want to update; supposedly only when the test is created
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pInput ) );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pInput ), aFilesToCompare[i].nFormat );
if( aFilesToCompare[i].nExportType >= 0 )
xDocShRef = saveAndReload( xDocShRef, aFilesToCompare[i].nExportType );
compareWithShapesDump( xDocShRef,
@@ -155,7 +155,7 @@ void SdFiltersTest::testDocumentLayout()
void SdFiltersTest::testSmoketest()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/smoketest.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/smoketest.pptx"), PPTX);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -183,7 +183,7 @@ void SdFiltersTest::testSmoketest()
void SdFiltersTest::testN759180()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/n759180.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/n759180.pptx"), PPTX);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -221,7 +221,7 @@ void SdFiltersTest::testN759180()
void SdFiltersTest::testN862510_1()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_1.pptx") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_1.pptx"), PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -246,7 +246,7 @@ void SdFiltersTest::testN862510_1()
void SdFiltersTest::testN862510_2()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_2.pptx") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_2.pptx"), PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -265,7 +265,7 @@ void SdFiltersTest::testN862510_2()
void SdFiltersTest::testN862510_4()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_4.pptx") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_4.pptx"), PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -290,7 +290,7 @@ void SdFiltersTest::testN862510_4()
void SdFiltersTest::testN828390_2()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_2.pptx") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_2.pptx"), PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -310,7 +310,7 @@ void SdFiltersTest::testN828390_2()
void SdFiltersTest::testN828390_3()
{
bool bPassed = true;
- ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx") );
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx"), PPTX );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -342,7 +342,7 @@ void SdFiltersTest::testN828390_3()
void SdFiltersTest::testN778859()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"), PPTX);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -361,7 +361,7 @@ void SdFiltersTest::testN778859()
void SdFiltersTest::testFdo68594()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/ppt/fdo68594.ppt"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/ppt/fdo68594.ppt"), PPT);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -380,7 +380,7 @@ void SdFiltersTest::testFdo68594()
void SdFiltersTest::testFdo72998()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/cshapes.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/cshapes.pptx"), PPTX);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -410,7 +410,7 @@ std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
void SdFiltersTest::testFdo77027()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/fdo77027.odp"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/fdo77027.odp"), ODP);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -434,7 +434,7 @@ void SdFiltersTest::testFdo77027()
void SdFiltersTest::testFdo64512()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"), ODP);
uno::Reference< drawing::XDrawPagesSupplier > xDoc(
xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
@@ -479,7 +479,7 @@ void SdFiltersTest::testFdo71075()
{
double values[] = { 12.0, 13.0, 14.0 };
::com::sun::star::uno::Any aAny;
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71075.odp"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71075.odp"), ODP);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -521,7 +521,7 @@ void SdFiltersTest::testFdo71075()
void SdFiltersTest::testStrictOOXML()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/strict_ooxml.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/strict_ooxml.pptx"), PPTX);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -535,7 +535,7 @@ void SdFiltersTest::testStrictOOXML()
void SdFiltersTest::testBnc870237()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870237.pptx"));
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870237.pptx"), PPTX);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 64f5a6b20cdd..c78c980eac44 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -88,24 +88,17 @@ public:
protected:
/// Load the document.
- sd::DrawDocShellRef loadURL( const OUString &rURL )
+ sd::DrawDocShellRef loadURL( const OUString &rURL, sal_Int32 nFormat )
{
- FileFormat *pFmt(0);
-
- for (size_t i = 0; i < SAL_N_ELEMENTS (aFileFormats); i++)
- {
- pFmt = aFileFormats + i;
- if (pFmt->pName && rURL.endsWithIgnoreAsciiCaseAsciiL (pFmt->pName, strlen (pFmt->pName)))
- break;
- }
+ FileFormat *pFmt = getFormat(nFormat);
CPPUNIT_ASSERT_MESSAGE( "missing filter info", pFmt->pName != NULL );
- sal_uInt32 nFormat = 0;
+ sal_uInt32 nOptions = 0;
if (pFmt->nFormatType)
- nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
+ nOptions = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
SfxFilter* aFilter = new SfxFilter(
OUString::createFromAscii( pFmt->pFilterName ),
- OUString(), pFmt->nFormatType, nFormat,
+ OUString(), pFmt->nFormatType, nOptions,
OUString::createFromAscii( pFmt->pTypeName ),
0, OUString(),
OUString::createFromAscii( pFmt->pUserData ),
@@ -176,7 +169,7 @@ protected:
{
FileFormat* pFormat = getFormat(nExportType);
OUString aExt = OUString( "." ) + OUString::createFromAscii(pFormat->pName);
- utl::TempFile aTempFile(OUString(), true, &aExt);
+ utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
save(pShell, pFormat, aTempFile);
if(nExportType == ODP)
@@ -187,7 +180,7 @@ protected:
{
BootstrapFixture::validate(aTempFile.GetFileName(), test::OOXML);
}
- return loadURL(aTempFile.GetURL());
+ return loadURL(aTempFile.GetURL(), nExportType);
}
/** Dump shapes in xDocShRef, and compare the dump against content of pShapesDumpFileNameBase<number>.xml.