diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-08-04 21:57:39 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-08-05 09:00:45 +0200 |
commit | e12d4c7e361f449fcf143a61caed92129aca3468 (patch) | |
tree | c3f56e29552a6306f610a144cdebdbc5deb8ec54 /sw/qa | |
parent | 13377fd2e1d6e00597bb23a480ed9ad0aa9a563c (diff) |
tdf#123643 Import/Export for hyperlinks on text boxes
Change-Id: Ied436c4a619985f27e5854369d319d76c05890d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120028
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/docxopenhyperlinkbox.docx | bin | 0 -> 18197 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 22 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/docxopenhyperlinkbox.docx b/sw/qa/extras/ooxmlexport/data/docxopenhyperlinkbox.docx Binary files differnew file mode 100644 index 000000000000..2653e620202a --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/docxopenhyperlinkbox.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 37ed272b65b5..61f6b0be7176 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -447,6 +447,28 @@ DECLARE_OOXMLEXPORT_TEST(testShapeHyperlink, "hyperlinkshape.docx") CPPUNIT_ASSERT_EQUAL(OUString("https://libreoffice.org/"), getProperty<OUString>(xShape, "Hyperlink")); } +CPPUNIT_TEST_FIXTURE(Test, testTextframeHyperlink) +{ + // Make sure hyperlink is imported correctly + load(mpTestDocumentPath, "docxopenhyperlinkbox.docx"); + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("https://libreoffice.org/"), getProperty<OUString>(xFrame, "HyperLinkURL")); + + // FIXME: After save&reload, the text frame should still be a text frame, and the above test should still work. + // (Currently the Writer text frame becomes a text box (shape based)). See tdf#140961 + reload(mpFilter, "docxopenhyperlinkbox.docx"); + + xmlDocUniquePtr pXmlDoc = parseExport(); + // DML + assertXPath(pXmlDoc, "//w:drawing/wp:anchor/wp:docPr/a:hlinkClick", 1); + // VML + assertXPath(pXmlDoc, "//w:pict/v:rect", "href", "https://libreoffice.org/"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf139580, "tdf139580.odt") { // Without the fix in place, this test would have crashed at export time |