sw/qa/extras/ooxmlexport/data/content-control-shape.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx            |   12 ++++++++++++
 2 files changed, 12 insertions(+)

New commits:
commit 9ad83843742354312cd543bfbed286c9f52baf1a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Aug 22 14:37:56 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Aug 22 21:00:46 2022 +0200

    crashtesting: fix DOCX export of tdf135569-1.docx
    
    This went wrong in commit 9700c1b2170ad04453a361ed5647937833ac3c18 (sw
    content controls, plain text: add DOCX import, 2022-07-25), which
    conditionally disabled the DOCX export of content control starts.
    
    The trouble is that the matching content control end is still written
    unconditionally, leading to a not-well-formed XML output.
    
    Reading the commit message, the motivation for the conditional start was
    testSdtAndShapeOverlapping in CppunitTest_sw_ooxmlexport7, but it seems
    that is no longer necessary since we try it harder to not pollute the
    doc model with never-read grab-bags in commit
    7ad44f3dd271a591529b048212c4391d8b38ed9d (crashtesting: fix DOCX export
    of forum-mso-de-99522.docx, 2022-08-16).
    
    Fix the problem by just reverting the problematic hunk, seeing it's no
    longer needed for the testSdtAndShapeOverlapping scenario and it causes
    a problem here.
    
    Change-Id: I5cc94ee00dfdf55de1fffe1c28242388549862ac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138685
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 223a43537559efc96b4b5bca32d93211ed849ae5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138544
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/ooxmlexport/data/content-control-shape.docx 
b/sw/qa/extras/ooxmlexport/data/content-control-shape.docx
new file mode 100644
index 000000000000..ab5be6cb694a
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/content-control-shape.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index d624a2de0469..952f397e5cf6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -881,6 +881,18 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlGrabBag)
     save("Office Open XML Text", maTempFile);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testContentControlShape)
+{
+    // Given a document with a <w:sdt> tag:
+    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"content-control-shape.docx";
+    loadURL(aURL, nullptr);
+
+    // When exporting that document back to DOCX:
+    // Then make sure that completes without an assertion failure, which would 
mean not-well-formed
+    // output was produced, since the <w:sdt> was conditional but the </w:sdt> 
was unconditional:
+    save("Office Open XML Text", maTempFile);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf104823)
 {
     // Test how we can roundtrip sdt plain text with databindings support

Reply via email to