diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2022-04-29 11:10:48 +0300 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2022-05-12 03:27:45 +0200 |
commit | d45315c8eb91862958b29ead09cec58e03a80096 (patch) | |
tree | 4eb3c50bf8aad1efec5ff1227c4e3a35cc15a7e0 /sw/qa/extras/ww8export/ww8export3.cxx | |
parent | fe687d1b8f5305edfb167152a4fb19ffa20c5404 (diff) |
tdf#142840: doc export: use BookmarkToWord() for hyperlinks
Inernal hyperlinks to bookmarks should not contain spaces. This
is not required for RTF or DOC: MS Word is okay with spaces there
(unlike in DOCX). But since we are replacing spaces in bookmark
names we should do this also in links to these bookmarks.
Change-Id: I7a3e530817572ed53032c2be1ad96f8e8498bac3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133590
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'sw/qa/extras/ww8export/ww8export3.cxx')
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 4e6cfd65924a..067d3486ec00 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -1082,6 +1082,23 @@ CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) verify(); } +DECLARE_WW8EXPORT_TEST(testTdf142840, "tdf142840.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks(); + + // Ensure space are replaced by underscore in bookmark name (it was working before, but ensure this) + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xBookmarksByIdx->getCount()); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Chapter_1")); + CPPUNIT_ASSERT(!xBookmarksByName->hasByName("Chapter 1")); + + // And hyperlink is referring bookmark with underscore also (this was broken) + CPPUNIT_ASSERT_EQUAL(OUString("#Chapter_1"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |