[Libreoffice-commits] core.git: Branch 'distro/vector/vector-5.4' - sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 19 08:04:04 UTC 2018


 sw/qa/extras/htmlexport/data/transparent-image.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx             |   20 ++++++++++++++++++++
 sw/qa/extras/inc/swmodeltestbase.hxx               |    2 ++
 sw/source/filter/html/htmlflywriter.cxx            |    1 +
 4 files changed, 23 insertions(+)

New commits:
commit ad3aecb63c0ca66a4e67bbe2a9b2b46b9753f775
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Wed Jul 18 14:00:29 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Thu Jul 19 09:44:19 2018 +0200

    sw HTML export: force PNG output harder in reqif mode
    
    Need to disable one more flag to avoid GIF for transparent images.
    
    Also start asserting reqif-xhtml output with an XML parser.
    
    Reviewed-on: https://gerrit.libreoffice.org/57630
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins
    (cherry picked from commit 1a884ea69b2c8b98719fa3cd298b42a6d584cd41)
    
    Conflicts:
            sw/qa/extras/htmlexport/htmlexport.cxx
    
    Change-Id: I1395812a5ddfd56cee4acacf6dea46c6e413b736

diff --git a/sw/qa/extras/htmlexport/data/transparent-image.odt b/sw/qa/extras/htmlexport/data/transparent-image.odt
new file mode 100644
index 000000000000..0c5fb8de0790
Binary files /dev/null and b/sw/qa/extras/htmlexport/data/transparent-image.odt differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index ce773347d25c..9f2accc8482f 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -589,6 +589,26 @@ DECLARE_HTMLEXPORT_TEST(testList, "list.html")
     CPPUNIT_ASSERT(aStream.indexOf("<li>") != -1);
 }
 
+DECLARE_HTMLEXPORT_TEST(testTransparentImageReqIf, "transparent-image.odt")
+{
+    SvMemoryStream aStream;
+    aStream.WriteCharPtr("<reqif-xhtml:html xmlns:reqif-xhtml=\"http://www.w3.org/1999/xhtml\">\n");
+    SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
+    aStream.WriteStream(aFileStream);
+    aStream.WriteCharPtr("</reqif-xhtml:html>\n");
+    aStream.Seek(0);
+    xmlDocPtr pDoc = parseXmlStream(&aStream);
+    CPPUNIT_ASSERT(pDoc);
+
+    OUString aSource = getXPath(
+        pDoc,
+        "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:object",
+        "data");
+    OUString aMessage = "src attribute is: " + aSource;
+    // This was GIF, when the intention was to force PNG.
+    CPPUNIT_ASSERT_MESSAGE(aMessage.toUtf8().getStr(), aSource.endsWith(".png"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 6757f6d8b961..ff77cff14cf5 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -880,6 +880,8 @@ protected:
         xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("field"), BAD_CAST("urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"));
         xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("formx"), BAD_CAST("urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"));
         xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("css3t"), BAD_CAST("http://www.w3.org/TR/css3-text/"));
+        // reqif-xhtml
+        xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("reqif-xhtml"), BAD_CAST("http://www.w3.org/1999/xhtml"));
     }
 };
 
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 96492d1b75ab..6725f12cd809 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1837,6 +1837,7 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF
                 // output.
                 aFilterName = "PNG";
                 nFlags &= ~XOutFlags::UseNativeIfPossible;
+                nFlags &= ~XOutFlags::UseGifIfSensible;
                 aMimeType = "image/png";
             }
 


More information about the Libreoffice-commits mailing list