diff options
author | Vasily Melenchuk <Vasily.Melenchuk@cib.de> | 2017-09-05 21:30:06 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-09-07 15:03:08 +0200 |
commit | aa3c0ddc61726f9e2e927e08966acd63a3fcf968 (patch) | |
tree | 23b2da173dd7ff3d9a407345e120d83ffa957960 /sw/qa | |
parent | e55ee82f519064319dddcd3dc4553c6580dcd93a (diff) |
tdf#103090 replace spaces by underscore in bookmark names for DOCX.
Bookmarks containing spaces are incorrectly interpreted by MS Word,
so spaces are replaced in bookmark names and bookmark references
in fields.
Change-Id: I4e23c6b8740b54e94a1ec7e3385cffbe3ba01709
Reviewed-on: https://gerrit.libreoffice.org/41954
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf103090.odt | bin | 0 -> 8845 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 22 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf103090.odt b/sw/qa/extras/ooxmlexport/data/tdf103090.odt Binary files differnew file mode 100644 index 000000000000..d264f255abb7 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf103090.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 930cbdc41b4f..5f45cbcc7109 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -1049,6 +1049,28 @@ DECLARE_OOXMLEXPORT_TEST(tdf112169, "tdf112169.odt") // LO crashed while export because of character background color handling } +DECLARE_OOXMLEXPORT_TEST(testTdf103090, "tdf103090.odt") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + // Get bookmark name + OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p/w:bookmarkStart", "name"); + + // Ensure that name has no spaces + CPPUNIT_ASSERT(bookmarkName.indexOf(" ") < 0); + + // Get PAGEREF field + OUString fieldName = getXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:instrText"); + + // Ensure that PAGEREF field refers exactly our bookmark + OUString expectedFieldName(" PAGEREF "); + expectedFieldName += bookmarkName; + expectedFieldName += " \\h "; + CPPUNIT_ASSERT_EQUAL(expectedFieldName, fieldName); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |