diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2022-03-09 17:00:02 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-03-22 10:30:09 +0100 |
commit | 6504665fb9a8e3ab3d3b00c8767981d095b05e5d (patch) | |
tree | e389d4fc9fb2cfaee1005b9406b0b7785115e5fd /sw/qa | |
parent | 96fd2bd5819d67de73022ae005ff04bee1e7056f (diff) |
tdf#144563: remove final dot in cross-references to paragraph
It looks like in cross-references ending with dot (".") one last
dot is removed in case of MS Word. This is not a true for any other
suffixes after numeration.
Change-Id: I554e62cf45e643bf27823df5344e1689b5b6ae54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131254
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131542
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf144563.docx | bin | 0 -> 17488 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 29 | ||||
-rw-r--r-- | sw/qa/python/check_cross_references.py | 10 |
4 files changed, 35 insertions, 6 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index f06778fc25b4..87e2aead4997 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -2794,7 +2794,7 @@ DECLARE_ODFEXPORT_TEST(testReferenceLanguage, "referencelanguage.odt") OUString const aFieldTexts[] = { "A 2", "Az Isten", "Az 50-esek", "A 2018-asok", "Az egyebek", "A fejezetek", u"Az „Őseinket...”", "a 2", - "Az v.", "az 1", "Az e)", "az 1", + "Az v", "az 1", "Az e)", "az 1", "Az (5)", "az 1", "A 2", "az 1" }; uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); // update "A (4)" to "Az (5)" diff --git a/sw/qa/extras/ooxmlexport/data/tdf144563.docx b/sw/qa/extras/ooxmlexport/data/tdf144563.docx Binary files differnew file mode 100644 index 000000000000..59d64d2d1bf3 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf144563.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index ec07a5a946f0..52465ed66d90 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -12,6 +12,9 @@ #include <string_view> #include <com/sun/star/text/XBookmarksSupplier.hpp> +#include <com/sun/star/text/XTextFieldsSupplier.hpp> +#include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/util/XRefreshable.hpp> #include <comphelper/configuration.hxx> #include <comphelper/scopeguard.hxx> @@ -170,6 +173,32 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81507, "tdf81507.docx") xmlXPathFreeObject(pXmlObj); } +DECLARE_OOXMLEXPORT_TEST(testTdf144563, "tdf144563.docx") +{ + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + + // Refresh all cross-reference fields + uno::Reference<util::XRefreshable>(xFieldsAccess, uno::UNO_QUERY_THROW)->refresh(); + + // Verify values + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + + std::vector<OUString> aExpectedValues = { + // These field values are NOT in order in document: getTextFields did provide + // fields in a strange but fixed order + "1", "1", "1", "1", "1/", "1/", "1/", "1)", "1)", "1)", "1.)", + "1.)", "1.)", "1..", "1..", "1..", "1.", "1.", "1.", "1", "1" + }; + + sal_uInt16 nIndex = 0; + while (xFields->hasMoreElements()) + { + uno::Reference<text::XTextField> xTextField(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(aExpectedValues[nIndex++], xTextField->getPresentation(false)); + } +} + DECLARE_OOXMLEXPORT_TEST(testTdf144668, "tdf144668.odt") { uno::Reference<beans::XPropertySet> xPara1(getParagraph(1, u"level1"), uno::UNO_QUERY); diff --git a/sw/qa/python/check_cross_references.py b/sw/qa/python/check_cross_references.py index 3c9319200ea7..7778ff5f2100 100644 --- a/sw/qa/python/check_cross_references.py +++ b/sw/qa/python/check_cross_references.py @@ -89,16 +89,16 @@ class CheckCrossReferences(unittest.TestCase): FieldResult1 = "*i*" FieldResult2 = "+b+*i*" FieldResult3 = "-1-+b+*i*" - FieldResult4 = "1." - FieldResult5 = "1." - FieldResult6 = "A.1." + FieldResult4 = "1" + FieldResult5 = "1" + FieldResult6 = "A.1" FieldResult7 = " 2.(a)" FieldResult8 = " 2.(b)" - FieldResult9 = " 2." + FieldResult9 = " 2" FieldResult10 = " 1.(a)" FieldResult11 = "(b)" FieldResult12 = "(a)" - FieldResult13 = " 1." + FieldResult13 = " 1" # variables for current field xField = self.getNextField() |