sw/qa/extras/uiwriter/data3/tdf134227.docx |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 31 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
New commits: commit 4bc8c14c34232bb31edf0cb67c971f2d40dd7fdd Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Sep 22 11:14:03 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Sep 22 13:14:09 2020 +0200 tdf#134227: sw_uiwriter: Add unittest Change-Id: I473ab1ea5ccc603c6086189075db49c224d33743 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103149 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/uiwriter/data3/tdf134227.docx b/sw/qa/extras/uiwriter/data3/tdf134227.docx new file mode 100644 index 000000000000..e5228e6ca52f Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf134227.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index dca99f9e3c4c..b3eda5512555 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -73,6 +73,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382) CPPUNIT_ASSERT_EQUAL(8, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134227) +{ + load(DATA_DIRECTORY, "tdf134227.docx"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + CPPUNIT_ASSERT_EQUAL(4, getShapes()); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + // Without the fix in place, it would have crashed here + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); + + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); + + CPPUNIT_ASSERT_EQUAL(4, getShapes()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(4, getShapes()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135412) { load(DATA_DIRECTORY, "tdf135412.docx"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits