[Libreoffice-commits] core.git: sd/qa

Jan Holesovsky kendy at collabora.com
Fri Jul 21 17:50:46 UTC 2017


 sd/qa/unit/data/pptm/macro.pptm    |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   32 ++++++++++++++++++++++++++++++++
 sd/qa/unit/sdmodeltestbase.hxx     |    9 ++++++---
 3 files changed, 38 insertions(+), 3 deletions(-)

New commits:
commit 71ab0b8b8368b5010d3af4100d5ea3ca38b725a5
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jul 21 11:45:36 2017 +0200

    sd pptm: Unit tests for the .pptm support.
    
    Change-Id: Ie0d05e70fe2b0869470a1750d5b60566f129247b
    Reviewed-on: https://gerrit.libreoffice.org/40268
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sd/qa/unit/data/pptm/macro.pptm b/sd/qa/unit/data/pptm/macro.pptm
new file mode 100755
index 000000000000..54e81db2a07b
Binary files /dev/null and b/sd/qa/unit/data/pptm/macro.pptm differ
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


More information about the Libreoffice-commits mailing list