[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - oox/source sd/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 18 09:59:38 UTC 2021


 oox/source/export/drawingml.cxx     |    5 +++++
 sd/qa/unit/data/pptx/narration.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx  |   19 +++++++++++++++++++
 3 files changed, 24 insertions(+)

New commits:
commit 601bcc4fce550d758db8ba3d78c9c399e57f694a
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Jan 15 15:53:19 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Jan 18 10:59:03 2021 +0100

    PPTX export: fix mime type of slide narrations
    
    Import was working already for the audio stream.
    
    Change-Id: I43ac6561c4e39decfd99587e489cb2888805bb0c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109374
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109447

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 559b35b9023f..21394acc80da 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1314,6 +1314,11 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra
             aMimeType = "audio/x-wav";
             eMediaType = Relationship::AUDIO;
         }
+        else if (aExtension.equalsIgnoreAsciiCase(".m4a"))
+        {
+            aMimeType = "audio/mp4";
+            eMediaType = Relationship::AUDIO;
+        }
     }
 
     OUString aVideoFileRelId;
diff --git a/sd/qa/unit/data/pptx/narration.pptx b/sd/qa/unit/data/pptx/narration.pptx
new file mode 100644
index 000000000000..5226ce607215
Binary files /dev/null and b/sd/qa/unit/data/pptx/narration.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index b1d3eb57f8f2..0e938e05e9c7 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -101,6 +101,7 @@ public:
     void testTdf134969TransparencyOnColorGradient();
     void testTdf136911();
     void testArcTo();
+    void testNarrationMimeType();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
@@ -151,6 +152,7 @@ public:
     CPPUNIT_TEST(testTdf134969TransparencyOnColorGradient);
     CPPUNIT_TEST(testTdf136911);
     CPPUNIT_TEST(testArcTo);
+    CPPUNIT_TEST(testNarrationMimeType);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1292,6 +1294,23 @@ void SdOOXMLExportTest1::testArcTo()
     assertXPath(pXmlDoc, sPath, "swAng", "2700000");
 }
 
+void SdOOXMLExportTest1::testNarrationMimeType()
+{
+    sd::DrawDocShellRef xDocShRef
+        = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/narration.pptx"), PPTX);
+    utl::TempFile aTempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &aTempFile);
+    xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "[Content_Types].xml");
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: audio/mp4
+    // - Actual  : application/vnd.sun.star.media
+    // i.e. the mime type of the narration was incorrect.
+    assertXPath(pXmlDoc,
+                "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/media1.m4a']",
+                "ContentType", "audio/mp4");
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list