summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@collabora.com>2013-11-13 17:34:47 +0530
committerMuthu Subramanian <sumuthu@collabora.com>2013-11-13 20:58:30 +0530
commit9694f8bc26fec366d518ce913a1a48b69fadf26c (patch)
tree398f9089e111e05012b64ebdcc401251ec818898 /sd
parent0fe680b266f272fb82edc357fd036be85d4124cd (diff)
Adding unit test case helper for export and reload.
[Similar to the one in the sc module]
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/sdmodeltestbase.hxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 945fdee0a447..6c05ffafc623 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -18,6 +18,7 @@
#include "drawdoc.hxx"
#include "../source/ui/inc/DrawDocShell.hxx"
+#include "unotools/tempfile.hxx"
#include <rtl/strbuf.hxx>
#include <sfx2/docfile.hxx>
@@ -52,6 +53,10 @@ FileFormat aFileFormats[] = {
{ 0, 0, 0, 0, 0 }
};
+#define ODP 0
+#define PPT 1
+#define PPTX 2
+
/// Base class for filter tests loading or roundtriping a document, and asserting the document model.
class SdModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest
{
@@ -115,6 +120,33 @@ protected:
return xDocShRef;
}
+ ::sd::DrawDocShellRef saveAndReload( ::sd::DrawDocShell *pShell, sal_uLong nExportType )
+ {
+ FileFormat *pFmt = &aFileFormats[0];
+ if( nExportType < SAL_N_ELEMENTS( aFileFormats ) )
+ pFmt = &aFileFormats[ nExportType ];
+ OUString aExt = OUString( "." ) + OUString::createFromAscii( pFmt->pName );
+ utl::TempFile aTempFile( OUString(), &aExt );
+ aTempFile.EnableKillingFile();
+ SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE );
+ sal_uInt32 nExportFormat = 0;
+ if( pFmt->nFormatType == ODP_FORMAT_TYPE )
+ nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS;
+ SfxFilter* pExportFilter = new SfxFilter(
+ OUString::createFromAscii( pFmt->pFilterName ),
+ OUString(), pFmt->nFormatType, nExportFormat,
+ OUString::createFromAscii( pFmt->pTypeName ),
+ 0, OUString(),
+ OUString::createFromAscii( pFmt->pUserData ),
+ OUString("private:factory/simpress*") );
+ pExportFilter->SetVersion( SOFFICE_FILEFORMAT_CURRENT );
+ aStoreMedium.SetFilter( pExportFilter );
+ pShell->DoSaveAs( aStoreMedium );
+ pShell->DoClose();
+
+ return loadURL( aTempFile.GetURL() );
+ }
+
/** Dump shapes in xDocShRef, and compare the dump against content of pShapesDumpFileNameBase<number>.xml.
@param bCreate Instead of comparing to the reference file(s), create it/them.