diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-10-31 10:40:41 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-10-31 12:35:56 +0100 |
commit | d09336fbdceaafd9320466b660a2b32a07dcc16a (patch) | |
tree | 2c5ef78ca58314fe249223aafd9b0b752f585721 /sw | |
parent | 25c608dc3508843845f117e526c0788e92e44214 (diff) |
tdf#125038 DOCX import: fix lost MERGEFIELD result inside an IF field
The problem here was that the IF field result didn't have a plain text
string, rather it had a MERGEFIELD in it. Writer's conditional text
field expects a plain text string, so just use the result of the
MERGEFIELD for an IF parent. Do this in a generic way, it's likely that
other parent-child field combinations want to do the same in the future.
With this, all lost strings are fixed from the original bugdoc + all
unexpected content is hidden in Writer as well.
Change-Id: Ic5c03b1df2f08a2cd851647b625e0c303cc5d6c5
Reviewed-on: https://gerrit.libreoffice.org/81825
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf125038c.docx | bin | 0 -> 12677 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 10 |
2 files changed, 10 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf125038c.docx b/sw/qa/extras/ooxmlexport/data/tdf125038c.docx Binary files differnew file mode 100644 index 000000000000..10234b864627 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf125038c.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 82237bffa368..2c2d94821acf 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -66,6 +66,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038b, "tdf125038b.docx") CPPUNIT_ASSERT(!xParagraphs->hasMoreElements()); } +DECLARE_OOXMLIMPORT_TEST(testTdf125038c, "tdf125038c.docx") +{ + OUString aActual = getParagraph(1)->getString(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: email: test@test.test + // - Actual : email: + // I.e. the result of the MERGEFIELD field inside an IF field was lost. + CPPUNIT_ASSERT_EQUAL(OUString("email: test@test.test"), aActual); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |