sw/qa/extras/uiwriter/data3/tdf135412.docx |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+)
New commits: commit 0fc96ac585520884e3509d574d162ffdae7698c9 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Aug 31 16:57:13 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Sep 1 13:16:09 2020 +0200 tdf#135412: sw_uiwriter: Add unittest Change-Id: I091f5e40161119fcc07c43deaede6bc49049bf87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101745 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/uiwriter/data3/tdf135412.docx b/sw/qa/extras/uiwriter/data3/tdf135412.docx new file mode 100644 index 000000000000..b420fa5ce2d1 Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf135412.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index cd8c7ac359bc..b8972d19f7e2 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -64,6 +64,35 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382) CPPUNIT_ASSERT_EQUAL(8, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135412) +{ + load(DATA_DIRECTORY, "tdf135412.docx"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + CPPUNIT_ASSERT_EQUAL(4, getShapes()); + uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("X"), xShape->getString()); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:Cut", {}); + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + dispatchCommand(mxComponent, ".uno:Paste", {}); + CPPUNIT_ASSERT_EQUAL(4, getShapes()); + + // Without the fix in place, the text in the shape wouldn't be pasted + xShape.set(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("X"), xShape->getString()); + + //Without the fix in place, it would have crashed here + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(4, getShapes()); + xShape.set(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("X"), xShape->getString()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132911) { load(DATA_DIRECTORY, "tdf132911.odt"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits