diff options
-rw-r--r-- | sw/qa/extras/uiwriter/data3/tdf135412.docx | bin | 0 -> 22923 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf135412.docx b/sw/qa/extras/uiwriter/data3/tdf135412.docx Binary files differnew file mode 100644 index 000000000000..b420fa5ce2d1 --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf135412.docx 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"); |