diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-09-06 09:31:07 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-09-06 10:05:24 +0200 |
commit | cfc851da557214286685cde26baaac6be70d8624 (patch) | |
tree | 3361789167c09d12ffccef9b244f4dd59d695f82 /sw/qa | |
parent | 2cd787b0f4ef67e426c2e307a7dd157fdd803ed8 (diff) |
crashtesting: fix DOCX export of forum-mso-en-11199.docx
This went wrong in a4432eb0946c0bc775b3d30b634bef5d66544f8d (tdf#104823:
support for sdt plain text fields, 2021-11-24), when we started to turn
cell SDTs into a field containing the cell text, which now needs to work
with redlining, even if the original DOCX file had no fields.
The root cause was introduced earlier, in
0c84c60f48cf681daf467c0678a768711f22e5c3 (tdf#77419 DOCX table import:
ignore right white space, 2020-01-21), which assumed that goRight(2,
select=false) is the opposite of goLeft(1, false) + goLeft(1, true),
which is not true for input fields where an input field with 2 chars
will select 5 chars (not 1) when you do goLeft(1, true) with a cursor at
the right edge of the field (2 chars of content +
CH_TXT_ATR_INPUTFIELDSTART + CH_TXT_ATR_INPUTFIELDEND + the field's
dummy character itself), as "going left" selects the entire field, not
just 1 character.
Fix the problem by replacing goRight() with re-positioning the cursor
the way it was positioned before trimming whitespace a few lines above.
Change-Id: Iaae8878e9801df95d3bc7465d3e8ad12c724a888
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139469
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/cell-sdt-redline.docx | bin | 0 -> 11268 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 7 |
2 files changed, 7 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/cell-sdt-redline.docx b/sw/qa/extras/ooxmlexport/data/cell-sdt-redline.docx Binary files differnew file mode 100644 index 000000000000..41d722299070 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/cell-sdt-redline.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index a2d5f2cca2b2..1bf487a1f3bc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -63,6 +63,13 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineSdtHeader) loadAndSave("inline-sdt-header.docx"); } +CPPUNIT_TEST_FIXTURE(Test, testCellSdtRedline) +{ + // Without the accompanying fix in place, this test would have failed with an assertion failure, + // we produced not-well-formed XML on save. + loadAndSave("cell-sdt-redline.docx"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |