diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-07-21 11:45:36 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-07-21 19:49:51 +0200 |
commit | 71ab0b8b8368b5010d3af4100d5ea3ca38b725a5 (patch) | |
tree | 3fb3d5f7caf3f5e31bde312bdc01c90016ddab5b /sd/qa | |
parent | ee6f8f1982d666f8fcda96d2141a9332a10b8273 (diff) |
sd pptm: Unit tests for the .pptm support.
Change-Id: Ie0d05e70fe2b0869470a1750d5b60566f129247b
Reviewed-on: https://gerrit.libreoffice.org/40268
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd/qa')
-rwxr-xr-x | sd/qa/unit/data/pptm/macro.pptm | bin | 0 -> 35129 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 32 | ||||
-rw-r--r-- | sd/qa/unit/sdmodeltestbase.hxx | 9 |
3 files changed, 38 insertions, 3 deletions
diff --git a/sd/qa/unit/data/pptm/macro.pptm b/sd/qa/unit/data/pptm/macro.pptm Binary files differnew file mode 100755 index 000000000000..54e81db2a07b --- /dev/null +++ b/sd/qa/unit/data/pptm/macro.pptm diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index f310309d0bf2..848ea8f5d1a4 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -98,6 +98,8 @@ public: void testTdf59046(); void testTdf105739(); void testPageBitmapWithTransparency(); + void testPptmContentType(); + void testPptmVBAStream(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -123,6 +125,8 @@ public: CPPUNIT_TEST(testTdf59046); CPPUNIT_TEST(testTdf105739); CPPUNIT_TEST(testPageBitmapWithTransparency); + CPPUNIT_TEST(testPptmContentType); + CPPUNIT_TEST(testPptmVBAStream); CPPUNIT_TEST_SUITE_END(); @@ -804,6 +808,34 @@ void SdOOXMLExportTest2::testPageBitmapWithTransparency() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testPptmContentType() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptm/macro.pptm"), PPTM); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTM, &tempFile); + + // Assert that the content type is the one of PPTM + xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); + assertXPath(pXmlContentType, + "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']", + "ContentType", + "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml"); + + xDocShRef->DoClose(); +} + +void SdOOXMLExportTest2::testPptmVBAStream() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptm/macro.pptm"), PPTM); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTM, &tempFile); + + uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), tempFile.GetURL()); + // This failed: VBA stream was not roundtripped + CPPUNIT_ASSERT(xNameAccess->hasByName("ppt/vbaProject.bin")); + + xDocShRef->DoClose(); +} CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index 80f6693f568c..51cb204f76b4 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -58,6 +58,7 @@ struct FileFormat #define FODG_FORMAT_TYPE (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT) #define FODP_FORMAT_TYPE (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT) #define SXI_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::TEMPLATE | SfxFilterFlags::OWN | SfxFilterFlags::ALIEN | SfxFilterFlags::PREFERED | SfxFilterFlags::ENCRYPTION) +#define PPTM_FORMAT_TYPE ( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::STARONEFILTER | SfxFilterFlags::PREFERED ) /** List of file formats we support in Impress unit tests. @@ -74,10 +75,11 @@ FileFormat aFileFormats[] = { "pptx", "Impress Office Open XML", "Office Open XML Presentation", "", PPTX_FORMAT_TYPE }, { "html", "graphic_HTML", "graphic_HTML", "", HTML_FORMAT_TYPE }, { "pdf", "draw_pdf_import", "pdf_Portable_Document_Format", "", PDF_FORMAT_TYPE }, - { "fodg", "OpenDocument Drawing Flat XML", "Flat XML ODF Drawing", "", FODG_FORMAT_TYPE }, - { "fodp", "OpenDocument Presentation Flat XML", "Flat XML ODF Presentation", "", FODP_FORMAT_TYPE }, + { "fodg", "OpenDocument Drawing Flat XML", "Flat XML ODF Drawing", "", FODG_FORMAT_TYPE }, + { "fodp", "OpenDocument Presentation Flat XML", "Flat XML ODF Presentation", "", FODP_FORMAT_TYPE }, { "sxi", "StarOffice XML (Impress)", "OpenOffice.org 1.0 Presentation", "", SXI_FORMAT_TYPE }, { "odg", "draw8", "draw8", "", ODP_FORMAT_TYPE }, + { "pptm", "Impress MS PowerPoint 2007 XML VBA", "MS PowerPoint 2007 XML VBA", "", PPTM_FORMAT_TYPE }, { nullptr, nullptr, nullptr, nullptr, SfxFilterFlags::NONE } }; @@ -88,8 +90,9 @@ FileFormat aFileFormats[] = #define PDF 4 #define FODG 5 #define FODP 6 -#define SXI 7 +#define SXI 7 #define ODG 8 +#define PPTM 9 /// Base class for filter tests loading or roundtriping a document, and asserting the document model. class SdModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest |