diff options
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf90421.fodt | 8 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 23 |
3 files changed, 37 insertions, 0 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 7528ced17835..f0d3428ef984 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -240,6 +240,7 @@ protected: header(); preTest(filename); load(mpTestDocumentPath, filename); + postLoad(filename); reload(mpFilter, filename); postTest(filename); verify(); @@ -289,6 +290,11 @@ protected: { } + /// Override this function if some special file-specific setup is needed during export test: after load, but before save. + virtual void postLoad(const char* /*pFilename*/) + { + } + /** * Override this function if some special filename-specific teardown is needed */ diff --git a/sw/qa/extras/rtfexport/data/tdf90421.fodt b/sw/qa/extras/rtfexport/data/tdf90421.fodt new file mode 100644 index 000000000000..a0da4b8274d8 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf90421.fodt @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:body> + <office:text> + <text:p text:style-name="P1">A <text:a xlink:type="simple" xlink:href="http://s/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">http://s/</text:a> B</text:p> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 20f2a7d4c9e4..33d6ca41f6d2 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -78,6 +78,16 @@ public: return false; } + + virtual void postLoad(const char* pFilename) SAL_OVERRIDE + { + if (OString(pFilename) == "tdf90421.fodt") + { + // Change the hyperlink, so its URL is empty. + uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY); + xRun->setPropertyValue("HyperLinkURL", uno::makeAny(OUString())); + } + } }; DECLARE_RTFEXPORT_TEST(testZoom, "zoom.rtf") @@ -889,6 +899,19 @@ DECLARE_RTFEXPORT_TEST(testTdf80708, "tdf80708.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); } +DECLARE_RTFEXPORT_TEST(testTdf90421, "tdf90421.fodt") +{ + if (mbExported) + { + SvMemoryStream aMemoryStream; + SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ); + aStream.ReadStream(aMemoryStream); + OString aData(static_cast<const char*>(aMemoryStream.GetData()), aMemoryStream.GetSize()); + // This was some positive number, i.e. we exported a hyperlink with an empty URL. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), aData.indexOf("HYPERLINK")); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |