summaryrefslogtreecommitdiff
path: root/sw/qa/extras/htmlexport
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2018-11-15 14:05:38 +0100
committerMiklos Vajna <vmiklos@collabora.com>2018-11-15 19:29:46 +0100
commite807d6158e5bb030e2f884571493f65b285875f8 (patch)
tree93f59e713023bf662dfb4b0caa267743722ecccb /sw/qa/extras/htmlexport
parent39aa91cfb4620a650ceba01076a1c0aa2fbfdadf (diff)
sw reqif-xhtml export: write graphic of OLE object at an RTF level as well
An embedded object have have its replacement graphic at 3 levels in reqif-xhtml: PNG at HTML level, WMF at RTF level and as a stream in the OLE2 storage. Some reqif readers depend on having the replacement graphic at an RTF level, so write that variant, too. Change-Id: I3391303248d2792a4c370e8fc84db0f22185312e Reviewed-on: https://gerrit.libreoffice.org/63419 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras/htmlexport')
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 81d851a7f831..5ae05a172078 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -23,6 +23,8 @@
#include <usrpref.hxx>
#include <test/htmltesttools.hxx>
+#include <tools/urlobj.hxx>
+#include <svtools/rtfkeywd.hxx>
class HtmlExportTest : public SwModelTestBase, public HtmlTestTools
{
@@ -564,6 +566,32 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2, "reqif-ole2.xhtml")
// Finally the export also failed as it tried to open the stream from the
// document storage, but the embedded object already opened it, so an
// exception of type com.sun.star.io.IOException was thrown.
+
+ if (mbExported)
+ {
+ // Check that the replacement graphic is exported at RTF level.
+ SvMemoryStream aStream;
+ wrapFragment(aStream);
+ xmlDocPtr pDoc = parseXmlStream(&aStream);
+ CPPUNIT_ASSERT(pDoc);
+ // Get the path of the RTF data.
+ OUString aOlePath = getXPath(
+ pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data");
+ OUString aOleSuffix(".ole");
+ CPPUNIT_ASSERT(aOlePath.endsWith(aOleSuffix));
+ INetURLObject aUrl(maTempFile.GetURL());
+ aUrl.setBase(aOlePath.copy(0, aOlePath.getLength() - aOleSuffix.getLength()));
+ aUrl.setExtension("ole");
+ OUString aOleUrl = aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+
+ // Search for \result in the RTF data.
+ SvFileStream aOleStream(aOleUrl, StreamMode::READ);
+ CPPUNIT_ASSERT(aOleStream.IsOpen());
+ OString aOleString(read_uInt8s_ToOString(aOleStream, aOleStream.TellEnd()));
+ // Without the accompanying fix in place, this test would have failed,
+ // replacement graphic was missing at RTF level.
+ CPPUNIT_ASSERT(aOleString.indexOf(OOO_STRING_SVTOOLS_RTF_RESULT) != -1);
+ }
}
DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2Odg, "reqif-ole-odg.xhtml")