From eb358d77291eba677141bab113dc27d7aabb0f3e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:44:04 +0200 Subject: Merging upstream version 4:24.2.2. Signed-off-by: Daniel Baumann --- oox/qa/unit/export.cxx | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'oox/qa/unit/export.cxx') diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index aa9690efdb..bfee2e7ef8 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -9,6 +9,9 @@ #include +#include +#include + using namespace ::com::sun::star; namespace @@ -70,6 +73,61 @@ CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition) assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off"_ostr, "y"_ostr, "469440"); } +CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControlOdt) +{ + loadFromFile(u"tdf141786_RotatedShapeInGroup.odt"); + + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + dispatchCommand(mxComponent, ".uno:InsertCheckboxContentControl", {}); + + save("Office Open XML Text"); + // validate(maTempFile.GetFileName(), test::OOXML); // Enable when unrelated errors are fixed. +} + +CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControlDocx) +{ + { + loadFromFile(u"dml-groupshape-polygon.docx"); + + // Without TrackChanges, inserting the Checkbox works just fine + // when exporting to docx. + dispatchCommand(mxComponent, ".uno:InsertCheckboxContentControl", {}); + + save("Office Open XML Text"); + // validate(maTempFile.GetFileName(), test::OOXML); // Enable when unrelated errors are fixed. + } + + { + loadFromFile(u"dml-groupshape-polygon.docx"); + + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xText = xTextDocument->getText(); + uno::Reference xCursor = xText->createTextCursor(); + + // With TrackChanges, the Checkbox causes an assertion in the sax serializer, + // in void sax_fastparser::FastSaxSerializer::endFastElement(sal_Int32). + // Element == maMarkStack.top()->m_DebugStartedElements.back() + // sax/source/tools/fastserializer.cxx#402 + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + + xText->insertControlCharacter(xCursor, text::ControlCharacter::PARAGRAPH_BREAK, false); + + dispatchCommand(mxComponent, ".uno:InsertCheckboxContentControl", {}); + + // Loading should not show the "corrupted" dialog, which would assert. + saveAndReload("Office Open XML Text"); + + // Now that we loaded it successfully, delete the controls, + // still with change-tracking enabled, and save. + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:Delete", {}); + + // Loading should not show the "corrupted" dialog, which would assert. + saveAndReload("Office Open XML Text"); + // validate(maTempFile.GetFileName(), test::OOXML); // Enable when unrelated errors are fixed. + } +} + CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon) { // Given a document with a group shape, containing a single polygon child shape: -- cgit v1.2.3