summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-01-19 15:28:14 -0500
committerJustin Luth <jluth@mail.com>2023-01-20 20:22:13 +0000
commitc6cf80af60d23fc52502f88f24dc23ad85462e77 (patch)
tree82f3de2559c53e3eabd5811cd7f74742b4f083b9 /sw/qa
parentde1d75a0cd25f239cdc751dec75c9019fbcabd8e (diff)
related tdf#125038 FORMTEXT/REF:fix spurious text outside IF field
This builds on top of commit d09336fbdceaafd9320466b660a2b32a07dcc16a (tdf#125038 DOCX import: fix lost MERGEFIELD result inside an IF field, 2019-10-31), and extends it for FORMTEXT and REF. With this, all unexpected content is gone from the paragraph. Actually this is all somewhat irrelevant since DOCX doesn't import IF fields at all anyway - they are just left blank. So AFAICS, we should ALWAYS return false at this point. I also took the opportunity to be able to remove multiple spaces from the front of the command. Change-Id: Ib7e7971bce86bdda545166e398fbb620ca515b91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145832 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf125038_conditionalText3.docxbin0 -> 19938 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx10
2 files changed, 10 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf125038_conditionalText3.docx b/sw/qa/extras/ooxmlexport/data/tdf125038_conditionalText3.docx
new file mode 100644
index 000000000000..ec5698eeae1c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf125038_conditionalText3.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 11ddc54f1717..e0c471824193 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -829,6 +829,16 @@ CPPUNIT_TEST_FIXTURE(Test, testConditionalText2)
getParagraph(1, "test1");
}
+CPPUNIT_TEST_FIXTURE(Test, testConditionalText3)
+{
+ loadAndReload("tdf125038_conditionalText3.docx");
+ // It is unclear what the purpose of all the conditional IF statements is,
+ // but the end result should not produce any output.
+ // Previously, the fields were being displayed as text
+ // instead of as building blocks for the IF field condition.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getParagraph(1)->getString().indexOf('2'));
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf142464_ampm, "tdf142464_ampm.docx")
{
css::uno::Reference<css::text::XTextFieldsSupplier> xTextFieldsSupplier(