sw/qa/extras/rtfexport/rtfexport.cxx | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-)
New commits: commit a8ee791b189186332296e6d5462c93ef350dc01d Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Mar 2 21:09:06 2021 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Mar 3 09:08:53 2021 +0100 CppunitTest_sw_rtfexport: clean up empty hyperlink testcase If the doc needs modifications after loading and we only check the import-export-import result, then it's simpler and faster to use plain CPPUNIT_TEST_FIXTURE(). Change-Id: I25907d46bb79a954915e36fac27c20a3611c3de6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111849 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 737821f73286..049c78bd7f6b 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -66,16 +66,6 @@ public: return (OString(filename).endsWith(".rtf") && std::find(vDenylist.begin(), vDenylist.end(), filename) == vDenylist.end()); } - - virtual void postLoad(const char* pFilename) 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") @@ -1019,17 +1009,19 @@ DECLARE_RTFEXPORT_TEST(testTdf80708, "tdf80708.rtf") .getLength()); } -DECLARE_RTFEXPORT_TEST(testTdf90421, "tdf90421.fodt") +CPPUNIT_TEST_FIXTURE(Test, testHyperlinkWithoutURL) { - 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")); - } + load(mpTestDocumentPath, "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())); + reload(mpFilter, "gutter-left.rtf"); + 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")); } DECLARE_RTFEXPORT_TEST(testTdf92521, "tdf92521.odt") _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits