summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-04-15 14:55:56 +0200
committerJustin Luth <justin_luth@sil.org>2021-04-16 08:26:50 +0200
commitdeb892628a1501527c8c41b85a65282df95b81b1 (patch)
tree88a664b66b4d2cfeeec2113e8f4cb74af8a6e996 /sw/qa
parenta809b2ab2553e946431699d9d7ac3f6209cbdd6b (diff)
tdf#134951 docxexport: stop duplicating stuff in postponed text
Certain attributes like comments, fields, and footnotes should not be duplicated when a character run is split by the bPostponeWritingText hack. Only DOCX PostponesWritingText. The comment-with-range is still not perfect, but at least it is not fully duplicated. Best would be to just get rid of the hack? A few more items suggested themselves as belonging to this list, but I don't really know what they are, and no instances of them in this position were found in the existing unit tests. So I just left them as a commented possibility. Change-Id: I950c4250b5f7ed62d63eeff71cabaa10b67dca5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114148 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf134951_duplicates.odtbin0 -> 59225 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport16.cxx9
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx4
3 files changed, 13 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf134951_duplicates.odt b/sw/qa/extras/ooxmlexport/data/tdf134951_duplicates.odt
new file mode 100644
index 000000000000..53c7076b3eeb
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf134951_duplicates.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index c272a5878ff6..ee982194ff19 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -16,6 +16,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
#include <com/sun/star/text/XFootnotesSupplier.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
#include <com/sun/star/text/XTextTable.hpp>
@@ -146,6 +147,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_num
CPPUNIT_ASSERT_EQUAL(72.f, getProperty<float>(xStyle, "CharHeight"));
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134951_duplicates, "tdf134951_duplicates.odt")
+{
+ uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier(mxComponent, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xEndnotesSupplier->getEndnotes()->getCount());
+
+ getParagraph(5, "Duplicate fields: 1");
+}
+
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf135773_numberingShading, "tdf135774_numberingShading.docx")
{
// This test uses preTest to export CharBackground as Highlight instead of the 7.0 default of Shading.
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 404db9c59ef9..98ba668c7231 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -131,6 +131,10 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79008, "fdo79008.docx")
*/
parseExport("word/document.xml");
+ // tdf#134951: there is only one comment
+ xmlDocUniquePtr pXmlSettings = parseExport("word/comments.xml");
+ assertXPath(pXmlSettings, "/w:comments/w:comment", 1);
+
// Read-only is set, but it is not enforced, so it should be off...
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);